<分区>
有什么方法可以计算在 tinymce 编辑器中输入的字符。我只想设置最低字符要求。或者如何为此目的正确使用 tinyMCE.activeEditor.getContent()
。
<分区>
有什么方法可以计算在 tinymce 编辑器中输入的字符。我只想设置最低字符要求。或者如何为此目的正确使用 tinyMCE.activeEditor.getContent()
。
最佳答案
我相信更好的方法是使用 getContent接口(interface):
// Get the HTML contents of the currently active editor
tinymce.activeEditor.getContent().length
// Get the raw text of the currently active editor
tinymce.activeEditor.getContent({format: 'text'}).length;
// Get content of a specific editor:
tinymce.get('content id').getContent().length
请注意第二个示例中 format
参数的用法,以便获取原始文本而不是带有 HTML 标记的已解析文本。
关于javascript - 计算tinymce中的字符数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33651214/
相关文章:
tinymce - 在 tinymce 4 Modern 主题中只允许某些格式?
javascript - 如何使tinyMCE编辑器在首次初始化后保留在我的jQgrid textarea formit表单中?
javascript - 为什么我的 dropzone javascript 表单不起作用?
javascript - 使用 DOMNodeInserted 确定 .class 名称
jquery - 需要帮助使用 DataTable 中的数据操作 MySQL 中的数据
Wordpress 自定义短代码编辑器 [BackboneJS & TinyMCE)
javascript - MVC 中的波斯日历,Asp.net