Element-UI的dialog对话组件内的tinymce弹窗被遮挡的解决办法及其它相关注意事项

news/2025/3/4 7:06:55/

问题一:tinymce的弹窗被遮挡

问题截图

在这里插入图片描述

解决办法

修改层级

注意要写在 <style></style> 中,我当时没注意,写在了 <style scoped></style> 中,死活没反应。

<style>
/* 在el-dialog中tinymce z-index 被太小而被遮挡时要加这两句 */
.tox-tinymce-aux{z-index:99999 !important;}
.tinymce.ui.FloatPanel{z-Index: 99;}
</style>

问题二:tinymce打开弹出菜单后直接关闭对话组件,导致该弹出菜单残留

问题截图

在这里插入图片描述
在这里插入图片描述

解决办法

利用属性 :destroy-on-close="true" 要求对话组件关闭后销毁其中的元素

<el-dialog :destroy-on-close="true">
...
</el-dialog>

问题三:如何使用中文

解决办法

下载中文包,初始化时配置中文即可。

  1. 中文包位置:https://www.tiny.cloud/get-tiny/language-packages/
    在这里插入图片描述
  2. 配置
<Editor :init="{language: 'zh_CN'}" />

问题四:tinymce会提示注册云

问题截图

如果只导入了import Editor from '@tinymce/tinymce-vue',而没有配置api-key,则会提示注册云,因为会到云去下载。
在这里插入图片描述

解决办法

有三个解决方法

  1. 点击提示中的注册链接【create an account】,去注册一个账号,就能获得一个 api-key
    在这里插入图片描述

使用时将该值配置给 api-key 就行

<Editor :api-key="abcdefghijklmnopqrst1234567890" />
  1. 本地加载所有需要的文件
    例如:
import editor from '@tinymce/tinymce-vue'import 'tinymce/tinymce'// Theme
import 'tinymce/themes/silver/theme'// Skins
import 'tinymce/skins/ui/oxide/skin.min.css'
import 'tinymce/skins/ui/oxide/content.min.css'
import 'tinymce/skins/content/default/content.min.css'// Plugins
import 'tinymce/plugins/fullscreen'
import 'tinymce/plugins/paste'
import 'tinymce/plugins/autoresize'
  1. 删除 tinymce.min.js 该提示。。。
"service_message":"This domain is not registered with Tiny Cloud.  Please review \u003ca target=\"_blank\" href=\"https://www.tiny.cloud/my-account\"\u003eyour approved domains\u003c/a\u003e."

给个整体参考:

