Index: editors/js/fckeditor-2.6.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/js/fckeditor-2.6.js,v retrieving revision 1.16.2.1 diff -u -p -r1.16.2.1 fckeditor-2.6.js --- editors/js/fckeditor-2.6.js 22 Jun 2009 03:00:15 -0000 1.16.2.1 +++ editors/js/fckeditor-2.6.js 20 Jan 2010 01:41:18 -0000 @@ -1,6 +1,20 @@ // $Id: fckeditor-2.6.js,v 1.16.2.1 2009/06/22 03:00:15 sun Exp $ /** + * Runs a test to determine if queryCommandEnabled works as expected. + */ +Drupal.wysiwyg.editor.init.fckeditor = function(settings) { + try { + // An exception should be thrown for nonexistent commands. + document.queryCommandEnabled('__wysiwygTestCommand'); + // Safari and Chrome (WebKit based) return -1 instead. + Drupal.wysiwyg.queryCommandEnabledBroken = true; + } + catch (er) { + Drupal.wysiwyg.queryCommandEnabledBroken = false; + } +} +/** * Attach this editor to a target element. */ Drupal.wysiwyg.editor.attach.fckeditor = function(context, params, settings) { @@ -114,6 +128,10 @@ Drupal.wysiwyg.editor.instance.fckeditor return FCK_TRISTATE_DISABLED; } var state = instance.FCK.GetNamedCommandState(this.Name); + if (Drupal.wysiwyg.queryCommandEnabledBroken && state == FCK_TRISTATE_DISABLED) { + // #497654: FCKeditor sets the wrong state in WebKit browsers. + state = FCK_TRISTATE_OFF; + } if (state == FCK_TRISTATE_OFF && instance.FCK.EditMode == FCK_EDITMODE_WYSIWYG) { if (typeof Drupal.wysiwyg.plugins[plugin].isNode == 'function') { var node = instance.FCKSelection.GetSelectedElement();