简体   繁体   English

如果内容为多个空格,为什么TinyMCE的getContent()返回epmty字符串/

[英]Why TinyMCE's getContent() returns epmty string if content is several space/ 

Why TinyMCE's getContent() returns empty string if content is several space? 如果内容有几个空格,为什么TinyMCE的getContent()返回空字符串?

If my content contain only spaces, then getContent() method return empty string. 如果我的内容仅包含空格,则getContent()方法将返回空字符串。

I want count up chars in TinyMCE's body. 我想在TinyMCE的身体里数一数。

Before TinyMCe returns the editors content this is called in Editor.js: 在TinyMCe返回编辑器内容之前,在Editor.js中将其称为:

h = h.replace(/^\s*|\s*$/g, ''); // h is the content

This removes spaces at the beginning and end of your content, therefor your getContent() is empty when you only have spaces inserted. 这会删除内容开头和结尾的空格,因此当您仅插入空格时,getContent()为空。

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

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