mce 0.15.9 → 0.15.10

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.
package/dist/index.js CHANGED
@@ -2365,7 +2365,7 @@ const _4_1_text = defineMixin((editor) => {
2365
2365
  return false;
2366
2366
  });
2367
2367
  }
2368
- function handleSelection([start, end], cb) {
2368
+ function handleTextSelection([start, end], cb) {
2369
2369
  let flag = true;
2370
2370
  element.value?.text?.content.forEach((p, pIndex, pItems) => {
2371
2371
  if (!flag)
@@ -2402,7 +2402,7 @@ const _4_1_text = defineMixin((editor) => {
2402
2402
  if (hasTextSelectionRange.value) {
2403
2403
  const selection = textSelection.value;
2404
2404
  if (selection && selection[0] && selection[1]) {
2405
- handleSelection(selection, ({ selected, fStyle }) => {
2405
+ handleTextSelection(selection, ({ selected, fStyle }) => {
2406
2406
  if (selected && fStyle[key]) {
2407
2407
  value = fStyle[key];
2408
2408
  return false;
@@ -2434,7 +2434,7 @@ const _4_1_text = defineMixin((editor) => {
2434
2434
  const newContent = [];
2435
2435
  let newParagraph = { fragments: [] };
2436
2436
  let newFragment;
2437
- handleSelection(textSelection.value, ({ selected, fIndex, fStyle, fLength, c, cIndex, cLength }) => {
2437
+ handleTextSelection(textSelection.value, ({ selected, fIndex, fStyle, fLength, c, cIndex, cLength }) => {
2438
2438
  if (fIndex === 0 && cIndex === 0) {
2439
2439
  newParagraph = { fragments: [] };
2440
2440
  newFragment = void 0;
@@ -2558,6 +2558,7 @@ const _4_1_text = defineMixin((editor) => {
2558
2558
  Object.assign(editor, {
2559
2559
  hasTextSelectionRange,
2560
2560
  isTextAllSelected,
2561
+ handleTextSelection,
2561
2562
  textFontSizeToFit,
2562
2563
  textToFit,
2563
2564
  setTextStyle,
@@ -5172,7 +5173,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
5172
5173
  if (node.foreground.isValid() && node.foreground.image) {
5173
5174
  value = t("image");
5174
5175
  } else if (node.text.isValid()) {
5175
- value = node.text.getStringContent();
5176
+ value = node.text.innerText;
5176
5177
  }
5177
5178
  }
5178
5179
  }
@@ -6,6 +6,7 @@ declare global {
6
6
  interface Editor {
7
7
  hasTextSelectionRange: Ref<boolean>;
8
8
  isTextAllSelected: Ref<boolean>;
9
+ handleTextSelection: (textSelection: IndexCharacter[], cb: (arg: Record<string, any>) => boolean) => void;
9
10
  textFontSizeToFit: (element: Element2D, scale?: number) => void;
10
11
  textToFit: (element: Element2D, typography?: Mce.TypographyStrategy) => void;
11
12
  getTextStyle: (key: string) => any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mce",
3
3
  "type": "module",
4
- "version": "0.15.9",
4
+ "version": "0.15.10",
5
5
  "description": "The headless canvas editor framework. only the ESM.",
6
6
  "author": "wxm",
7
7
  "license": "MIT",