【问题标题】:TinyMCE and Piranha CMS not allowing me to set <style> tags as valid elements :(TinyMCE 和 Piranha CMS 不允许我将 <style> 标签设置为有效元素 :(
【发布时间】:2021-07-23 22:55:53
【问题描述】:

我正在尝试将 添加到微型 mce 编辑器中,但目前它会在保存时删除样式标签以及它们之间的任何内容。 我正在尝试设置valid_elements:“style”和/或custom_elements:“sabioStyle”和/或extended_valid_elements:“style”。我也尝试过:“[]”,根据 tiny 的文档,但它似乎对任何东西都没有影响。我看到init函数:

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 使用集合 extended_valid_elements: piranha.editorconfig.extended_valid_elements 但我的开发工具没有显示我在 editorconfig.json 中键入的值...

editorconfig.json devTools

我已经尝试了他们的文档所说的一切,我在 github 上也有一个关于 Piranha 的问题。任何建议都会很棒!谢谢

【问题讨论】:

    标签: tinymce piranha-cms


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-14
      • 1970-01-01
      • 2015-04-20
      • 1970-01-01
      • 1970-01-01
      • 2023-03-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多