diff --git a/docs/api/editor/props.md b/docs/api/editor/props.md
index 8fc734d7..eb625989 100644
--- a/docs/api/editor/props.md
+++ b/docs/api/editor/props.md
@@ -923,4 +923,22 @@ const updateDragEl = (el, target) => {
```
+
+## disabledMultiSelect
+
+- **详情:**
+
+禁止多选
+
+- **类型:** `boolean`
+
+- **默认值:** `false`
+
+- **示例:**
+
+```html
+
+
+
+```
\ No newline at end of file
diff --git a/packages/editor/src/Editor.vue b/packages/editor/src/Editor.vue
index 828ff5b4..8115f1c4 100644
--- a/packages/editor/src/Editor.vue
+++ b/packages/editor/src/Editor.vue
@@ -177,6 +177,7 @@ provide(
disabledDragStart: props.disabledDragStart,
renderType: props.renderType,
guidesOptions: props.guidesOptions,
+ disabledMultiSelect: props.disabledMultiSelect,
}),
);
diff --git a/packages/editor/src/components/TreeNode.vue b/packages/editor/src/components/TreeNode.vue
index 95e50152..2b7843a2 100644
--- a/packages/editor/src/components/TreeNode.vue
+++ b/packages/editor/src/components/TreeNode.vue
@@ -18,7 +18,7 @@
>
@@ -35,7 +35,7 @@
-
+
nodeStatus.value.selected);
const visible = computed(() => nodeStatus.value.visible);
const draggable = computed(() => nodeStatus.value.draggable);
-const hasChilren = computed(() => props.data.items?.some((item) => props.nodeStatusMap.get(item.id)?.visible));
+const hasChildren = computed(() => props.data.items?.some((item) => props.nodeStatusMap.get(item.id)?.visible));
const handleDragStart = (event: DragEvent) => {
treeEmit?.('node-dragstart', event, props.data);
diff --git a/packages/editor/src/editorProps.ts b/packages/editor/src/editorProps.ts
index ecbda680..41dd6832 100644
--- a/packages/editor/src/editorProps.ts
+++ b/packages/editor/src/editorProps.ts
@@ -73,6 +73,7 @@ export interface EditorProps {
/** 自定义依赖收集器,复制组件时会将关联依赖一并复制 */
collectorOptions?: CustomTargetOptions;
guidesOptions?: Partial;
+ disabledMultiSelect?: boolean;
}
export const defaultEditorProps = {
@@ -93,4 +94,5 @@ export const defaultEditorProps = {
containerHighlightType: ContainerHighlightType.DEFAULT,
codeOptions: () => ({}),
renderType: RenderType.IFRAME,
+ disabledMultiSelect: false,
};
diff --git a/packages/editor/src/hooks/use-stage.ts b/packages/editor/src/hooks/use-stage.ts
index bed9f94e..f0cf7ab8 100644
--- a/packages/editor/src/hooks/use-stage.ts
+++ b/packages/editor/src/hooks/use-stage.ts
@@ -1,4 +1,4 @@
-import { computed } from 'vue';
+import { computed, watch } from 'vue';
import type { MNode } from '@tmagic/schema';
import StageCore, { GuidesType, RemoveEventData, SortEventData, UpdateEventData } from '@tmagic/stage';
@@ -45,8 +45,20 @@ export const useStage = (stageOptions: StageOptions) => {
moveableOptions: stageOptions.moveableOptions,
updateDragEl: stageOptions.updateDragEl,
guidesOptions: stageOptions.guidesOptions,
+ disabledMultiSelect: stageOptions.disabledMultiSelect,
});
+ watch(
+ () => editorService.get('disabledMultiSelect'),
+ (disabledMultiSelect) => {
+ if (disabledMultiSelect) {
+ stage.disableMultiSelect();
+ } else {
+ stage.enableMultiSelect();
+ }
+ },
+ );
+
stage.mask.setGuides([
getGuideLineFromCache(getGuideLineKey(H_GUIDE_LINE_STORAGE_KEY)),
getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY)),
diff --git a/packages/editor/src/initService.ts b/packages/editor/src/initService.ts
index ba7fe69e..4463649a 100644
--- a/packages/editor/src/initService.ts
+++ b/packages/editor/src/initService.ts
@@ -47,6 +47,16 @@ export const initServiceState = (
},
);
+ watch(
+ () => props.disabledMultiSelect,
+ (disabledMultiSelect) => {
+ editorService.set('disabledMultiSelect', disabledMultiSelect || false);
+ },
+ {
+ immediate: true,
+ },
+ );
+
watch(
() => props.componentGroupList,
(componentGroupList) => componentGroupList && componentListService.setList(componentGroupList),
diff --git a/packages/editor/src/layouts/sidebar/layer/use-click.ts b/packages/editor/src/layouts/sidebar/layer/use-click.ts
index b0d028cd..8315f64d 100644
--- a/packages/editor/src/layouts/sidebar/layer/use-click.ts
+++ b/packages/editor/src/layouts/sidebar/layer/use-click.ts
@@ -1,4 +1,4 @@
-import { type ComputedRef, nextTick, type Ref, ref } from 'vue';
+import { computed, type ComputedRef, nextTick, type Ref, ref } from 'vue';
import { throttle } from 'lodash-es';
import { Id, MNode } from '@tmagic/schema';
@@ -13,13 +13,15 @@ export const useClick = (
isCtrlKeyDown: Ref,
nodeStatusMap: ComputedRef