@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.
package/dist/tmagic-editor.mjs
CHANGED
|
@@ -1278,7 +1278,7 @@ class Editor$1 extends BaseService {
|
|
|
1278
1278
|
await this.select(root.items[0]);
|
|
1279
1279
|
stage?.select(root.items[0].id);
|
|
1280
1280
|
} else {
|
|
1281
|
-
this.set("
|
|
1281
|
+
this.set("nodes", [root]);
|
|
1282
1282
|
this.set("parent", null);
|
|
1283
1283
|
this.set("page", null);
|
|
1284
1284
|
this.set("stage", null);
|
|
@@ -4443,9 +4443,14 @@ const _sfc_main = defineComponent({
|
|
|
4443
4443
|
},
|
|
4444
4444
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
4445
4445
|
setup(props, { emit }) {
|
|
4446
|
-
editorService.on("root-change", () => {
|
|
4447
|
-
const node = editorService.get("node")
|
|
4448
|
-
node
|
|
4446
|
+
editorService.on("root-change", (value) => {
|
|
4447
|
+
const node = editorService.get("node");
|
|
4448
|
+
const nodeId = node?.id || props.defaultSelected;
|
|
4449
|
+
if (nodeId && node !== value) {
|
|
4450
|
+
editorService.select(nodeId);
|
|
4451
|
+
} else {
|
|
4452
|
+
editorService.set("nodes", [value]);
|
|
4453
|
+
}
|
|
4449
4454
|
emit("update:modelValue", toRaw(editorService.get("root")));
|
|
4450
4455
|
});
|
|
4451
4456
|
watch(() => props.modelValue, (modelValue) => editorService.set("root", modelValue), {
|