#748888 by TwoD, sun: Fixed isNode() not called in CKEditor.
authorsun
Sun, 19 Dec 2010 23:55:22 +0000 (23:55 +0000)
committersun
Sun, 19 Dec 2010 23:55:22 +0000 (23:55 +0000)
CHANGELOG.txt
editors/js/ckeditor-3.0.js

index 8ca1271..0dd453b 100644 (file)
@@ -2,6 +2,7 @@
 
 Wysiwyg 6.x-2.x, xxxx-xx-xx
 ---------------------------
+#748888 by TwoD, sun: Fixed isNode() not called in CKEditor.
 #767550 by TwoD, sun, ungeek: Fixed invalid API docs and logic for
   $plugin['filename'].
 #988200 by sun: Changed static language list to ISO 639 defaults of Drupal core.
index 4b186e8..a7aed47 100644 (file)
@@ -109,6 +109,18 @@ Drupal.wysiwyg.editor.attach.ckeditor = function(context, params, settings) {
         });
       }
     },
+
+    selectionChange: function (event) {
+      $.each(Drupal.settings.wysiwyg.plugins[params.format].drupal, function (name) {
+        var plugin = Drupal.wysiwyg.plugins[name];
+        if ($.isFunction(plugin.isNode)) {
+          var node = event.data.selection.getSelectedElement();
+          var state = plugin.isNode(node ? node.$ : null) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF;
+          event.editor.getCommand(name).setState(state);
+        }
+      });
+    },
+
     focus: function(ev) {
       Drupal.wysiwyg.activeId = ev.editor.name;
     }