@tmagic/editor 1.2.4 → 1.2.5

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.4",
2
+ "version": "1.2.5",
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.4",
50
- "@tmagic/design": "1.2.4",
51
- "@tmagic/form": "1.2.4",
52
- "@tmagic/schema": "1.2.4",
53
- "@tmagic/stage": "1.2.4",
54
- "@tmagic/utils": "1.2.4",
49
+ "@tmagic/core": "1.2.5",
50
+ "@tmagic/design": "1.2.5",
51
+ "@tmagic/form": "1.2.5",
52
+ "@tmagic/schema": "1.2.5",
53
+ "@tmagic/stage": "1.2.5",
54
+ "@tmagic/utils": "1.2.5",
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.4",
67
- "@tmagic/form": "1.2.4",
66
+ "@tmagic/design": "1.2.5",
67
+ "@tmagic/form": "1.2.5",
68
68
  "monaco-editor": "^0.34.0",
69
69
  "vue": "^3.2.37"
70
70
  },
@@ -87,7 +87,7 @@
87
87
  </template>
88
88
 
89
89
  <script lang="ts" setup name="MEditorCodeBlockList">
90
- import { computed, inject, onMounted, reactive, ref, watch } from 'vue';
90
+ import { computed, inject, reactive, ref, watch } from 'vue';
91
91
  import { Close, Edit, Link, View } from '@element-plus/icons-vue';
92
92
  import { cloneDeep, forIn, isEmpty } from 'lodash-es';
93
93
 
@@ -152,10 +152,13 @@ const refreshCodeList = async () => {
152
152
  });
153
153
  };
154
154
 
155
- onMounted(() => {
156
- services?.codeBlockService.refreshAllRelations();
157
- refreshCodeList();
158
- });
155
+ watch(
156
+ () => services?.editorService.get('root'),
157
+ () => {
158
+ services?.codeBlockService.refreshAllRelations();
159
+ refreshCodeList();
160
+ },
161
+ );
159
162
 
160
163
  watch(
161
164
  [() => services?.codeBlockService.getCodeDslSync(), () => services?.codeBlockService.getCombineInfo()],
@@ -19,7 +19,7 @@
19
19
  import { reactive } from 'vue';
20
20
  import { cloneDeep, forIn, isEmpty, keys, omit, pick, union } from 'lodash-es';
21
21
 
22
- import { CodeBlockContent, CodeBlockDSL, HookType, Id, MNode } from '@tmagic/schema';
22
+ import { CodeBlockContent, CodeBlockDSL, HookType, Id, MNode, MPage } from '@tmagic/schema';
23
23
 
24
24
  import editorService from '../services/editor';
25
25
  import type { CodeRelation, CodeState, HookData } from '../type';
@@ -251,6 +251,12 @@ class CodeBlock extends BaseService {
251
251
  this.state.relations = this.deleteNodeRelation(node, this.state.relations);
252
252
  });
253
253
  });
254
+ // 监听历史记录,历史快照为页面整体,需要深层遍历更新
255
+ editorService.on('history-change', (page: MPage) => {
256
+ const relations: CodeRelation = {};
257
+ this.getNodeRelation(page, relations, true);
258
+ this.state.relations = relations;
259
+ });
254
260
  }
255
261
 
256
262
  /**
@@ -886,6 +886,7 @@ class Editor extends BaseService {
886
886
  await this.select(value.nodeId);
887
887
  this.get('stage')?.select(value.nodeId);
888
888
  }, 0);
889
+ this.emit('history-change', value.data);
889
890
  }
890
891
 
891
892
  private async toggleFixedPosition(dist: MNode, src: MNode, root: MApp) {