我读取文件(文件大小超过 2.5Mb)并使用 tinyMCE 将内容显示到文本区域。
在加载文本区域时发生脚本错误。 错误是
A script on this page may be busy, or it may have stopped responding.
You can stop the script now, open the script in the debugger, or let the script continue.
Script: http://localhost:8080/tiny-rich-editor/faces/tinyEditor-orginal/tinymce/jscripts/tiny_mce/tiny_mce.js:1
在tinyMCE中使用下面的代码后出现这个错误
ed.onBeforeSetContent.add(function(ed, o) {
// Replaces all \n characters with <br> tag
o.content = o.content.replace(/\n/g, '<br>');
});
上面的代码用于逐行显示内容。如果不使用上面的代码,那么 textarea 将所有内容显示为非原始格式。像一行一行。
帮帮我。 提前致谢。
最佳答案
不能称为“脚本错误”,因为那里没有错误。相反,浏览器不确定长时间等待是否是故意的——是这种情况。如果您再等一段时间,tinyMCE 可能仍会显示结果。
ThiefMaster 的权利:不要尝试将大文件加载到 Javascript 所见即所得编辑器中。 Javascript 始终以解释模式运行,一旦加载了整个文本,就会开始解析和格式化。使用浏览器上运行的 Javascript 处理 2.5MB 文本的成本太高了。
关于javascript - 不支持使用 tinyMCE 编辑器的大文件内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5102609/