I have now tried several things, but i need some help.
I have made a new plugin that calls a window like this:
CKEDITOR.plugins.add('specialcode',
{
init: function(editor)
{
var pluginName = 'specialcode';
editor.ui.addButton('specialcode',
{
label: 'specialcode',
command: pluginName,
icon: this.path + 'myplugin.png',
click: function (editor) { window.open('/specialcode.asp','Image Browser','width=900,height=600'); }
});
}
});
This is working fine.
The windows opens and here i have several div tags.
Each div tag contains different HTML code, and when i click a div tag, the content must be put into the editor, but how can i get the content from a div tag insert into the editor with InsertHTML?
It's important that i can get the content form my ASP document because it is generated from a database.
I'm new to CKeditor, but in the Innovastudio editor, i used something like this:
<script>
function insertObject(sHTML)
{
var obj=(opener?opener:openerWin).oUtil.obj;
obj.insertHTML(sHTML);
}
</script>
<div onClick="insertObject(document.getElementById('div1').innerHTML);self.close();">Click to insert form</div>
<div id="div1" style="display:none">This is the content that i insert into the editor</div>
I have made a new plugin that calls a window like this:
CKEDITOR.plugins.add('specialcode',
{
init: function(editor)
{
var pluginName = 'specialcode';
editor.ui.addButton('specialcode',
{
label: 'specialcode',
command: pluginName,
icon: this.path + 'myplugin.png',
click: function (editor) { window.open('/specialcode.asp','Image Browser','width=900,height=600'); }
});
}
});
This is working fine.
The windows opens and here i have several div tags.
Each div tag contains different HTML code, and when i click a div tag, the content must be put into the editor, but how can i get the content from a div tag insert into the editor with InsertHTML?
It's important that i can get the content form my ASP document because it is generated from a database.
I'm new to CKeditor, but in the Innovastudio editor, i used something like this:
<script>
function insertObject(sHTML)
{
var obj=(opener?opener:openerWin).oUtil.obj;
obj.insertHTML(sHTML);
}
</script>
<div onClick="insertObject(document.getElementById('div1').innerHTML);self.close();">Click to insert form</div>
<div id="div1" style="display:none">This is the content that i insert into the editor</div>
Re: Insert html from from window
Yes me to can anyone help here. Either a window or Iframe. Anyone have an example they can share.
I have a similar post here viewtopic.php?f=11&t=22878
Re: Insert html from from window
@altero
Read http://docs.cksource.com/CKEditor_3.x/Developers_Guide/File_Browser_%28Uploader%29/Custom_File_Browser as an example how it works. In ASP it should be similar.
Re: Insert html from from window
I'm sorry, but i can't see how I can use this with inserthtml, can you explain?
Re: Insert html from from window
Re: Insert html from from window
Hmmm, i'm confused, maybe because i'm new to CKeditor
Maybe i can modify the template plugin, it's a kind og predefined content i want to insert ......
Re: Insert html from from window
You don't need the complexity of CKEDITOR.tools.callFunction just to insert HTML in a custom plugin. All that you need is to know the instance name and then call window.opener.CKEDITOR.--instancename--.insertHtml like it's done in the API sample: http://nightly.ckeditor.com/latest/cked ... s/api.html
of course, the sample doesn't use window.opener because it does the call from the same page
Re: Insert html from from window
OK, sometimes I'm blind
Re: Insert html from from window
Re: Insert html from from window
Replace __EDITORNAME__ with ID of your editors textarea.
Re: Insert html from from window
<script language="javascript">
function insertObject(sHTML)
{
window.opener.CKEDITOR.instances.txtContent.insertHTML(sHTML);
}
</script>
<div onClick="insertObject(document.getElementById('div1').innerHTML);self.close();">Click to insert form</div>
<div id="div1" style="display:none">This is the content that i insert into the editor</div>
txtContent is the ID of my editortextarea.
Nothing is insert onclick and firebud reports this:
window.opener.CKEDITOR.instances.txtContent.insertHTML is not a function
Re: Insert html from from window
Re: Insert html from from window
I'm not using frames
My plugin looks like this
CKEDITOR.plugins.add('specialcode',
{
init: function(editor)
{
var pluginName = 'specialcode';
editor.ui.addButton('specialcode',
{
label: 'specialcode',
command: pluginName,
icon: this.path + 'myplugin.png',
click: function (editor) { window.open('/specialcode.asp','Image Browser','width=900,height=600'); }
});
}
});
Re: Insert html from from window
This works, no idea why.
Re: Insert html from from window
Re: Insert html from from window
Re: Insert html from from window
Re: Insert html from from window
This is only to send data from a popup back to CKEditor. You are using a dialog. A dialog window is simply a draggable div.