TinyMCE 浏览器“修复”

发布于 2024-11-25 10:15:42 字数 367 浏览 4 评论 0原文

当我使用 TinyMCE 时,我在 Firefox 和 Opera 中遇到 javascript 错误:

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

在我第二次、第三次等保存文本区域的内容后,会出现此错误。第一次保存时......

因为它工作正常在其他浏览器(IE 和 Chrome)中,我认为问题出在 Opera 和可能 Firefox 也在运行的“TinyMCE”修复程序中...

有什么方法可以阻止这些浏览器应用这些修复程序吗?无论如何,浏览器尝试修复第三方脚本对我来说似乎很荒谬

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

耳钉梦 2024-12-02 10:15:42

这是一个tinymce错误。在内部,tinymce 代码使用 来记住粘贴时的插入符号位置。当验证生成的片段时,粘贴后,跨度被视为无效并被删除,从而通过删除标记来破坏代码。
此问题将在下一个官方 tinymce 小版本中修复。对于此类问题有一些解决方法。一是在spans中添加idmce-data-type属性作为有效元素(初始化设置)。例子:

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

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]",
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文