@tmagic/editor 1.0.0-beta.5 → 1.0.0-beta.8

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.
@@ -862,6 +862,9 @@
862
862
  const { node, parent, page } = this.getNodeInfo(id);
863
863
  if (!node)
864
864
  throw new Error("\u83B7\u53D6\u4E0D\u5230\u7EC4\u4EF6\u4FE1\u606F");
865
+ if (node.id === this.state.root?.id) {
866
+ throw new Error("\u4E0D\u80FD\u9009\u6839\u8282\u70B9");
867
+ }
865
868
  this.set("node", node);
866
869
  this.set("page", page || null);
867
870
  this.set("parent", parent || null);
@@ -929,7 +932,7 @@
929
932
  throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config2.id}\u7684\u8282\u70B9`);
930
933
  const node = lodashEs.cloneDeep(vue.toRaw(info.node));
931
934
  let newConfig = await this.toggleFixedPosition(vue.toRaw(config2), node, this.get("root"));
932
- newConfig = lodashEs.mergeWith(node, newConfig, (objValue, srcValue) => {
935
+ newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
933
936
  if (Array.isArray(srcValue)) {
934
937
  return srcValue;
935
938
  }
@@ -974,6 +977,7 @@
974
977
  parent.items.splice(index2, 0, ...parent.items.splice(index1, 1));
975
978
  await this.update(parent);
976
979
  await this.select(node);
980
+ this.get("stage")?.update({ config: lodashEs.cloneDeep(node), root: this.get("root") });
977
981
  this.addModifiedNodeId(parent.id);
978
982
  this.pushHistoryState();
979
983
  }
@@ -3017,6 +3021,7 @@
3017
3021
  const _component_m_form = vue.resolveComponent("m-form");
3018
3022
  return vue.openBlock(), vue.createBlock(_component_m_form, {
3019
3023
  class: "m-editor-props-panel",
3024
+ "popper-class": "m-editor-props-panel-popper",
3020
3025
  ref: "configForm",
3021
3026
  size: "small",
3022
3027
  "init-values": _ctx.values,
@@ -3731,10 +3736,11 @@
3731
3736
  event.preventDefault();
3732
3737
  event.stopImmediatePropagation();
3733
3738
  event.stopPropagation();
3734
- } else if (this.keydown)
3739
+ }
3740
+ if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
3735
3741
  return;
3742
+ }
3736
3743
  this.keydown = true;
3737
- event.preventDefault();
3738
3744
  this.target.style.cursor = "grab";
3739
3745
  this.container.addEventListener("mousedown", this.mousedownHandler);
3740
3746
  };