TinyMCE and Piranha CMS not allowing me to set tags as valid elements :(

  Kiến thức lập trình

I’m trying to add <style>// custom css here</style> into the tiny mce editor but currently it deletes the style tags and anything in between them on save.
I am trying to set valid_elements: “style” and/or custom_elements: “sabioStyle”, and/or extended_valid_elements: “style”. I’ve also tried: “[]” according to tiny’s docs but it seems to have no effect on anything. I see that the init function:

piranha.editor.addInline = function (id, toolbarId) {
    tinymce.init({
        selector: "#" + id,
        browser_spellcheck: true,
        fixed_toolbar_container: "#" + toolbarId,
        menubar: false,
        branding: false,
        statusbar: false,
        inline: true,
        convert_urls: false,
        plugins: [
            piranha.editorconfig.plugins
        ],
        width: "100%",
        autoresize_min_height: 0,
        toolbar: piranha.editorconfig.toolbar,
        extended_valid_elements: piranha.editorconfig.extended_valid_elements,
        block_formats: piranha.editorconfig.block_formats,
        style_formats: piranha.editorconfig.style_formats,
        file_picker_callback: function(callback, value, meta) {
            // Provide file and text for the link dialog
            if (meta.filetype == 'file') {
                piranha.mediapicker.openCurrentFolder(function (data) {
                    callback(data.publicUrl, { text: data.filename });
                }, null);
            }

            // Provide image and alt text for the image dialog
            if (meta.filetype == 'image') {
                piranha.mediapicker.openCurrentFolder(function (data) {
                    callback(data.publicUrl, { alt: "" });
                }, "image");
            }
        }
    });
    $("#" + id).parent().append("<a class='tiny-brand' href='https://www.tiny.cloud' target='tiny'>Powered by Tiny</a>");
};

Piranha uses sets extended_valid_elements: piranha.editorconfig.extended_valid_elements but my dev tools are not showing the value that I type in editorconfig.json…

editorconfig.json
devTools

I’ve tried everything their docs say, I have a question open on github with Piranha as well.. Any suggestions would be great! Thanks

See the complete answer here: https://github.com/PiranhaCMS/piranha.core/issues/1663

LEAVE A COMMENT