简体   繁体   English

在 React 中覆盖 TinyMCE 编辑器的 CSS

[英]Overriding CSS of TinyMCE editor in React

I am using TinyMCE 5 for my React project.我正在为我的 React 项目使用 TinyMCE 5。 I want to customize the editor and I want to do things like for eg: editing border property or adding box shadow to toolbar.我想自定义编辑器,我想做一些事情,例如:编辑边框属性或向工具栏添加框阴影。 I tried adding css using content_css property but it isn't working.我尝试使用 content_css 属性添加 css 但它不起作用。 Is there any other work around for it?还有其他解决方法吗?

edit: Here's how I want it to look like in the end here编辑:这就是我希望它最终样子

I was able to add custom icons.我能够添加自定义图标。 Only problem I'm facing is modifying the css.我面临的唯一问题是修改 css。 I want to bring the toolbar down, add shadow effect, make icons little smaller and reduce the width of the toolbar.我想降低工具栏,添加阴影效果,使图标更小并减小工具栏的宽度。 I also tried using styled-components to override CSS but it didn't work.我还尝试使用 styled-components 覆盖 CSS 但它没有用。 Is there any alternative to override CSS?是否有任何替代方法可以覆盖 CSS?

You can bring the toolbar down using toolbar_location: "bottom" .您可以使用toolbar_location: "bottom"来关闭工具栏。

Regarding CSS, you can override the default CSS with your own styles using content_css .关于 CSS,您可以使用content_css用您自己的 styles 覆盖默认的 CSS。 For example:例如:

content_css: "/mycontent.css";

Or you can override specific parts of it using content_style .或者您可以使用content_style覆盖它的特定部分。 For example:例如:

content_style: "body { font-family: Arial; }";

Also see:另见:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM