Using wysiwyg 6.x-2.1
spellchecker['path'] is set to an editor_plugin.js script, while wysiwyg expects it to be a directory when generating a button list in wysiwyg.admin.inc at lines 116 ff.
This causes ugly error messages when PHP open_basedir restrictions are in effect.
Also, there doesn't seem to be any button named .../images/spellchecker.gif, which the code mentioned above seems to expect - which may well be OK, I don't know.
To get rid of the error messages, I patched wysiwyg.admin.inc at line 116 to ignore $meta['path'] unless it is a directory -- but that may be the wrong thing to do. Since I don't know what spellchecker['path'] is used for, I didn't tamper with it.
-rg-
Comment | File | Size | Author |
---|---|---|---|
#15 | wysiwyg-DRUPAL-6--2.plugin-filename.15.patch | 5.75 KB | sun |
#13 | wysiwyg-767550-13-plugin-filename.patch | 5.82 KB | TwoD |
#8 | wysiwyg-767550-8-plugin-filename.patch | 5.16 KB | TwoD |
Comments
Comment #1
dimmie CreditAttribution: dimmie commentedComment #2
iva2k CreditAttribution: iva2k commented@ungeek - Thanks for reporting.
It seems to be a Wysiwyg API issue - there is an inconsistency between Wysiwyg API defining 'path' as pointing to editor_plugin.js file (since August 2009? see API doc patch in http://drupal.org/node/372826#comment-1903492) and icons code in wysiwyg.admin.inc line 116 expecting 'path' to be plugin's directory. Was this code missed in the API update?
Someone from Wysiwyg team - please confirm.
Comment #3
TwoDI think this is a typo in the docs. The editors which we have native plugin support for can accept either a path (folders only) or a path/filename.js when loading plugins. They default to appending the filename themselves ('pluginName.js', 'editor_plugin.js' or similar depending on their conventions) when given just a path, and at least all the plugins I know of follow these conventions. That's why the key is named 'path', and should be given a path without the filename.
(Note that "Drupal plugins" provided via the other plugin hook are a different matter.)
Comment #4
iva2k CreditAttribution: iva2k commented@TwoD - I would also assume this just from the 'path' name, but a simple test (removing filename from 'path') breaks otherwise working spellchecker plugin. I also tried using 'js path', 'js file' and nothing else seem to make it work, only 'path' => '<path>/editor_plugin.js'. So inconsistency is there, the question is where a fix is needed. If you decide to fix it so that 'path' becomes a path, not a filename, please let me know so I can update two plugin modules that I maintain.
Comment #5
TwoDI took another look at the code today and what I said above was spoken too soon. TinyMCE requires a the filename to be present, FCKeditor assumes it's 'fckplugin.js' and CKEditor defauls to 'plugin.js' but allows you to specify a different name using a separate parameter.
I think we should let path be just the path, and add the key filename which defaults to 'editor_plugin.js' for TinyMCE, 'fckplugin.js' for FCKeditor and nothing [internally] for CKEditor (which is effectively the same as defaulting to 'plugin.js').
As there's already several modules out there providing hook implementations for native TinyMCE plugins (all which must be ending path with '/editor_plugin.js') we should also check if the last part of the URL doesn't look like a folder. If it doesn't, use that part as the filename (overriding any definition of the filename key) and strip it from path
Thoughts?
Comment #6
iva2k CreditAttribution: iva2k commentedVery good plan. Besides making perfect sense that would also resolve the original poster's issue.
Comment #7
dimmie CreditAttribution: dimmie commentedThe original poster thanks and agrees. Good discussion here.
-rg-
Comment #8
TwoDA small patch to get this going.
It implements and somewhat documents what was outlined in #5 - but the filename setting overrides any filename set in path instead of the other way around.
Having the filename in path and leaving out filename still works for backwards compatibility with existing plugin wrappers for TinyMCE.
TinyMCE appears to be the only editor where using both path and filename in path was required - and worked - so that's the only one which I cared to do the extra string processing for.
The FCKeditor plugin examples I found never included the filename in the plugin path, and I don't think our implementation worked with it there either, so all this patch does there is to add a trailing slash to path for consistency with the FCKeditor examples and wysiwyg.api.php.
The CKEditor implementation already has support for filename so this was just adjusted to match the examples and docs, as was done for FCKeditor.
This patch does not attempt to change any other "oddities" about the plugin handling, like how the paths for the button images next to the "Buttons and plugins" checkboxes are handled. Those are different issues that probably require some more extensive changes.
Comment #9
TwoDAnyone who's got time to confirm this patch is working and/or review it?
Would be interesting to hear how this change affected the integration of as many plugins as possible.
Comment #10
sunWhy is the ['path'] key removed from $settings?
!== FALSE is not necessary here, as we're only interested in the $name_start > 0 case. Btw, can we rename that variable to $pos ?
Powered by Dreditor.
Comment #11
TwoDWhy is the ['path'] key removed from $settings?
Sorry, typo.
!== FALSE is not necessary here, as we're only interested in the $name_start > 0 case.
Hmm, maybe. Follow up question: Should we allow the plugin file to be placed anywhere, like in the root? If so, this patch needs to change slightly to not add slashes when there is no path.
Comment #12
sunLet's also incorporate #873900: TinyMCE Plugin trying to use non existent CSS file
Comment #13
TwoDI kept the strict FALSE check and added a check for path being just the filename, just in case anyone had the crazy idea of putting a plugin at the root... Could also have done it by removing the slash in the position lookup, but then someone might have called a folder in the path 'editor_plugin.js' and we'd get it wrong. Yes, I'm getting paranoid...
Feel free to decrease the paranoia level of the path if you'd like. Anyone not placing the plugin in a subfolder will just have to adapt.
EDIT: And I'm starting to second guess myself... I probably should have used
===
orstrcmp()
for that string comparison... I have a feeling this isn't going to end well... :sComment #14
sunThe only remaining problem I have with this patch is that it changes the 'path' values to contain a trailing slash, and it doesn't seem like this has been actually tested/confirmed via API docs. I at least know that some of the editors will append a slash on their own, so this would result in a duplicate directory separator...
Powered by Dreditor.
Comment #15
sunLooking at surrounding code, it seems like CKEditor should always get a trailing slash.
For TinyMCE, we're passing a full filepath anyway.
For FCKeditor, I'm not sure and couldn't find any API docs on the web site, but I don't think that there's any native external plugin in the wild anyway, so "who cares"...
Simplified the TinyMCE BC code.
Comment #16
sunFor D7, we're not going to commit this BC code. Instead, we'll change the primary condition to test for 'filename' instead of 'path'.
Powered by Dreditor.
Comment #17
sunThanks for reporting, reviewing, and testing! Committed to all branches.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.
--
D7 requires $plugin['filename'] to be properly defined.