<!--注意属性 :destroy-on-close="true"-->
<el-dialog v-model="dialogFormVisible" :before-close="closeDialog" title="弹窗操作" :destroy-on-close="true"><el-form :model="formData" label-position="right" ref="elFormRef" :rules="rule" label-width="80px"><el-form-item label="content字段:"  prop="content" ><Editor:api-key="tinymceApiKey" :init="tinymceInit" v-model="formData.content" /></el-form-item></el-form>
</el-dialog><script setup>
// === 编辑器开始 ===
// import 'tinymce' //如果启用本项,则后续必须手动导入所有皮肤、插件等,可以不用apikey
import Editor from '@tinymce/tinymce-vue'
const tinymceApiKey = "abcdefghijklmnopqrstuvwxyz"
const tinymceInit = {//selector: 'textarea',language: 'zh_CN',plugins: 'fullscreen anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount checklist mediaembed casechange export formatpainter pageembed linkchecker a11ychecker tinymcespellchecker permanentpen powerpaste advtable advcode editimage tinycomments tableofcontents footnotes mergetags autocorrect typography inlinecss',toolbar: 'fullscreen | undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | link image media table mergetags | addcomment showcomments | spellcheckdialog a11ycheck typography | align lineheight | checklist numlist bullist indent outdent | emoticons charmap | removeformat',tinycomments_mode: 'embedded',tinycomments_author: 'Author name',mergetags_list: [{ value: 'First.Name', title: 'First Name' },{ value: 'Email', title: 'Email' },]}
// === 编辑器结束 ===const formData = ref({content: ''})
const rule = reactive({
})const elFormRef = ref()// 弹窗控制标记
const dialogFormVisible = ref(false)// 关闭弹窗
const closeDialog = () => {dialogFormVisible.value = falseformData.value = {content: ''}
}
</script><style>
/* 在el-dialog中tinymce z-index 被太小而被遮挡时要加这两句 */
.tox-tinymce-aux{z-index:99999 !important;}
.tinymce.ui.FloatPanel{z-Index: 99;}
</style><style scoped>
@media (min-width: 1024px) {#sample {display: flex;flex-direction: column;place-items: center;width: 1000px;}
}
</style>

参考:
Dialog 对话框 Element-UI官方文档
TinyMCE中文文档

Tinymce plugins [Tinymce扩展插件集合]
在vue3.0项目中使用tinymce富文本编辑器
vue项目中使用 tinymce 富文本(本地依赖版)

Vue中使用tinymce和在NanUI下使用的注意事项笔记
This domain is not registered with TinyMCE Cloud
Vue引入tinymce 错误提示 This domain is not registered with Tiny Cloud. Please review
tinymce 富文本编辑器 关于“This domain is not registered with TinyMCE Cloud. Start a free trial to discover ”
TinyMce5富文本在Vue element UI的dialog中modal被遮挡的问题的两种解决办法
Vue 踩坑 tinycme富文本组件在dialog弹窗中的问题解决
TinyMCE在Vue element的dialog中(modal)被遮挡的问题终极解决办法
elementUI dialog 对话框层级问题
(Dialog)解决:Element-ui 中 Dialog 弹出对话框的样式的修改问题


http://www.ppmy.cn/news/19521.html

相关文章

总结:计算机中字符串比较大小的规则

总结&#xff1a;计算机中字符串比较大小的规则一背景&#xff1a;二Unicode编码表&#xff1a;字符越靠后&#xff0c;对应的十进制值越大三单个字符之间比较规则&#xff1a;1.Java编程中常用的Character类compareTo()方法比较单个字符大小&#xff1a;底层解析2案例演示&…

Day07 C++STL入门基础知识四——vector容器(上) 基本概念-构造函数-赋值操作-容量大小【全面深度剖析+例题代码展示】

Leave no stone unturned. 竭尽全力 文章目录1. 基本概念1.1 功能1.2 与普通数组相同点与不同点1.3 动态扩展2. 构造函数2.1 功能描述2.2 函数原型2.3 代码展示3. 赋值操作3.1 函数原型3.2 代码展示4. 容量及大小4.1 函数原型4.2 代码展示4.2.1 empty()4.2.1.1 代码展示4.2.1.2…

python列表用法

一、python列表用法 #codingutf-8list01[a,b,c,c,d,e,f,study,python]list01.append(hello) #追加列表元素,格式&#xff1a;列表名.append(追加元素)&#xff0c;注意不用赋值给另一个变量&#xff0c;直接增加list01.insert(2,world) #指定位置添加元素 格式&#xff1a;列…

【LeetCode】计算右侧小于当前元素的个数 [H](归并排序)

315. 计算右侧小于当前元素的个数 - 力扣&#xff08;LeetCode&#xff09; 一、题目 给你一个整数数组 nums &#xff0c;按要求返回一个新数组 counts 。数组 counts 有该性质&#xff1a; counts[i] 的值是 nums[i] 右侧小于 nums[i] 的元素的数量。 示例 1&#xff1a; …

【Kotlin】扩展函数 ③ ( 定义扩展文件 | 重命名扩展函数 | Kotlin 标准库扩展函数 )

文章目录一、定义扩展文件二、重命名扩展函数三、Kotlin 标准库扩展函数一、定义扩展文件 如果定义的 扩展函数 需要在 多个 Kotlin 代码文件 中使用 , 则需要在 单独的 Kotlin 文件 中定义 , 该文件被称为 扩展文件 ; 定义 标准库函数 的 Standard.kt 就是 独立的 扩展文件 ;…

AX7A200教程(4): DDR3的读写fifo仿真

在上篇博客中&#xff0c;我们只是进行突发读写&#xff0c;没有使用读写fifo对ddr3进行读写&#xff0c;因ddr3读写接口都是256位宽&#xff0c;所以ddr3的读写fifo输入和输出都是32位&#xff0c;和ddr3对接的接口都是256位&#xff0c;如下面示意图所示。下面的截图为ddr3的…

【计算几何】叉积

叉积 海伦公式求三角形面积 已知三角形三条边分别为a&#xff0c;b&#xff0c;c,设 pabc2p \frac{abc}{2}p2abc​, 那么三角形的面积为&#xff1a; p(p−a)(p−b)(p−c)\sqrt{p(p-a)(p-b)(p-c)}p(p−a)(p−b)(p−c)​ 缺点&#xff1a;在开根号的过程中精度损失 概念 两个…

【Hadoop】MapReduce原理剖析(Map,Shuffle,Reduce三阶段)

文章目录1. Map阶段1.1 把输入文件(夹)划分为很多InputSplit(Split)1.2 分配并执行map作业2. Shuffle阶段2.1 Partition(分区)2.2 Sort(排序)2.3 Group(分组)2.4 Combiner(规约)2.5 序列化并写入Linux磁盘内存2.6 反序列化读取数据到不同的reduce节点2.7 Reduce端数据进行合并、…