Add "text color" in Context menu in tinyMCE

I'm trying to add a text color picker in the context menu of TinyMCE. I don't know if I can use a plugin included in tinyMCE or I have to program manually the behavior of color change.

I have tried this:

tinymce.init({
        selector: id,
        toolbar: false,
        menubar: false,
        statusbar: false,
        width: "100",
        height: "220",
        content_css: "/content/texteditor.css",
        plugins: [
            "advlist autolink lists link charmap preview anchor",
            "searchreplace visualblocks code fullscreen",
            "insertdatetime media table contextmenu paste imagetools",
            "textcolor colorpicker"
        ],
        contextmenu: "textcolor colorpicker",
        setup: function (editor) {
            editor.on('change', function () {
                tinymce.triggerSave();
            });
        }
    });

note that I tried to add in the contextmenu the plugin "textcolor colorpicker".

There are some way to add a text color picker or color picker in the context menu?

Thanks.

Upvotes: 1

Views: 862

Answers (1)

Michael Fromin
Michael Fromin

Reputation: 13744

You are trying to place a toolbar button on a menu - toolbars and menus are different elements and you cannot place a toolbar button on a menu.

If you wanted color selection(s) on a menu you would either have to write your own color picker or extend the one provided with TinyMCE to also deliver a menu option.

Upvotes: 1

Related Questions