News:

Wondering if this will always be free?  See why free is better.

Main Menu

Add a drop down list to editor

Started by Do2, October 31, 2009, 06:30:01 AM

Previous topic - Next topic

Do2

Hello,

i need to add a drop down list to the editor. Actually it's really simple, but on the simple way you can't insert the values of the list into the active wysiwyg editor. I searched and tried a bit, but its really complicated.

I need some help with this issue.

Thanks for help.

Do²

Arantor

What type of dropdown list? Like the font one (which is controlled from Javascript IIRC) or like the inline image one when editing a post?
Holder of controversial views, all of which my own.


Do2

Like the font one. I need this for my MOD (Boilerplates for posts), because at the moment you can't insert the boilerplates in the active wysiwyg editor. Do you know how my MOD works?

Arantor

Quote from: Do² on October 31, 2009, 12:43:37 PM
Do you know how my MOD works?

No, because I haven't actually looked at it.

I'd be looking at how the WYSIWYG editor itself had dropdowns, unfortunately it's one part of the code I'm not familiar with because I never personally use it.
Holder of controversial views, all of which my own.


Do2

The dropdowns are created in the GenericControls.template.php and i think the editor.js is also used, but my knowledge about js is really bad. :-[

Do2

Hello!

I found the places for the drop down list and it works all fine in Firefox.

If i use the IE8 i could insert into the inactive WYSIWYG editor, but if i want to insert in the active one, there's an error:

Invalid argument - editor.js, line 827     return this.oFrameDocument.execCommand(sCommand, bUi, sValue);

I don't know where's the mistake, because in FF it works.

Thanks for help.

Do2

I become crazy, and i need really help with this issue. Adding a Drop down list to editor in RC2 isn't the problem, but i don't know where are the correct places in editor.js.

I would be really HAPPY, if someone can help me. ;)

Arantor

If it works in Firefox then you've presumably mastered the core part of it.

What, exactly, is being passed into execCommand's parameters there? Do you get any errors in Firefox? (Even though it works you may still get errors)
Holder of controversial views, all of which my own.


Do2

No errors in FF, just in IE8. I think in the new Code for RC2, both files in attachment are for RC2, is something missing. :-X

In IE8 i get this error: oSelectElement is undefined. Line 756.

Here the execCommand for my code: this.smf_execCommand('inserthtml', false, sValue);

I'm not good in JS, so i can't solve it myself.

Arantor

And what does sValue contain at that point?

Also, where exactly have you added this?
Holder of controversial views, all of which my own.


Do2

It starts in line 756.

Here an extract:

    // Or color even?
    else if (oSelectProperties.sName == 'sel_color')
    {
        // Are we in boring mode?
        if (!this.bRichTextEnabled)
            surroundText('[color=' + sValue + ']', '[/color]', this.oTextHandle)

        else
            this.smf_execCommand('forecolor', false, sValue);
    }
    //START Boilerplates for posts
    else if (oSelectElement.code == 'sel_boilerplates')
    {
        // Are we in boring mode?
        if (!this.bRichTextEnabled)
            surroundText('' + sValue + '', '', this.oTextHandle)

        else
            this.smf_execCommand('inserthtml', false, sValue);
    }
    //END Boilerplates for posts

Arantor

Is that the only code you added?

Where is oSelectElement defined? I note that the code from the previous entry refers to oSelectProperties, not oSelectElement.
Holder of controversial views, all of which my own.


Do2

#12
I changed an it works in FF. IN IE8 i get this error: invalid argument: line 649 (if the WYSIWYG editor ist active)

    return this.oFrameDocument.execCommand(sCommand, bUi, sValue);

Arantor

So what's in sCommand, bUi and sValue?
Holder of controversial views, all of which my own.


Do2

If i see and understand it right, this:             this.smf_execCommand('inserthtml', false, sValue);

Do2

Has anyone an idea? I dind' understand why it doesn't work on IE8 but on FF. :o

Advertisement: