mce 0.15.12 → 0.15.14

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.
@@ -12,7 +12,7 @@ declare function cancel(): void;
12
12
  declare function applySourceTransformToStyle(): void;
13
13
  type __VLS_ModelProps = {
14
14
  /**
15
- * CropRect (value are based on CropRect !!!)
15
+ * CropRect (value are based on Source !!!)
16
16
  *
17
17
  * @example
18
18
  *
package/dist/index.js CHANGED
@@ -2247,7 +2247,8 @@ const _4_1_text = defineMixin((editor) => {
2247
2247
  isElement,
2248
2248
  config,
2249
2249
  elementSelection,
2250
- textSelection
2250
+ textSelection,
2251
+ fonts
2251
2252
  } = editor;
2252
2253
  const element = computed(() => elementSelection.value[0]);
2253
2254
  const hasTextSelectionRange = computed(() => {
@@ -2279,6 +2280,7 @@ const _4_1_text = defineMixin((editor) => {
2279
2280
  return char2.content;
2280
2281
  }).join("");
2281
2282
  const { boundingBox } = measureText({
2283
+ fonts,
2282
2284
  style: {
2283
2285
  ...element3.style.toJSON(),
2284
2286
  width: "auto"
@@ -2350,6 +2352,7 @@ const _4_1_text = defineMixin((editor) => {
2350
2352
  break;
2351
2353
  }
2352
2354
  const { boundingBox } = measureText({
2355
+ fonts,
2353
2356
  style,
2354
2357
  content: element3.text.content
2355
2358
  });
@@ -10512,7 +10515,7 @@ const _rotate = definePlugin((editor) => {
10512
10515
  } = editor;
10513
10516
  function rotate(deg) {
10514
10517
  elementSelection.value.forEach((el) => {
10515
- el.style.rotate += deg;
10518
+ el.style.rotate = (el.style.rotate + deg) % 360;
10516
10519
  });
10517
10520
  }
10518
10521
  return {
@@ -15113,6 +15116,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
15113
15116
  return false;
15114
15117
  }
15115
15118
  if (!element.text.isValid()) {
15119
+ element.style.textAlign = "center";
15116
15120
  element.text.setContent(" ");
15117
15121
  }
15118
15122
  element.text.update();
@@ -15122,13 +15126,16 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
15122
15126
  await nextTick();
15123
15127
  if (editor.pointerDown(e)) {
15124
15128
  editor.selectAll();
15125
- editor._updateSelectionByDom();
15126
15129
  return true;
15127
15130
  }
15128
15131
  return false;
15129
15132
  }
15130
- onBeforeMount(() => registerCommand({ command: "startTyping", handle: startTyping }));
15131
- onBeforeUnmount(() => unregisterCommand("startTyping"));
15133
+ onBeforeMount(() => {
15134
+ registerCommand({ command: "startTyping", handle: startTyping });
15135
+ });
15136
+ onBeforeUnmount(() => {
15137
+ unregisterCommand("startTyping");
15138
+ });
15132
15139
  __expose({
15133
15140
  textEditor
15134
15141
  });
@@ -15277,7 +15284,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
15277
15284
  hovered = result;
15278
15285
  }
15279
15286
  }
15280
- if (!(isElement(hovered) && !isTopLevelFrame(hovered))) {
15287
+ if (!(isElement(hovered) && !isLock(hovered) && !isTopLevelFrame(hovered))) {
15281
15288
  hovered = void 0;
15282
15289
  cursor = void 0;
15283
15290
  }
@@ -15292,7 +15299,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
15292
15299
  allowRootFrame = false
15293
15300
  } = options;
15294
15301
  function isIncluded(node) {
15295
- return isElement(node) && (allowRootFrame || !isTopLevelFrame(node));
15302
+ return isElement(node) && !isLock(node) && (allowRootFrame || !isTopLevelFrame(node));
15296
15303
  }
15297
15304
  const drawing = state.value === "drawing";
15298
15305
  const hand = state.value === "hand";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.15.12",
4
+ "version": "0.15.14",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -61,11 +61,11 @@
61
61
  "diff": "^8.0.2",
62
62
  "file-saver": "^2.0.5",
63
63
  "lodash-es": "^4.17.22",
64
- "modern-canvas": "^0.14.26",
64
+ "modern-canvas": "^0.14.29",
65
65
  "modern-font": "^0.4.4",
66
66
  "modern-idoc": "^0.10.8",
67
- "modern-text": "^1.10.7",
68
- "yjs": "^13.6.28"
67
+ "modern-text": "^1.10.13",
68
+ "yjs": "^13.6.29"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "lottie-web": "^5",