Yahoo User Interface Library is really good. They're about to release a v3 soon.
http://developer.yahoo.com/yui/editor/

I'm going to add this to WYSIWYG API (or at least try my best). If you have done any work on this or are interested in helping out join me in IRC channel #drupal-wysiwyg.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davidburns’s picture

FileSize
5.53 KB

Here's the basic yui.inc file

-- It's only loading one of the library files, which is yahoo-dom-event.js not sure why
-- Unsure how to add more complex items to yui toolbar, this would include select list, spell check etc... I need to take a closer look at tinyMCE
-- Same goes with creating the yui.js which is able to load and unload the editor when selecting input formats

davidburns’s picture

FileSize
5.43 KB

Couple editing errors in the last file, nothing that would stop it from working though. Just cruft left over from my copy and paste.

sun’s picture

Title: Add YUI Rich Text Editor Support » Add YUI Rich Text Editor support
Assigned: davidburns » Unassigned
Status: Active » Needs review
FileSize
8.22 KB

There you go. Attaching/detaching as well as switching to a different editor works fine for me.

Please note that you might have to remove your wysiwyg profile in front of getting this to work (to reset the editor configuration).

Lastly, support for externally hosted scripts should be dealt with in a separate issue. Let's get this sucker in first ;)

davidburns’s picture

FileSize
1.7 KB
9.31 KB

Here's the new yui.inc that builds the js based upon which settings you have enabled.
And I added some code to yui.js that will take these settings into account, but still getting some errors. So I commented them out but still may be useful and save some time.

sun’s picture

FileSize
11.37 KB

Simplified.

sun’s picture

Status: Needs review » Active

Committed patch in #5, so it is easier for you to create a patch.

davidburns’s picture

FileSize
5.08 KB

Here's a patch that does grouping. I based it off of how you did button settings. Still doesn't seem as streamlined as it should be, too much hardcoded. But It is outputting the buttons in expected array structure.

davidburns’s picture

Status: Active » Needs work

patch needs work

davidburns’s picture

In reference to the non-working patch above. It leads me to believe we're missing an extra wrapper to YAHOO.widget.Editor.
Here's code that is working for our site in Drupal 5 using a modified version of YUI Editor module

<script type="text/javascript" src="/sites/all/modules/custom/yui_rte/js/yui_rte.js"></script>
<script type="text/javascript" src="/sites/all/modules/custom/yui_rte/toolbars/yui_rte_toolbar_simple.js"></script>

<script type="text/javascript">
        if (Drupal.jsEnabled) { 
          $(document).ready(function() { 
            $('body').addClass('yui-skin-sam'); 
          }); 
        }
        // safari submit button always defaults to first 'button' available on page (example: 'preview')
        // core YUI RTE issue http://drupal.org/node/321863. Do not display RTE in Safari for now.
        if (!$.browser.safari) {
          YAHOO.util.Event.onDOMReady(function() { 
            YAHOO.Drupal.editors.push(new YAHOO.Drupal.yui_editor('edit-body', { "height": "240px", "smiley": 1, "smiley_path": "/sites/all/modules/custom/yui_rte/images/smileys/", "base_path": "/", "markup": "xhtml" })); 
 YAHOO.Drupal.yui_editor_load.fire();
          }); 
        }
</script>
sun’s picture

davidburns’s picture

FileSize
5.77 KB

REFER TO COMMENT #14

Here's another patch. Some of the Checkboxes on configuration page were improperly named (parastyle instead of formatselect), couple other changes.

davidburns’s picture

FileSize
6.15 KB

REFER TO COMMENT #14

Here's a patch that has been ran the proper way
diff -urp oldfile newfile > patch_name.diff

Grouping still doesn't work

davidburns’s picture

REFER TO COMMENT #14

This is patched against HEAD.
You can see the grouping is working fine. It's how we are listing 'buttons' within the group array that seems to be borked.

It's getting close. Any suggestions would be appreciated.

davidburns’s picture

FileSize
8.44 KB

SIMPLIFIED
Here's a more streamlined way to do grouping. I believe we'll be able to do grouping with external plugins if we go this route.
This is a patch against HEAD.

Ignore patches from comments #11, #12, & #13

davidburns’s picture

I just noticed something else that might help figure this out...
If you apply my last patch and uncomment line 191, you'll see the grouping titles appear like they are supposed to. Here's a screenshot

EXAMPLE 1

$settings['toolbar']['buttons'] = array_merge(array('type' => '', 'label' => '', 'value' => ''), $grouped_buttons);

