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

skwashd - July 11, 2009 - 23:13

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.

AttachmentSize
yui_editor-386066.patch 1.88 KB

#2

mikejoconnor - July 14, 2009 - 17:57
Status:needs review» reviewed & tested by the community

Tested, works well. I made a white space change, other than that it looks great.

AttachmentSize
yui-editor-2.7.0.patch 2.88 KB

#3

mikejoconnor - July 14, 2009 - 17:59

That will teach me to upload a patch, without reading it first...

New version with only the whitespace changes.

AttachmentSize
yui-editor-2.7.0.patch 1.81 KB

#4

PGNetDev - July 17, 2009 - 04:30

with 2.7.0 compatibility 'in place', would you consider roll/publish-ing a new -dev tarball? thanks!

#5

berenddeboer - August 18, 2009 - 12:00

I can also confirm this works perfectly.

#6

jeremiah.snapp - August 26, 2009 - 14:24

The above patches do not update the yui_editor/plugins/img_upload.inc file so I've attached a patch that does.

AttachmentSize
yui-editor-2.7.0.patch 2.55 KB

#7

berenddeboer - August 26, 2009 - 14:53

See #560086: YUI editor 2.7 support patch for even more 2.7 support. It includes this work.

#8

berenddeboer - August 31, 2009 - 10:03
Status:reviewed & tested by the community» needs review

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.

AttachmentSize
yui_editor-2.7-patch-1.diff 14.22 KB

#9

berenddeboer - September 1, 2009 - 09:05

The table plugin also didn't work anymore, so here a new patch that includes the above + a fix for the table plugin.

AttachmentSize
yui_editor-2.7-patch-2.diff 14.91 KB

#10

berenddeboer - September 1, 2009 - 09:27

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.

AttachmentSize
yui_editor-2.7-patch-3.diff 17.94 KB

#11

Steven Mansour - September 24, 2009 - 15:15

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

cbrody - October 6, 2009 - 05:45

Patch #10 didn't work for me either. Applied with no errors but yui editor no longer appears.

#13

berenddeboer - November 3, 2009 - 00:13

I've only tested with remotely loaded YUI I think. Does patch work when you do that?

#14

cbrody - November 3, 2009 - 09:06

I was using remotely loaded YUI, but have now given up on it for the time being and gone over to fckeditor.

 
 

Drupal is a registered trademark of Dries Buytaert.