@tmagic/editor 1.2.0-beta.22 → 1.2.0-beta.23
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.js
CHANGED
|
@@ -1689,13 +1689,14 @@ class Editor$1 extends BaseService {
|
|
|
1689
1689
|
);
|
|
1690
1690
|
}
|
|
1691
1691
|
set(name, value) {
|
|
1692
|
+
const preValue = this.state[name];
|
|
1692
1693
|
this.state[name] = value;
|
|
1693
1694
|
if (name === "nodes") {
|
|
1694
1695
|
this.set("node", value[0]);
|
|
1695
1696
|
}
|
|
1696
1697
|
if (name === "root") {
|
|
1697
1698
|
this.state.pageLength = value?.items?.length || 0;
|
|
1698
|
-
this.emit("root-change", value);
|
|
1699
|
+
this.emit("root-change", value, preValue);
|
|
1699
1700
|
}
|
|
1700
1701
|
}
|
|
1701
1702
|
get(name) {
|
|
@@ -5880,7 +5881,7 @@ const _sfc_main = defineComponent({
|
|
|
5880
5881
|
},
|
|
5881
5882
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
5882
5883
|
setup(props, { emit }) {
|
|
5883
|
-
editorService.on("root-change", (value) => {
|
|
5884
|
+
editorService.on("root-change", (value, preValue) => {
|
|
5884
5885
|
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
5885
5886
|
let node;
|
|
5886
5887
|
if (nodeId) {
|
|
@@ -5895,7 +5896,7 @@ const _sfc_main = defineComponent({
|
|
|
5895
5896
|
editorService.set("parent", null);
|
|
5896
5897
|
editorService.set("page", null);
|
|
5897
5898
|
}
|
|
5898
|
-
if (toRaw(value) !== toRaw(
|
|
5899
|
+
if (toRaw(value) !== toRaw(preValue)) {
|
|
5899
5900
|
emit("update:modelValue", value);
|
|
5900
5901
|
}
|
|
5901
5902
|
});
|