now if you slightly modify this code to be the following

EXAMPLE 2

$settings['toolbar']['buttons'][] = $grouped_buttons;

You'll see an undefined button appear, Here's a screen shot.

So lets look at the differences in output to see what's allowing this button to appear.

EXAMPLE 1

"buttons": [{
    "group": "textstyle",
    "label": " Font Name and Size",
    "buttons": [{
        "type": "push",
        "label": "Bold",
        "value": "bold"
    }, {
        "type": "push",
        "label": "Italic",
        "value": "italic"
    }, {

EXAMPLE 2

"buttons": {
    "type": "",
    "label": "",
    "value": "",
    "0": {
        "group": "textstyle",
        "label": " Font Name and Size",
        "buttons": [{
            "type": "push",
            "label": "Bold",
            "value": "bold"
        }, {
        "type": "push",
        "label": "Italic",
        "value": "italic"
        }, {

I guess the only real thing that jumps out at me is the first occurrence of 'buttons' in both instances.
Example 1 has "buttons": [{ /// no buttons
Example 2 has "buttons": { /// undefined button

I'm not a JS expert but I believe this may be the reason why we are getting NULL values for this._buttonList in editor.js
How can we get EXAMPLE 1 to output more like EXAMPLE 2???

sun’s picture

What I would really like to know and suggest to test next is whether the example configuration snippet on http://developer.yahoo.com/yui/editor/#toolbar, when copied 1:1 into the attach function (instead of passing the settings variable) actually works. If it really does, there has to be a subtle difference between that code and the settings we are passing.

greg.harvey’s picture

Subscribing - will try to test as well... =)

deshilachado’s picture

subscribing...

hass’s picture

#390246: YUI Editor not loaded (this._buttonList is null error) has been marked as a duplicate, but have an interim workaround.

sun’s picture

Title: Add YUI Rich Text Editor support » Add editor: YUI Rich Text
Version: 6.x-1.x-dev » 6.x-2.x-dev
sun’s picture

One interesting thing in hass' patch (of the other issue) is that he's additionally defining _defaultToolbar.buttonType = basic - I have no idea what this setting is for, but maybe it helps this issue.

hass’s picture

If I remember correctly this is a newer (?) option to say 'buttonType' => 'simple', but does the same. It loads a small and simple editor http://developer.yahoo.com/yui/examples/editor/simple_adv_editor.html (less KB, basic functionality). The "advanced" editor may be better for this issue. But I'm not sure... never worked with YUI.

a_c_m’s picture

I've just installed 2.7.0 on HEAD and the buttons show and seem to work, but they are all aligned down the left hand side, one per line.

Very willing to test any new patches.

8w_gremlin’s picture

Category: feature » bug
Priority: Normal » Critical
Status: Needs work » Active

I'm having the same issue. I have a clean install of Drupal and I've just installed 2.7.0, all buttons on the same side in a vertical line.

hass’s picture

Category: bug » feature
Priority: Critical » Normal
Status: Active » Needs work
sun’s picture

Is the malfunction perhaps caused by Drupal.wysiwyg.clone() ? #470928: Drupal.wysiwyg.clone turns arrays into objects seems, from a technical perspective, like nonsense to me - but - if YUI is actually testing the passed in settings to be explicitly an array, maybe?

elgreg’s picture

+1 Same issue re: stacked on top of each other. I'd say this renders YUI useless for WYSIWYG api. Wondering why more aren't having this problem. It looks like the css display setting of inline-block on .yui-button is being overridden in editor.css for YUI.

andydev’s picture

Subscribed.

Same happens with me. Default drupal 6.12 installation, default theme, default Yui.

All buttons show in one vertical row.

MatWho’s picture

Yes same problem, all icons stacked on left side

jozzhart’s picture

Category: feature » bug

Same issue here (vertical stacking of icons and not displaying correctly) on clean install.

sun’s picture

Category: bug » support

If you would read the issue, then you'd notice that this still is a feature request.

sun’s picture

Category: support » feature

Meh.

bejam’s picture

subscribing

sun’s picture

#470928: Drupal.wysiwyg.clone turns arrays into objects has been committed for WYMeditor support. Now let's see whether this helps here, too! :)

sun’s picture

Status: Needs work » Fixed
FileSize
7.81 KB

Yeah. That fixed it.

Thanks for reporting, reviewing, and testing! Committed attached patch to all 2.x branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.