If you use Entity Embed together with CKeditor and add more than 2 elements (entities) into one WYSIWYG-Instance. You will see a strange "behaviour" when you switch between source code view and wysiwyg-view in CKEditor.
The reason is, that CKEditor comes in an iFrame and has no dtd containing a "drupal-entity"-Tag. So in the Browser this code gets messed up on switching the CKEditors view mode (source / rendered).
We could solve the problem by extending the dtd for CKEditor in the first Lines of the drupal-entity plugin.js:
// sites/all/modules/contrib/entity_embed/ckeditor/drupalentity/plugin.js
(function ($, Drupal, CKEDITOR) {
"use strict";
// NEW CODE
CKEDITOR.dtd['drupal-entity'] = CKEDITOR.dtd;
CKEDITOR.dtd.$blockLimit['drupal-entity'] = 1;
CKEDITOR.dtd.$inline['drupal-entity'] = 1;
CKEDITOR.dtd.$nonEditable['drupal-entity'] = 1;
// END NEW CODE
CKEDITOR.plugins.add('drupalentity', {
// This plugin requires the Widgets System defined in the 'widget' plugin.
requires: 'widget',
...
Perhaps there is a better way to achieve the same goal. Anyway it helped.
Comments
Comment #1
zuernBernhard CreditAttribution: zuernBernhard commentedComment #2
zuernBernhard CreditAttribution: zuernBernhard commentedBTW.: Where is a Patch (https://www.drupal.org/node/2348439) for the Media Module, extending Media to support custom "WYSIWYG-Markup" we use it here to embed Images From Media Browser Plus (https://www.drupal.org/project/media_browser_plus) into CKEditor with Entity Embed.
Comment #3
brockfanning CreditAttribution: brockfanning commentedWhoops, missed this. That seems fine to me. I haven't noticed the issue, but don't have a problem adding that code if there aren't repercussions. Is it maybe a difference between WYSWIYG module and CKEditor module? (I've only tested with WYSIWYG so far).
I've pushed up that snippet, thanks for the help.
Comment #4
zuernBernhard CreditAttribution: zuernBernhard commentedWe only tested with CKEditor not with WYSIWYG ;)
Comment #5
brockfanning CreditAttribution: brockfanning commentedSweet, glad to know it's working with CKEditor too.
Comment #6
brockfanning CreditAttribution: brockfanning commented