samclarke / SCEditor-MyBB

Repository for the SCEditor MyBB plugin
12 stars 5 forks source link

Question: Spoiler Tag #22

Closed martec closed 11 years ago

martec commented 11 years ago

i use code below

$.sceditor.command.set("spoiler", {
    exec: function (caller) {
        var editor = this;
        var content = $(this._(
            '<form><div><label for="description">{0}</label> <input type="text" id="description" value="" /></div></form>',
            this._("Description of Spoiler:")
        )).submit(function () {
            return false;
        });

        content.append(
            $(this._('<div><input type="button" class="button" value="{0}" /></div>', this._("Insert")))
            .click(function (e) {
                var    description = $(this).parent("form").find("#description").val(),
                descriptionAttr = '';

                if(description)
                {
                   descriptionAttr = '=' + description + '';
                }

                editor.wysiwygEditorInsertHtml('[spoiler'+ descriptionAttr +']', '[/spoiler]');
                editor.closeDropDown(true);
                e.preventDefault();
            }));

        editor.createDropDown(caller, "insertlink", content);

    },
    txtExec: function() {
                    var    descriptionAttr    = prompt(this._("Description of Spoiler:"));

                    if(descriptionAttr)
                        this.sourceEditorInsertText("[spoiler=" + descriptionAttr + "]", "[/spoiler]");
                        else
                        this.sourceEditorInsertText("[spoiler]", "[/spoiler]");
                },
    tooltip: 'Insert um Spoiler tag'
});

code work... but not with align command. what wrong in this code?

martec commented 11 years ago

sorry... solved.

martec commented 11 years ago

thanks