mce 0.12.4 → 0.12.5

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -615,7 +615,7 @@ class Doc extends Model {
615
615
  const first = nodeMap[0];
616
616
  let parent;
617
617
  let childrenIds;
618
- if (parentId) {
618
+ if (parentId && parentId !== this.root.id) {
619
619
  parent = this.nodeMap.get(parentId);
620
620
  childrenIds = this._yChildren.get(parentId)?.get("childrenIds");
621
621
  } else {
@@ -688,7 +688,7 @@ class Doc extends Model {
688
688
  const fromIndex = childrenIds.toJSON().indexOf(id);
689
689
  childrenIds.delete(fromIndex, 1);
690
690
  childrenIds.insert(toIndex, [id]);
691
- if (parent) {
691
+ if (parent && !parent.equal(this.root)) {
692
692
  parent.moveChild(node, toIndex);
693
693
  } else {
694
694
  this.root.moveChild(node, toIndex);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.12.4",
4
+ "version": "0.12.5",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",