@tmagic/editor 1.6.0-beta.3 → 1.6.0-beta.4

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.
@@ -1249,7 +1249,9 @@ class BaseService extends EventEmitter {
1249
1249
  }
1250
1250
  usePlugin(options) {
1251
1251
  for (const [methodName2, method] of Object.entries(options)) {
1252
- if (typeof method === "function") this.pluginOptionsList[methodName2].push(method);
1252
+ if (typeof method === "function" && !this.pluginOptionsList[methodName2].includes(method)) {
1253
+ this.pluginOptionsList[methodName2].push(method);
1254
+ }
1253
1255
  }
1254
1256
  }
1255
1257
  removePlugin(options) {
@@ -16057,6 +16059,12 @@ const initServiceEvents = (props, emit, { editorService, codeBlockService, dataS
16057
16059
  stage.reloadIframe(url);
16058
16060
  stage.renderer?.once("runtime-ready", (runtime) => {
16059
16061
  runtime.updateRootConfig?.(cloneDeep(toRaw(editorService.get("root"))));
16062
+ const page = editorService.get("page");
16063
+ const node = editorService.get("node");
16064
+ page?.id && runtime?.updatePageId?.(page.id);
16065
+ setTimeout(() => {
16066
+ node && stage?.select(toRaw(node.id));
16067
+ });
16060
16068
  });
16061
16069
  }
16062
16070
  );
@@ -6042,7 +6042,9 @@
6042
6042
  }
6043
6043
  usePlugin(options) {
6044
6044
  for (const [methodName2, method] of Object.entries(options)) {
6045
- if (typeof method === "function") this.pluginOptionsList[methodName2].push(method);
6045
+ if (typeof method === "function" && !this.pluginOptionsList[methodName2].includes(method)) {
6046
+ this.pluginOptionsList[methodName2].push(method);
6047
+ }
6046
6048
  }
6047
6049
  }
6048
6050
  removePlugin(options) {
@@ -20850,6 +20852,12 @@
20850
20852
  stage.reloadIframe(url);
20851
20853
  stage.renderer?.once("runtime-ready", (runtime) => {
20852
20854
  runtime.updateRootConfig?.(cloneDeep(vue.toRaw(editorService.get("root"))));
20855
+ const page = editorService.get("page");
20856
+ const node = editorService.get("node");
20857
+ page?.id && runtime?.updatePageId?.(page.id);
20858
+ setTimeout(() => {
20859
+ node && stage?.select(vue.toRaw(node.id));
20860
+ });
20853
20861
  });
20854
20862
  }
20855
20863
  );
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.6.0-beta.3",
2
+ "version": "1.6.0-beta.4",
3
3
  "name": "@tmagic/editor",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -58,11 +58,11 @@
58
58
  "moveable": "^0.53.0",
59
59
  "serialize-javascript": "^6.0.2",
60
60
  "sortablejs": "^1.15.6",
61
- "@tmagic/design": "1.6.0-beta.3",
62
- "@tmagic/form": "1.6.0-beta.3",
63
- "@tmagic/stage": "1.6.0-beta.3",
64
- "@tmagic/table": "1.6.0-beta.3",
65
- "@tmagic/utils": "1.6.0-beta.3"
61
+ "@tmagic/design": "1.6.0-beta.4",
62
+ "@tmagic/stage": "1.6.0-beta.4",
63
+ "@tmagic/table": "1.6.0-beta.4",
64
+ "@tmagic/form": "1.6.0-beta.4",
65
+ "@tmagic/utils": "1.6.0-beta.4"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/events": "^3.0.3",
@@ -76,7 +76,7 @@
76
76
  "monaco-editor": "^0.48.0",
77
77
  "typescript": "^5.8.3",
78
78
  "vue": "^3.5.17",
79
- "@tmagic/core": "1.6.0-beta.3"
79
+ "@tmagic/core": "1.6.0-beta.4"
80
80
  },
81
81
  "peerDependenciesMeta": {
82
82
  "typescript": {
@@ -363,6 +363,12 @@ export const initServiceEvents = (
363
363
 
364
364
  stage.renderer?.once('runtime-ready', (runtime) => {
365
365
  runtime.updateRootConfig?.(cloneDeep(toRaw(editorService.get('root')))!);
366
+ const page = editorService.get('page');
367
+ const node = editorService.get('node');
368
+ page?.id && runtime?.updatePageId?.(page.id);
369
+ setTimeout(() => {
370
+ node && stage?.select(toRaw(node.id));
371
+ });
366
372
  });
367
373
  },
368
374
  );
@@ -206,7 +206,9 @@ export default class extends EventEmitter {
206
206
 
207
207
  public usePlugin(options: Record<string, Function>) {
208
208
  for (const [methodName, method] of Object.entries(options)) {
209
- if (typeof method === 'function') this.pluginOptionsList[methodName].push(method);
209
+ if (typeof method === 'function' && !this.pluginOptionsList[methodName].includes(method)) {
210
+ this.pluginOptionsList[methodName].push(method);
211
+ }
210
212
  }
211
213
  }
212
214