Mybb sceditor дополнительные поля - PullRequest
0 голосов
/ 20 января 2020

Я пытаюсь добавить дополнительный контент в mybb sceditor, используя три поля текстовой области, но он не позволяет мне вставлять контент.

Я пытался добавить функцию, но не могу заставить ее работать - помощь приветствуется !

    $.sceditor.command.set('hidep', {
    _dropDown: function (editor, caller) {
        var $content;

        $content = $(
            '<div>' +
            '<div>' +
            '<label for="hidep">' + editor._('Ammount of gems') + '</label> ' +
            '<input type="text" id="hidep" />' +
            '</div>' +
            '<div>' +
            '<label for="des">' + editor._('Content') + '</label> ' +
            '<input type="text" id="des" />' +
            '</div>' +

            '<div>' +
            '<label for="destitle">' + editor._('Title') + '</label> ' +
            '<input type="text" id="destitle" />' +
            '</div>' +              

            '<div><input type="button" class="button" value="' + editor._('Insert') + '" /></div>' +
            '</div>'
        );

        $content.find('.button').on('click', function (e) {
            var val = $content.find('#hidep').val(),
                description = $content.find('#des').val();
                descriptiontitle = $content.find('#destitle').val();
            if (val) {
                // needed for IE to reset the last range
                $(editor).trigger('focus');

                if (!editor.getRangeHelper().selectedHtml() || description) {
                    if (!description)
                        description = val;

                    editor.insert('[hide cost="' + val + '" ' + destitle + ']' + description + '[/hide]');
                } else
                    editor.execCommand('createlink', 'mailto:' + val);
            }

            editor.closeDropDown(true);
            e.preventDefault();
        });

        editor.createDropDown(caller, 'inserthidep', $content.get(0));
    },
    exec: function (caller) {
        $.sceditor.command.get('hidep')._dropDown(this, caller);
    }
});

И это должно выглядеть так!

[hide cost="50" title="Good Stuff"]This is hidden content[/hide]
...