Drupal plugin buttons disabled in WebKit based browsers
servantleader - June 21, 2009 - 05:35
| Project: | Wysiwyg |
| Version: | 6.x-2.0 |
| Component: | Editor - FCKeditor |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
The teaser break button (in FCK) is disabled in Google Chrome and Safari. Although you can see it, it is "grayed out" and does nothing when clicked on. It works in Firefox and IE. Am I the only one who is having this error?

#1
I've dug into this and found the problem.
It's the same one faced here: http://dev.fckeditor.net/ticket/1180.
FCKeditor determines which state to put a button in by checking
document.queryCommandEnabled()which will return a number to indicate if a [builtin browser-]command can be run at the current state of the document. FCKeditor calls this for all commands, even those created by plugins. Since a plugin's command isn't native to the browserqueryCommandEnabled()throws an exception. FCKeditor catches this exception and uses it to assume that the given command was from a plugin and should be set to "off" rather than "disabled". But some browsers seem to return -1 instead of throwing an exception, fooling FCKeditor to disable the button.The FCKeditor devs have inserted an exception for the print button in Safari, but this seem to happen for all plugin buttons in Chrome.
We could simply check to see if the
statevariable we get back from FCKeditor's wrapper method returns -1 and change the state toFCK_TRISTATE_OFF(0) instead ofFCK_TRISTATE_DISABLED(-1), but then we'd rule out the possibility of Drupal plugins disabling their buttons if say the selection isn't valid for what it does. (Note that we currently don not have this disabled-check in Drupal plugins.)But, we could also regard this as an FCKeditor problem and hope they change their logic to work around that. I doubt they'll do that though since they're probably busy with CKeditor 3.0.
EDIT: Now that I think of it, this probably applies to native plugins which provide their own buttons as well, but I haven't confirmed that.
#2
This is still happening... are we just waiting for FCKeditor to fix the issue? Cheers
#3
Hello
I just opened an issue on the same problem before realizing it may be a duplicate.
Any workaround ?
Should we try to upgrade to CKEditor who is still in early beta ? Because reading the bug report TwoD mentionned it also happens in some versions of CKEditor.....
thanks a lot.
#4
CKeditor is no longer in beta, it's up to 3.0.1 at this point. (Probably won't help much if the problem is still there though.)
The best workaround for this would probably be the method I mentioned above. We won't try to fix problems with the editors own buttons (or native plugins), but maybe we can do something about the Drupal plugins like Teaser Break. As Drupal plugins currently can't use the 'disabled' button state, we could simply swap out that and force the 'off' state instead. In the future, if Drupal plugins can use a 'disabled' state, we might be able to manually double check with the plugin itself. It requires some extra code to get the proper selection from the editor, send the selected element to the plugin and compare the results to determine if the button should really be disabled and not just turned off. It's all a theory at this point though, but if anyone feels they can contribute I'd be happy to review patches. I'm a bit swamped myself to take on this too now. :(
#5
Thanks a lot for your quick reply.
Changing the code is probably way over my head for now but I'll check sometime soon with ckeditor 3.0.1 and I'll report here if they fixed it.
Good luck with your workload, I know the feeling :)