TinyMCE 堆栈类

编程入门 行业动态 更新时间:2024-10-24 18:21:24
本文介绍了TinyMCE 堆栈类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我使用 TinyMCE 4 作为我的默认编辑器.在配置中我指定了样式格式.这非常有效,除了一件事:它堆叠类.

I'm using TinyMCE 4 as my default editor. In the config I specified style formats. This works excuistly except for one thing: it stacks classes.

我的样式格式:

style_formats: [
        { title: 'Heading 2', block: 'h2', classes: 'heading-02' },
        { title: 'Heading 3', block: 'h3', classes: 'heading-03' },
        { title: 'Heading 4', block: 'h4', classes: 'heading-04' },
        { title: 'Heading 5', block: 'h5', classes: 'heading-05' },
        { title: 'Text', block: 'p', classes: 'copy-02' },
    ],

选择文本并切换格式后,最终结果如下:

After selecting text and switching between format, the end result looks like this:

<h4 class="heading-02 heading-03 heading-04">example</h4>

很明显,除了 Heading-04 之外,应该没有其他类别.但无论如何它都会添加它们.

Obviously there should be no other classes than heading-04 alone. But non the less it adds them anyways.

因此,我的问题是,如何确保格式切换后只有 1 个类.

My question therefore is, how can I make sure there is only 1 class after a format switch.

推荐答案

添加 style_formats_merge: true

Add style_formats_merge: true

style_formats_merge

此选项允许您设置 TinyMCE 是将 style_formats 设置中的样式附加到默认样式格式还是完全替换它们.

This option allows you to set whether TinyMCE should append the styles in the style_formats setting to the default style formats or completely replace them.

来源

这篇关于TinyMCE 堆栈类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 09:25:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1391962.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:堆栈   TinyMCE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!