Index: editors/js/ckeditor-3.0.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/js/ckeditor-3.0.js,v retrieving revision 1.2.4.7 diff -u -p -r1.2.4.7 ckeditor-3.0.js --- editors/js/ckeditor-3.0.js 19 Dec 2010 23:55:22 -0000 1.2.4.7 +++ editors/js/ckeditor-3.0.js 20 Dec 2010 00:31:21 -0000 @@ -166,10 +166,26 @@ Drupal.wysiwyg.editor.instance.ckeditor } if (typeof Drupal.wysiwyg.plugins[pluginName].invoke == 'function') { var pluginCommand = { - exec: function(editor) { - var data = { format: 'html', node: editor.getSelection().getSelectedElement() }; - // @todo This is NOT the same as data.node. - data.content = data.node ? data.node.innerHTML : ''; + exec: function (editor) { + var data = { format: 'html' }; + var selection = editor.getSelection(); + data.node = selection.getSelectedElement(); + if (selection && selection.getType() == CKEDITOR.SELECTION_TEXT) { + if (CKEDITOR.env.ie) { + data.content = selection.getNative().createRange().text; + } + else { + data.content = selection.getNative().toString(); + } + } + else if (selection) { + // content is supposed to contain the "outerHTML". + data.content = data.node.$.parentNode.innerHTML; + } + else { + data.content = ''; + } + data.node = data.node ? data.node.$ : null; Drupal.wysiwyg.plugins[pluginName].invoke(data, pluginSettings, editor.name); } };