dragon-editor 3.7.1 → 3.7.2

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/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=3.0.0"
5
5
  },
6
6
  "configKey": "dragon-editor",
7
- "version": "3.7.1",
7
+ "version": "3.7.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -0,0 +1,32 @@
1
+ import type { DEBlockData, DEContentData, DEDecoration, DETextalign } from "../type.d.mts.js";
2
+ interface DEOption {
3
+ modelValue: DEContentData;
4
+ useMenuBar?: boolean;
5
+ imageHostURL?: string;
6
+ screenChangePoint?: number;
7
+ }
8
+ declare function addBlock(data: DEBlockData): void;
9
+ declare function setDecoration(style: DEDecoration): void;
10
+ declare function setAlign(align: DETextalign): void;
11
+ declare function changeEditorData(data: DEContentData): void;
12
+ declare function updateLayout(): void;
13
+ declare const __VLS_export: import("vue").DefineComponent<DEOption, {
14
+ addBlock: typeof addBlock;
15
+ setDecoration: typeof setDecoration;
16
+ setAlign: typeof setAlign;
17
+ changeEditorData: typeof changeEditorData;
18
+ updateLayout: typeof updateLayout;
19
+ checkDataEmpty: () => boolean;
20
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
21
+ "update:modelValue": (data: DEContentData) => any;
22
+ uploadImageEvent: (file: File) => any;
23
+ }, string, import("vue").PublicProps, Readonly<DEOption> & Readonly<{
24
+ "onUpdate:modelValue"?: ((data: DEContentData) => any) | undefined;
25
+ onUploadImageEvent?: ((file: File) => any) | undefined;
26
+ }>, {
27
+ imageHostURL: string;
28
+ useMenuBar: boolean;
29
+ screenChangePoint: number;
30
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
@@ -10,7 +10,7 @@ declare function setDecoration(style: DEDecoration): void;
10
10
  declare function setAlign(align: DETextalign): void;
11
11
  declare function changeEditorData(data: DEContentData): void;
12
12
  declare function updateLayout(): void;
13
- declare const _default: import("vue").DefineComponent<DEOption, {
13
+ declare const __VLS_export: import("vue").DefineComponent<DEOption, {
14
14
  addBlock: typeof addBlock;
15
15
  setDecoration: typeof setDecoration;
16
16
  setAlign: typeof setAlign;
@@ -28,4 +28,5 @@ declare const _default: import("vue").DefineComponent<DEOption, {
28
28
  useMenuBar: boolean;
29
29
  screenChangePoint: number;
30
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
+ declare const _default: typeof __VLS_export;
31
32
  export default _default;
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ content: DEContentData;
3
+ imageHostURL?: string;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ imageHostURL: string;
7
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -2,7 +2,8 @@ type __VLS_Props = {
2
2
  content: DEContentData;
3
3
  imageHostURL?: string;
4
4
  };
5
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
6
  imageHostURL: string;
7
7
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: typeof __VLS_export;
8
9
  export default _default;
@@ -749,15 +749,27 @@ function ___defaultBlockBackspaceEvent(event, store) {
749
749
  $target = $target.parentNode;
750
750
  }
751
751
  if (elementIdx === 0) {
752
- if (cursorData.startOffset === 0 && $target === $block) {
753
- if ($target.textContent === "") {
754
- $block.insertAdjacentElement("afterend", _createTextBlock(_getDefaultBlockData("text")));
755
- _setCursor($block.nextElementSibling, 0);
756
- $block.remove();
757
- } else {
758
- event.preventDefault();
759
- if (store.value.controlStatus.currentBlockType !== "text") {
760
- const $newBlock = _createTextBlock({ type: "text", classList: [], textContent: $block.textContent ?? "" });
752
+ if (cursorData.type === "Caret") {
753
+ if (cursorData.startOffset === 0 && $target === $block) {
754
+ if ($target.textContent === "") {
755
+ $block.insertAdjacentElement("afterend", _createTextBlock(_getDefaultBlockData("text")));
756
+ _setCursor($block.nextElementSibling, 0);
757
+ $block.remove();
758
+ } else {
759
+ event.preventDefault();
760
+ if (store.value.controlStatus.currentBlockType !== "text") {
761
+ const $newBlock = _createTextBlock({ type: "text", classList: [], textContent: $block.textContent ?? "" });
762
+ $block.insertAdjacentElement("afterend", $newBlock);
763
+ _setCursor($newBlock, 0);
764
+ $block.remove();
765
+ }
766
+ }
767
+ }
768
+ } else {
769
+ if ($block.textContent !== "") {
770
+ if ((cursorData.startOffset === 0 || cursorData.endOffset === 0) && ($block.childNodes[0] === cursorData.startNode || $block.childNodes[0] === $target || $block.childNodes[0] === cursorData.endNode)) {
771
+ event.preventDefault();
772
+ const $newBlock = _createTextBlock({ type: "text", classList: [], textContent: "" });
761
773
  $block.insertAdjacentElement("afterend", $newBlock);
762
774
  _setCursor($newBlock, 0);
763
775
  $block.remove();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dragon-editor",
3
- "version": "3.7.1",
3
+ "version": "3.7.2",
4
4
  "description": "Javascript WYSIWYG editor in Nuxt!",
5
5
  "repository": {
6
6
  "type": "git",