In the plugin for CKEditor is an insert method that leverages CKEditor's insertHtml method;

  insert: function(content) {
    content = this.prepareContent(content);

Because it relies on the DOM implementation, this method doesn't work correctly in webkit browsers (see this ticket). Any wrapping elements are stripped, and replaced with a span containing styling information (for me this was a line-height).

This manifested itself for me when using Node Embed 7.x-1.1 in Chrome 25.0.1364.99, but the issue would equally apply to any module that used this method. I've implemented the fix from the linked ticket in my local version, and it seems to fix the issue;

  insert: function(content) {
    content = this.prepareContent(content);

See also attached patch.



Status:Active» Needs review

Hmm, that seems to break IE 6 and 7. They throw errors or just break paragraphs when trying to insert a Teaser Break placeholder image, or anything else.

Status:Needs review» Needs work

Looks like we either need to find another workaround or wait for the result of the CKEditor ticket to see what they come up with. Or perhaps wait for a webkit fix.

Version:7.x-2.2» 7.x-2.x-dev
new505 bytes

Here's a reroll that applies using Git.

This patch is so far working wonders for me for some odd bugs seen using the WYSIWYG Fields module in Chrome. So it seems to be a good option (if you don't care about IE6 and IE7 support on a particular site).

Related CKEditor ticket:

I'm still a bit nervous of dropping IE7 support at this time...

Issue summary:View changes

Added more information on the issue manifested

Issue summary:View changes

Is it a question of dropping IE7 or Chrome? Seems Chrome isn't dealing with the bug (or at least making any progress on the code). Inserting a bunch of bad html in the output seems to be a good reason to either make this switch or warn users about using Chrome.

Status:Needs work» Needs review
new1.34 KB

Let's just change things for WebKit (and forks of it since they still suffer the same issue).
The previous patch did not work when inserting multiple elements in one insert() call, and CKEditor does not seem to accept a document fragment for insertElement(), so let's use a temporary div for generating the elements and then insert each child one by one. The caret is automatically positioned after each inserted element so this works fine.

Tested in Chromium, Opera and Safari.