How to add colours to the default color map of Oracle Apex Rich Text Editor using tinymce library?

82 Views Asked by At

I have a page item (type=Rich text editor) on my App. By default it uses tinymce library. I want to change color map on rich text editor. I want to add 2 colors on default color map of Rich Text Editor. How i do that? [enter image description here](https://i.stack.imgur.com/eK8sm.png). I tried to much stuffs and nothing results to me.

I tried to change config object of rich text editor on initialization javascript function attribute of page item. tinymce.init resolves the problema but desconfigre the object (rich text editor) of apex. and i just want to update the object. but in apex i cant get elements from rich text editor how i tried on /UPDATE/ part on my code.

function (config){

    /*UPDATE */
    // Suponha que você tenha uma instância existente do TinyMCE
    var existingEditor = tinymce.get('#P1_TESTEADDCOLORS_APEX');

    console.log("print ===>" || existingEditor);

    // Se existir a instância, aplique o color_map
    if (existingEditor) {
        existingEditor.settings.color_map = [
            '000000', 'Black',
            '808080', 'Gray',
            'FFFFFF', 'White',
            'FF0000', 'Red',
            'FFFF00', 'Yellow',
            '008000', 'Green',
            '0000FF', 'Blue'
    ];
    }

    // Atualize o editor para aplicar as alterações
    existingEditor.execCommand('mceRepaint');

    /*CREATE*/
    /*tinymce.init({
    selector: '#P1_TESTEADDCOLORS_APEX',
    toolbar: 'forecolor backcolor',
    color_map: [
            '000000', 'Black',
            '808080', 'Gray'
        ]
    });*/
    return config;
}
0

There are 0 best solutions below