问题描述
限时送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:关键词]
发布评论