Add support for YUI 2.7.x
xhochy - February 27, 2009 - 18:44
| Project: | YUI Rich Text Editor |
| Version: | 6.x-2.33 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
Please add support for YUI version 2.7.x, this could be done through replacing the following line in yui_editor_load_libs()
if (preg_match('/2.6.[0-9]$/iU', $yui_source)) {
with
if (preg_match('/2.[6-7].[0-9]$/iU', $yui_source)) {

#1
The attached patch adds support for YUI 2.7.0. I have tested it with 2.5.0, 2.5.2, 2.6.0 and 2.7.0 and it works.
I have escaped the dots in the version number so they match . not any character. Also the version check is only performed once and boolean is used in the if statements.
Based on current CVS as of 10min ago.
#2
Tested, works well. I made a white space change, other than that it looks great.
#3
That will teach me to upload a patch, without reading it first...
New version with only the whitespace changes.
#4
with 2.7.0 compatibility 'in place', would you consider roll/publish-ing a new -dev tarball? thanks!
#5
I can also confirm this works perfectly.
#6
The above patches do not update the yui_editor/plugins/img_upload.inc file so I've attached a patch that does.
#7
See #560086: YUI editor 2.7 support patch for even more 2.7 support. It includes this work.
#8
Moved from #560086: YUI editor 2.7 support patch, here a patch that includes the above, plus various bug fixes and improvements that also work on earlier version of YUI:
The patch below adds support for YUI 2.7 and fixes quite a number of bugs. Can also be used fine for earlier version of YUI:
1. Support for 2.7.
2. Code button now saves even when pressed.
3. Some code cleanup.
4. Image upload creates the "images" directory if it does not exist. Previously upload would fail without warning if this subdirectory did not exist.
5. YUI editor now works even when used multiple times on a single page.
6. You can't include <?php tags. So I've added a filter which you can enable. Specify PHP with tags and the filter turns that into <?php.
7. The p versus br tag is no longer experimental, works on FF as well, if you patch editor.js.
On the latter, this only works if you do two additional things:
1. The toolbar should have p for the Normal state, so go to group parastyle and add:
{ text: 'Normal', value: 'p', checked: true },
This setting should become dependent on the config.
2. You need to use a patched version of editor.js. In function _createCurrentElement add below:
var _tmp = [], __tmp, __els = ['font', 'span', 'i', 'b', 'u'];
these two lines:
if (this.get('ptags'))
__els.push ('p');
3. In yui_editor.module you should change this:
yui_add_js('editor', $yui_source, '/build/editor/editor-min.js');
To something like:
drupal_add_js(drupal_get_path('module', 'yui_editor') .'/editor.js');
I haven't included this in this patch as it is a more far reaching change and I haven't tested it fully.
#9
The table plugin also didn't work anymore, so here a new patch that includes the above + a fix for the table plugin.
#10
And another patch. It appears that the plugin .css files use a weird formatting for the url() CSS directive, so when you enable CSS compression, the images don't show up.
#11
Patch in #10 didn't work for me.
Applied patch with no errors, set yui to look in /files/2.7.0 where in installed 2.7.0b, but yui_editor never showed up in any text box.
Reverting back to either dev or stable module and /files/2.6.0 brought back yui_editor.
#12
Patch #10 didn't work for me either. Applied with no errors but yui editor no longer appears.
#13
I've only tested with remotely loaded YUI I think. Does patch work when you do that?
#14
I was using remotely loaded YUI, but have now given up on it for the time being and gone over to fckeditor.