TinyMCE:样式下拉列表和自定义样式的内容不同

时间:2017-04-28 16:08:29

标签: javascript tinymce tinymce-4

我制作了一个名为“Drop Cap”的自定义样式,我在内容中使用非常大的字体来设置它。但是在Formats下拉菜单中我不希望它使用相同的非常大的字体,我希望它只是正常。在这里你看到了问题:

example showing tinymce editor with problematic menu

我该如何解决这个问题?看起来像tinymce会自动从content_style中获取该样式的CSS,并将其“静态”应用于下拉列表中该元素的style属性!并且没有任何正式命名的类或任何我用来覆盖该样式的东西......

我的JS代码是:

tinymce.init({
    selector:'textarea',
  style_formats_merge: false,
  style_formats: [
    {"title":"Subheading","block":"h5","classes":"subheading"},
    {"title":"Drop Cap","inline":"span","classes":"dropcap clearfix"}
  ],
  content_style: '.dropcap { float: left; font-size: 4.6em; padding-right: 3px;  line-height: 95%; }'
});

示例:https://jsfiddle.net/TheStoryCoder/L8av738L/

1 个答案:

答案 0 :(得分:2)

查看TinyMCE的preview_styles配置选项:

https://www.tinymce.com/docs/configure/editor-appearance/#preview_styles

您可以使用它来控制您希望在菜单中使用多少格式,并在TinyMCE中选择列表。