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

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);
@@ -3731,10 +3734,11 @@
3731
3734
  event.preventDefault();
3732
3735
  event.stopImmediatePropagation();
3733
3736
  event.stopPropagation();
3734
- } else if (this.keydown)
3737
+ }
3738
+ if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
3735
3739
  return;
3740
+ }
3736
3741
  this.keydown = true;
3737
- event.preventDefault();
3738
3742
  this.target.style.cursor = "grab";
3739
3743
  this.container.addEventListener("mousedown", this.mousedownHandler);
3740
3744
  };