You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TinyMCE 6.8.3工具栏下拉菜单点击按钮或外部无法关闭的修复求助

TinyMCE 6.8.3 工具栏下拉菜单无法关闭问题解决

在使用TinyMCE 6.8.3版本时,遇到以下问题:点击工具栏按钮或编辑器外部区域时,工具栏下拉菜单无法关闭。

我的编辑器配置代码如下:

tinymce.init({
    selector: 'textarea',
    placeholder: "Content",
    min_height: 300,
    promotion: false,
    branding: false,
    plugins: 'link lists anchor autoresize emoticons preview code',
    toolbar: 'undo redo | bold italic underline strikethrough superscript subscript| forecolor backcolor | \
        alignleft aligncenter alignright alignjustify | \
        bullist numlist outdent indent hr| \
        link emoticons | FileManager | customUppercase customLowercase',
    menubar: 'format',
    menu: {
        format: { title: 'Format', items: 'styles fontsize align lineheight | removeformat' },
    }
});

问题截图及预期行为

工具栏下拉菜单未关闭的截图


解决方法

  • 排查自定义组件冲突:工具栏中的customUppercase、customLowercase和FileManager属于自定义按钮/插件,这类组件常因未实现正确的菜单关闭逻辑导致问题。检查自定义代码,确保在点击外部区域或其他工具栏按钮时,调用tinymce.activeEditor.execCommand('mceRemoveMenu')强制关闭所有菜单。
  • 检查事件冒泡设置:如果自定义按钮的点击事件中使用了event.stopPropagation()阻止冒泡,会干扰TinyMCE的全局菜单关闭逻辑。移除不必要的事件冒泡阻止代码。
  • 调整版本测试:6.8.3可能存在已知bug,可尝试升级到最新稳定版或降级至6.8.2版本,验证问题是否消失。
  • 简化配置定位问题:先移除所有自定义组件和非核心插件,使用最简配置测试菜单能否正常关闭。若正常,再逐个添加组件,定位具体触发问题的模块。

内容的提问来源于stack exchange,提问作者TWF

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 02:27:43