@tmagic/editor 1.2.6 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.6",
2
+ "version": "1.2.8",
3
3
  "name": "@tmagic/editor",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -46,12 +46,12 @@
46
46
  "dependencies": {
47
47
  "@babel/core": "^7.18.0",
48
48
  "@element-plus/icons-vue": "^2.0.9",
49
- "@tmagic/core": "1.2.6",
50
- "@tmagic/design": "1.2.6",
51
- "@tmagic/form": "1.2.6",
52
- "@tmagic/schema": "1.2.6",
53
- "@tmagic/stage": "1.2.6",
54
- "@tmagic/utils": "1.2.6",
49
+ "@tmagic/core": "1.2.8",
50
+ "@tmagic/design": "1.2.8",
51
+ "@tmagic/form": "1.2.8",
52
+ "@tmagic/schema": "1.2.8",
53
+ "@tmagic/stage": "1.2.8",
54
+ "@tmagic/utils": "1.2.8",
55
55
  "buffer": "^6.0.3",
56
56
  "color": "^3.1.3",
57
57
  "events": "^3.3.0",
@@ -63,8 +63,8 @@
63
63
  "vue": "^3.2.37"
64
64
  },
65
65
  "peerDependencies": {
66
- "@tmagic/design": "1.2.6",
67
- "@tmagic/form": "1.2.6",
66
+ "@tmagic/design": "1.2.8",
67
+ "@tmagic/form": "1.2.8",
68
68
  "monaco-editor": "^0.34.0",
69
69
  "vue": "^3.2.37"
70
70
  },
@@ -221,10 +221,15 @@ watch(nodes, (nodes) => {
221
221
  ) {
222
222
  tree.value?.setCheckedKeys([], false);
223
223
 
224
- [currentNodeKey.value] = ids;
225
224
  checkedKeys.value = ids.filter((id) => id !== page.value?.id);
226
225
  expandedKeys.value = union(expandedKeys.value, ids);
227
226
  }
227
+
228
+ [currentNodeKey.value] = ids;
229
+
230
+ setTimeout(() => {
231
+ tree.value?.setCurrentKey(currentNodeKey.value);
232
+ });
228
233
  });
229
234
 
230
235
  watch(isMultiSelect, (isMultiSelect) => {
@@ -287,6 +292,9 @@ const toggleClickFlag = () => {
287
292
 
288
293
  // 选择节点多选框
289
294
  const checkHandler = (data: MNode, { checkedNodes }: any): void => {
295
+ if (!isCtrlKeyDown.value && nodes.value.length < 2) {
296
+ return;
297
+ }
290
298
  if (checkedNodes.length > 0) {
291
299
  multiSelect(checkedNodes.map((node: MNode) => node.id));
292
300
  } else {
@@ -158,6 +158,9 @@ watch(
158
158
  services?.codeBlockService.refreshAllRelations();
159
159
  refreshCodeList();
160
160
  },
161
+ {
162
+ immediate: true,
163
+ },
161
164
  );
162
165
 
163
166
  watch(
@@ -230,7 +230,7 @@ class Editor extends BaseService {
230
230
  if (node?.id) {
231
231
  this.get('stage')
232
232
  ?.renderer.runtime?.getApp?.()
233
- ?.emit(
233
+ .page?.emit(
234
234
  'editor:select',
235
235
  {
236
236
  node,
@@ -53,8 +53,7 @@
53
53
  padding: 5px;
54
54
  }
55
55
 
56
- .is-text,
57
- i {
56
+ .is-text > i {
58
57
  color: $--font-color;
59
58
  }
60
59
 
@@ -1,6 +1,6 @@
1
1
  import { computed } from 'vue';
2
2
 
3
- import StageCore, { GuidesType, SortEventData, UpdateEventData } from '@tmagic/stage';
3
+ import StageCore, { GuidesType, RemoveEventData, SortEventData, UpdateEventData } from '@tmagic/stage';
4
4
 
5
5
  import editorService from '../services/editor';
6
6
  import uiService from '../services/ui';
@@ -73,6 +73,14 @@ export const useStage = (stageOptions: StageOptions) => {
73
73
  editorService.sort(ev.src, ev.dist);
74
74
  });
75
75
 
76
+ stage.on('remove', (ev: RemoveEventData) => {
77
+ editorService.remove(
78
+ ev.data.map(({ el }) => ({
79
+ id: el.id,
80
+ })),
81
+ );
82
+ });
83
+
76
84
  stage.on('select-parent', () => {
77
85
  const parent = editorService.get('parent');
78
86
  if (!parent) throw new Error('父节点为空');