@tmagic/editor 1.2.0-beta.21 → 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.
@@ -1706,13 +1706,14 @@
1706
1706
  );
1707
1707
  }
1708
1708
  set(name, value) {
1709
+ const preValue = this.state[name];
1709
1710
  this.state[name] = value;
1710
1711
  if (name === "nodes") {
1711
1712
  this.set("node", value[0]);
1712
1713
  }
1713
1714
  if (name === "root") {
1714
1715
  this.state.pageLength = value?.items?.length || 0;
1715
- this.emit("root-change", value);
1716
+ this.emit("root-change", value, preValue);
1716
1717
  }
1717
1718
  }
1718
1719
  get(name) {
@@ -5897,7 +5898,7 @@
5897
5898
  },
5898
5899
  emits: ["props-panel-mounted", "update:modelValue"],
5899
5900
  setup(props, { emit }) {
5900
- editorService.on("root-change", (value) => {
5901
+ editorService.on("root-change", (value, preValue) => {
5901
5902
  const nodeId = editorService.get("node")?.id || props.defaultSelected;
5902
5903
  let node;
5903
5904
  if (nodeId) {
@@ -5912,7 +5913,7 @@
5912
5913
  editorService.set("parent", null);
5913
5914
  editorService.set("page", null);
5914
5915
  }
5915
- if (vue.toRaw(value) !== vue.toRaw(editorService.get("root"))) {
5916
+ if (vue.toRaw(value) !== vue.toRaw(preValue)) {
5916
5917
  emit("update:modelValue", value);
5917
5918
  }
5918
5919
  });