简体   繁体   English

使用FCKeditor插件添加自定义editorarea CSS

[英]Adding custom editorarea CSS using a FCKeditor plugin

I wrote a plugin for FCKeditor that inserts <div> tags into HTML for later replacement with dynamic data. 我为FCKeditor编写了一个插件 ,该插件将<div>标记插入HTML,以便以后用动态数据替换。

I use the fake image approach to insert an image placeholder into the visual part of the FCKeditor window. 我使用伪造的图像方法将图像占位符插入FCKeditor窗口的可视部分。 That image is connected to the <div> as it appears in the source. 该图像已连接到源中显示的<div> This approach is also used by the native page break functionality native to FCKeditor. FCKeditor的本机分页功能也使用此方法。

I want to apply some styles to that image. 我想对该图像应用一些样式。 Specifically, I want to add a icon image to the background. 具体来说,我想在背景上添加一个图标图像。 I have been adding the CSS to my custom editorarea CSS file that I specified in my config file. 我一直在将CSS添加到我在配置文件中指定的自定义editorarea CSS文件中。 But I'd like to move that code into the plugin directory somehow. 但是我想以某种方式将该代码移动到插件目录中。

Is there a way to add custom CSS to the editoarea using Javascript in a plugin? 有没有办法在插件中使用Javascript将自定义CSS添加到editoarea?

I have written exactly this kind of plug-in myself in the past. 过去,我自己已经编写了这类插件。 Looking at my code, it seems I concluded that it wasn't possible (or at least straightforward) to add custom CSS to the edit document, so I specify everything on the style object of the image placeholder in the plugin script, including a background image that lives in the plugin directory. 看我的代码,似乎我得出结论,不可能(或至少很简单)向编辑文档中添加自定义CSS,因此我在插件脚本中的图像占位符的style对象上指定了所有内容,包括背景位于插件目录中的图像。

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

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