mce 0.12.3 → 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 +8 -6
  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);
@@ -2310,6 +2310,8 @@ const _4_2_element = defineMixin((editor) => {
2310
2310
  break;
2311
2311
  case "screenCenter":
2312
2312
  globalPosition = camera.value.toGlobal(getScreenCenter());
2313
+ globalPosition.x -= aabb.width / 2;
2314
+ globalPosition.y -= aabb.height / 2;
2313
2315
  break;
2314
2316
  default: {
2315
2317
  const _parentAabb = parentAabb ?? rootAabb.value;
@@ -2608,11 +2610,11 @@ const _4_4_doc = defineMixin((editor, options) => {
2608
2610
  if (Array.isArray(source) && source.length === 1) {
2609
2611
  _source = source[0];
2610
2612
  }
2611
- if (!Array.isArray(source)) {
2612
- if (source.meta?.inEditorIs === "Doc") {
2613
- id = source.id;
2613
+ if (!Array.isArray(_source)) {
2614
+ if (_source.meta?.inEditorIs === "Doc") {
2615
+ id = _source.id;
2614
2616
  } else {
2615
- _source = [source];
2617
+ _source = [_source];
2616
2618
  }
2617
2619
  }
2618
2620
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.12.3",
4
+ "version": "0.12.5",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",