{{ title }}
@@ -21,7 +21,7 @@ import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue';
import { Close } from '@element-plus/icons-vue';
import VanillaMoveable from 'moveable';
-import { TMagicButton } from '@tmagic/design';
+import { TMagicButton, useZIndex } from '@tmagic/design';
interface Position {
left: number;
@@ -47,11 +47,15 @@ const emit = defineEmits<{
const target = ref();
const dragTarget = ref();
+const zIndex = useZIndex();
+const curZIndex = ref(zIndex.nextZIndex());
+
const style = computed(() => ({
left: `${props.position.left}px`,
top: `${props.position.top}px`,
width: typeof props.rect.width === 'string' ? props.rect.width : `${props.rect.width}px`,
height: typeof props.rect.height === 'string' ? props.rect.height : `${props.rect.height}px`,
+ zIndex: curZIndex.value,
}));
let moveable: VanillaMoveable | null = null;
@@ -70,6 +74,7 @@ const initMoveable = () => {
dragTargetSelf: false,
linePadding: 10,
controlPadding: 10,
+ bounds: { left: 0, top: 0, right: 0, bottom: 0, position: 'css' },
});
moveable.on('drag', (e) => {
@@ -111,6 +116,10 @@ const closeHandler = () => {
emit('update:visible', false);
};
+const nextZIndex = () => {
+ curZIndex.value = zIndex.nextZIndex();
+};
+
defineExpose({
target,
});
diff --git a/packages/editor/src/hooks/use-code-block-edit.ts b/packages/editor/src/hooks/use-code-block-edit.ts
index a3d0feeb..4ea6b32d 100644
--- a/packages/editor/src/hooks/use-code-block-edit.ts
+++ b/packages/editor/src/hooks/use-code-block-edit.ts
@@ -54,7 +54,6 @@ export const useCodeBlockEdit = (codeBlockService?: CodeBlockService) => {
codeId.value = id;
await nextTick();
-
codeBlockEditor.value?.show();
};
diff --git a/packages/editor/src/layouts/NavMenu.vue b/packages/editor/src/layouts/NavMenu.vue
index 62a7ab3e..748ce59b 100644
--- a/packages/editor/src/layouts/NavMenu.vue
+++ b/packages/editor/src/layouts/NavMenu.vue
@@ -1,5 +1,5 @@
-