@tmagic/editor 1.1.0 → 1.1.1

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.
@@ -1296,7 +1296,7 @@
1296
1296
  await this.select(root.items[0]);
1297
1297
  stage?.select(root.items[0].id);
1298
1298
  } else {
1299
- this.set("node", null);
1299
+ this.set("nodes", [root]);
1300
1300
  this.set("parent", null);
1301
1301
  this.set("page", null);
1302
1302
  this.set("stage", null);
@@ -4461,9 +4461,14 @@
4461
4461
  },
4462
4462
  emits: ["props-panel-mounted", "update:modelValue"],
4463
4463
  setup(props, { emit }) {
4464
- editorService.on("root-change", () => {
4465
- const node = editorService.get("node") || props.defaultSelected;
4466
- node && editorService.select(node);
4464
+ editorService.on("root-change", (value) => {
4465
+ const node = editorService.get("node");
4466
+ const nodeId = node?.id || props.defaultSelected;
4467
+ if (nodeId && node !== value) {
4468
+ editorService.select(nodeId);
4469
+ } else {
4470
+ editorService.set("nodes", [value]);
4471
+ }
4467
4472
  emit("update:modelValue", vue.toRaw(editorService.get("root")));
4468
4473
  });
4469
4474
  vue.watch(() => props.modelValue, (modelValue) => editorService.set("root", modelValue), {