更换编辑器

This commit is contained in:
2026-07-14 15:49:00 +08:00
parent 238f210d52
commit 4aa9204df7
26 changed files with 4341 additions and 2623 deletions
+15 -28
View File
@@ -50,20 +50,17 @@ onMounted(() => {
tabsWrapper.addEventListener('contextmenu', (e) => {
// 排除编辑器相关区域,避免影响编辑器功能
// 如果点击在编辑器区域内,完全不做任何处理(优先检查)
const editorWrapper = e.target.closest?.('.wang-editor-wrapper');
const editorWrapper = e.target.closest?.('.tiptap-editor-wrapper');
if (editorWrapper) {
// 在编辑器区域内,不处理右键菜单,也不阻止事件
return;
}
// 检查其他编辑器元素(工具栏、下拉面板等)
const editorElements = [
'.w-e-toolbar',
'.w-e-drop-panel',
'.w-e-modal',
'.w-e-toolbar-menu',
'[data-menu-key]',
'[class*="w-e-"]'
'.tiptap-toolbar',
'.tiptap',
'[class*="tiptap-"]'
];
for (const selector of editorElements) {
@@ -288,25 +285,18 @@ const showContextMenu = (event, tab) => {
// 如果在编辑器区域内,立即返回,不执行任何操作,让编辑器的事件正常处理
// 先检查是否在编辑器包装器内(最快判断)
const wangEditorWrapper = target.closest?.('.wang-editor-wrapper');
if (wangEditorWrapper) {
const tiptapEditorWrapper = target.closest?.('.tiptap-editor-wrapper');
if (tiptapEditorWrapper) {
// 在编辑器包装器内,完全不做任何处理,让编辑器正常处理
return;
}
// 检查所有可能的编辑器元素(包括工具栏、下拉面板、模态框等)
const editorSelectors = [
'.w-e-toolbar',
'.w-e-drop-panel',
'.w-e-modal',
'.w-e-toolbar-menu',
'.toolbar-container',
'.tiptap-toolbar',
'.tiptap',
'.editor-container',
'.w-e-text-container',
'.w-e-text',
// 检查是否有 WangEditor 相关的元素
'[data-menu-key]',
'[class*="w-e-"]'
'[class*="tiptap-"]'
];
for (const selector of editorSelectors) {
@@ -339,7 +329,7 @@ const showContextMenu = (event, tab) => {
}
// 排除编辑器区域和右键菜单本身
if (target.closest?.('.w-e-toolbar') || target.closest?.('.context-menu') || target.closest?.('.wang-editor-wrapper')) {
if (target.closest?.('.tiptap-toolbar') || target.closest?.('.context-menu') || target.closest?.('.tiptap-editor-wrapper')) {
return;
}
hideContextMenu();
@@ -734,12 +724,9 @@ const canCloseRight = computed(() => {
}
}
// 确保编辑器工具栏和下拉面板的 z-index 高于右键菜单
:deep(.w-e-toolbar),
:deep(.w-e-drop-panel),
:deep(.w-e-modal),
:deep(.w-e-toolbar-menu) {
z-index: 10000 !important; // 高于右键菜单的 9999
// 确保编辑器工具栏的 z-index 高于右键菜单
:deep(.tiptap-toolbar) {
z-index: 10000 !important;
pointer-events: auto !important;
}
</style>