如何使用 React-TinyMCE 将 CSS 类添加到我的可编辑元素 [英] How can I add CSS class to my editable element using React-TinyMCE

查看:35
本文介绍了如何使用 React-TinyMCE 将 CSS 类添加到我的可编辑元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用预定义的 CSS 为我的可编辑内容框设置样式,方法是添加类名称,但我没有看到任何允许我这样做的属性.有一个属性 body_class 但它似乎不适用于

I wanted to style me editable content box with predefined CSS, either by adding a Class name but I don't see any property that enables me to do that. There is a property body_class but it doesn't seem to work for react-tinymce

这是我的代码

 <Editor
       init={{toolbar: false}}
       apiKey="xxxxx"
       inline={true}
       value="Design DIY">
  </Editor>

推荐答案

如果您想将 CSS 传递给编辑器,以便在编辑时使用它来设置内容样式,您需要使用 content_csscontent_style 配置选项.

If you want to pass CSS into the editor so that it is used to style the content while editing you need to use either the content_css or content_style configuration options.

https://www.tiny.cloud/docs/configure/内容外观/#content_csshttps://www.tiny.cloud/docs/configure/content-appearance/#content_style

content_css 可能更简单,因为它允许您将 CSS 放在外部文件中并通过 URL 引用它.

The content_css is likely easier as it allows you to place the CSS in an external file and reference it via a URL.

这篇关于如何使用 React-TinyMCE 将 CSS 类添加到我的可编辑元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