开发者

TinyMCE browser "fixes"

开发者 https://www.devze.com 2023-03-21 23:21 出处:网络
I\'m getting a javascript error in Firefox and Opera when I\'m using TinyMCE: j is null (function(d){var a=/^\\s*|\\s*$/g,e,c=\"B...a.selection.onSetContent.add(f)})}});

I'm getting a javascript error in Firefox and Opera when I'm using TinyMCE:

j is null
(function(d){var a=/^\s*|\s*$/g,e,c="B...a.selection.onSetContent.add(f)})}});

This error comes up after I save the contents开发者_如何转开发 of the textarea for the 2nd time, 3rd etc. First time it gets saved...

Since it's working fine in the other browsers (IE and Chrome), I assume the issue is within the "TinyMCE" fixes which Opera and probably Firefox too are running...

Is there any way I can stop these browsers from applying these fixes? Anyway it seems ridiculous to me for a browser to attempt to fix a 3rd party script


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 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]",
0

精彩评论

暂无评论...
验证码 换一张
取 消