简体   繁体   English

使用TinyMCE作为文本编辑器

[英]Using TinyMCE as a text editor

TinyMCE is used in one of my projects as it was meant to be used; 我的一个项目中使用了TinyMCE,因为它原本打算使用; a WYSIWYG HTML editor. WYSIWYG HTML编辑器。

I created a number of plug-ins for it that inserts certain fragments of text into the HTML and all is working fine. 我为此创建了许多插件,可以将某些文本片段插入HTML,并且一切正常。 The plug-ins use TinyMCE's createMenuButton to create a menu button and tinyMCE.activeEditor.execCommand('mceInsertContent', ...) to do the inserting. 插件使用TinyMCE的createMenuButton创建菜单按钮,并使用tinyMCE.activeEditor.execCommand('mceInsertContent', ...)进行插入。

Now I need to add an editor for plain text in the same project. 现在,我需要在同一项目中添加纯文本编辑器。 The text-only editor would also need to be able to insert those same fragments of text into plain <textarea> or <input type="text"> inputs. 纯文本编辑器还需要能够将那些相同的文本片段插入普通的<textarea><input type="text">输入中。

Rather than duplicating code, I'd like to re-use the plug-ins written for TinyMCE. 我想重复使用为TinyMCE编写的插件,而不是复制代码。

Is there any way to either use TinyMCE as a plain text editor or use just the individual plug-ins? 是否可以将TinyMCE用作纯文本编辑器,或仅使用单个插件?

I'm using TinyMCE 3 and can't upgrade to 4 due to missing essential features. 我正在使用TinyMCE 3,由于缺少基本功能而无法升级到4。

您可以按原样使用编辑器,但之后应删除html标签。

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

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