Opened 16 years ago
Closed 16 years ago
#4525 closed Bug (invalid)
[IE6] setData problem with custom plugin
| Reported by: | Damian | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 3.1 |
| Component: | General | Version: | |
| Keywords: | IBM | Cc: |
Description
A simple plugin calling setData() on the editor in the exec() method falls over in IE6.
The plugin is invoked by a command on the toolbar.
Plugin exec() definition:
CKEDITOR.plugins.simplePlugin=
{
exec:function(editor){
editor.setData('<b>test</b>');
}
};
When using a Microsoft debugger the error thrown is:
Error: 'this.$.innerHtml' is null or not an object.
Line 331 in element.js
I've traced this down to what I think is the call to getSnapshotData() in the wysiwygarea which ultimately calls getHtml() on the element, after setting the data.
Only an issue with IE6.
Change History (3)
comment:1 Changed 16 years ago by
| Keywords: | Pending added |
|---|
comment:2 Changed 16 years ago by
Here is the full plugin.js file, which resides in "plugins/testsetdata":
CKEDITOR.plugins.add( 'testsetdata',
{
init : function( editor )
{
editor.addCommand( 'testsetdata', CKEDITOR.plugins.testsetdata );
editor.ui.addButton( 'testsetdata',
{
label : 'TestSetData',
command : 'testsetdata'
});
}
} );
CKEDITOR.plugins.testsetdata =
{
exec:function(editor){
editor.setData('<b>Test</b>');
}
};
And here is the config.js
config.extraPlugins='testsetdata'; config.toolbar=[[ 'Source', '-', 'Bold', 'Italic','testsetdata' ]];
Those are the only changes to a default build.
comment:3 Changed 16 years ago by
| Keywords: | Pending removed |
|---|---|
| Resolution: | → invalid |
| Status: | new → closed |
It's not a bug, coz 'editor.setData' should be declared as a 'asynchronous' command and you need to manually fire the after command event:
editor.addCommand('testsetdata',
{
async : true,
exec : function( editor )
{
var command = this;
editor.setData( '<b>Test</b>', function()
{
editor.fire( 'afterCommandExec',
{
name: 'testsetdata',
command: command
} );
});
}
});
Sorry for the obscure but we should document this special case very soon.

I don't have the bug with the setData call in 'api' sample file, could you provide a reduced plugin for reproducing?