summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--editors/js/tinymce-2.js10
-rw-r--r--editors/js/tinymce-3.js10
2 files changed, 16 insertions, 4 deletions
diff --git a/editors/js/tinymce-2.js b/editors/js/tinymce-2.js
index a09e5aa..1f902e9 100644
--- a/editors/js/tinymce-2.js
+++ b/editors/js/tinymce-2.js
@@ -49,9 +49,15 @@ Drupal.wysiwyg.editor.attach.tinymce = function(context, params, settings) {
tinyMCE.settings[setting] = settings[setting];
}
- // #715228: Remove extra mceItem class added by Wysiwyg < v2.1.
+ // Remove TinyMCE's internal mceItem class, which was incorrectly added to
+ // submitted content by Wysiwyg <2.1. TinyMCE only temporarily adds the class
+ // for placeholder elements. If preemptively set, the class prevents (native)
+ // editor plugins from gaining an active state, so we have to manually remove
+ // it prior to attaching the editor. This is done on the client-side instead
+ // of the server-side, as Wysiwyg has no way to figure out where content is
+ // stored, and the class only affects editing.
$field = $('#' + params.field);
- $field.val($field.val().replace(/class=(['"].*?)\bmceItem\b(.*?['"])/ig, 'class=$1$2'));
+ $field.val($field.val().replace(/(<.+?\s+class=['"][\w\s]*?)\bmceItem\b([\w\s]*?['"].*?>)/ig, '$1$2'));
// Attach editor.
tinyMCE.execCommand('mceAddControl', true, params.field);
diff --git a/editors/js/tinymce-3.js b/editors/js/tinymce-3.js
index b935e2d..d8f20be 100644
--- a/editors/js/tinymce-3.js
+++ b/editors/js/tinymce-3.js
@@ -65,9 +65,15 @@ Drupal.wysiwyg.editor.attach.tinymce = function(context, params, settings) {
$('#' + ed.editorContainer + ' table.mceToolbar').remove();
});
- // #715228: Remove extra mceItem class added by Wysiwyg < v2.1.
+ // Remove TinyMCE's internal mceItem class, which was incorrectly added to
+ // submitted content by Wysiwyg <2.1. TinyMCE only temporarily adds the class
+ // for placeholder elements. If preemptively set, the class prevents (native)
+ // editor plugins from gaining an active state, so we have to manually remove
+ // it prior to attaching the editor. This is done on the client-side instead
+ // of the server-side, as Wysiwyg has no way to figure out where content is
+ // stored, and the class only affects editing.
$field = $('#' + params.field);
- $field.val($field.val().replace(/class=(['"].*?)\bmceItem\b(.*?['"])/ig, 'class=$1$2'));
+ $field.val($field.val().replace(/(<.+?\s+class=['"][\w\s]*?)\bmceItem\b([\w\s]*?['"].*?>)/ig, '$1$2'));
// Attach editor.
ed.render();