J is null in TinyMce.js

混江龙づ霸主 提交于 2019-12-14 03:16:02

问题


I use tinymce on my website and I always run into this annoying j is null. In my template file I originally had the init method out in the open like in the example...

<script type="text/javascript" >
tinyMCE.init({
        mode : "textareas",
        theme : "simple"   
});
</script>

But in the error console of Firefox I see something that says "j is null" and the reference is somewhere within the tiny_mce.js file. Any help is appreciated. Thanks so much.


回答1:


It's a tinymce bug. Internally, the tinymce code uses a <span id="mce_marker"></span> to remember the caret-position when pasting. when validating the resulting fragment, after the paste, the span is deemed invalid and removed, thus breaking the code by removing the marker. This issue will be fixed in the next official tinymce minor release. There are some workarounds for this kind of issue. One is to add to add id and mce-data-type attribute to spans as valid elements (init setting). Example:

// The valid_elements option defines which elements will remain in the edited text when the editor saves.
    valid_elements: "@[id|class|title|style]," +
    "a[name|href|target|title]," +
    "#p,-ol,-ul,-li,br,img[src],-sub,-sup,-b,-i,-u" +
    "-span[data-mce-type]",


来源:https://stackoverflow.com/questions/6909132/j-is-null-in-tinymce-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!