dragon-editor 3.8.7 → 4.0.0
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/README.md +10 -9
- package/dist/module.json +1 -1
- package/dist/module.mjs +9 -7
- package/dist/runtime/components/Block/Code.d.vue.ts +13 -0
- package/dist/runtime/components/Block/Code.vue +193 -0
- package/dist/runtime/components/Block/Code.vue.d.ts +13 -0
- package/dist/runtime/components/Block/Custom.d.vue.ts +9 -0
- package/dist/runtime/components/Block/Custom.vue +28 -0
- package/dist/runtime/components/Block/Custom.vue.d.ts +9 -0
- package/dist/runtime/components/Block/Divider.d.vue.ts +9 -0
- package/dist/runtime/components/Block/Divider.vue +27 -0
- package/dist/runtime/components/Block/Divider.vue.d.ts +9 -0
- package/dist/runtime/components/Block/Heading.d.vue.ts +13 -0
- package/dist/runtime/components/Block/Heading.vue +84 -0
- package/dist/runtime/components/Block/Heading.vue.d.ts +13 -0
- package/dist/runtime/components/Block/Image.d.vue.ts +13 -0
- package/dist/runtime/components/Block/Image.vue +146 -0
- package/dist/runtime/components/Block/Image.vue.d.ts +13 -0
- package/dist/runtime/components/Block/List.d.vue.ts +13 -0
- package/dist/runtime/components/Block/List.vue +170 -0
- package/dist/runtime/components/Block/List.vue.d.ts +13 -0
- package/dist/runtime/components/Block/Text.d.vue.ts +13 -0
- package/dist/runtime/components/Block/Text.vue +84 -0
- package/dist/runtime/components/Block/Text.vue.d.ts +13 -0
- package/dist/runtime/components/DragonEditor.d.vue.ts +28 -22
- package/dist/runtime/components/DragonEditor.vue +75 -1225
- package/dist/runtime/components/DragonEditor.vue.d.ts +28 -22
- package/dist/runtime/components/DragonEditorViewer.d.vue.ts +13 -5
- package/dist/runtime/components/DragonEditorViewer.vue +17 -813
- package/dist/runtime/components/DragonEditorViewer.vue.d.ts +13 -5
- package/dist/runtime/components/MenuBar.d.vue.ts +3 -0
- package/dist/runtime/components/MenuBar.vue +385 -0
- package/dist/runtime/components/MenuBar.vue.d.ts +3 -0
- package/dist/runtime/scss/editor.css +237 -283
- package/dist/runtime/scss/viewer.css +184 -210
- package/dist/runtime/store/editor.d.ts +2 -0
- package/dist/runtime/store/editor.js +59 -0
- package/dist/runtime/type.d.mts +101 -124
- package/dist/runtime/utils/data/block.d.ts +20 -0
- package/dist/runtime/utils/data/block.js +663 -0
- package/dist/runtime/utils/data/cursor.d.ts +9 -0
- package/dist/runtime/utils/data/cursor.js +137 -0
- package/dist/runtime/utils/data/index.d.ts +5 -0
- package/dist/runtime/utils/data/index.js +17 -0
- package/dist/runtime/utils/data/node.d.ts +9 -0
- package/dist/runtime/utils/data/node.js +101 -0
- package/dist/runtime/utils/event/cursor.d.ts +3 -6
- package/dist/runtime/utils/event/cursor.js +52 -105
- package/dist/runtime/utils/event/index.d.ts +2 -6
- package/dist/runtime/utils/event/index.js +48 -6
- package/dist/runtime/utils/event/keyboard.d.ts +22 -7
- package/dist/runtime/utils/event/keyboard.js +910 -1406
- package/dist/runtime/utils/layout/body.d.ts +3 -4
- package/dist/runtime/utils/layout/body.js +83 -51
- package/dist/runtime/utils/layout/icon.d.ts +1 -2
- package/dist/runtime/utils/layout/icon.js +64 -67
- package/dist/runtime/utils/layout/index.d.ts +0 -3
- package/dist/runtime/utils/layout/index.js +0 -3
- package/dist/runtime/utils/node/element.d.ts +4 -6
- package/dist/runtime/utils/node/element.js +58 -71
- package/dist/runtime/utils/node/index.d.ts +1 -1
- package/dist/runtime/utils/node/index.js +1 -1
- package/dist/runtime/utils/node/style.d.ts +5 -0
- package/dist/runtime/utils/node/style.js +702 -0
- package/package.json +31 -17
- package/dist/runtime/utils/event/block.d.ts +0 -7
- package/dist/runtime/utils/event/block.js +0 -110
- package/dist/runtime/utils/event/data.d.ts +0 -8
- package/dist/runtime/utils/event/data.js +0 -379
- package/dist/runtime/utils/event/mouse.d.ts +0 -11
- package/dist/runtime/utils/event/mouse.js +0 -85
- package/dist/runtime/utils/event/scroll.d.ts +0 -3
- package/dist/runtime/utils/event/scroll.js +0 -29
- package/dist/runtime/utils/event/touch.d.ts +0 -5
- package/dist/runtime/utils/event/touch.js +0 -10
- package/dist/runtime/utils/event/window.d.ts +0 -5
- package/dist/runtime/utils/event/window.js +0 -47
- package/dist/runtime/utils/layout/block.d.ts +0 -7
- package/dist/runtime/utils/layout/block.js +0 -123
- package/dist/runtime/utils/layout/controlbar.d.ts +0 -3
- package/dist/runtime/utils/layout/controlbar.js +0 -99
- package/dist/runtime/utils/layout/menuBar.d.ts +0 -3
- package/dist/runtime/utils/layout/menuBar.js +0 -408
- package/dist/runtime/utils/node/block.d.ts +0 -19
- package/dist/runtime/utils/node/block.js +0 -256
- package/dist/runtime/utils/style/anchor.d.ts +0 -5
- package/dist/runtime/utils/style/anchor.js +0 -245
- package/dist/runtime/utils/style/decoration.d.ts +0 -4
- package/dist/runtime/utils/style/decoration.js +0 -378
- package/dist/runtime/utils/style/index.d.ts +0 -2
- package/dist/runtime/utils/style/index.js +0 -2
package/dist/runtime/type.d.mts
CHANGED
|
@@ -1,179 +1,156 @@
|
|
|
1
|
-
|
|
1
|
+
// 컨텐츠 데이터
|
|
2
|
+
export type DEContentData = DEBlockData[];
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
// 컨텐츠 타입
|
|
5
|
+
export type DEBlockData = DETextBlock | DEHeadingBlock | DEListBlock | DEImageBlock | DECodeBlock | DECustomBlock | DEDividerBlock;
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
// 블록 타입
|
|
8
|
+
export type DEBlockType = DEBlockData["type"];
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
// 리스트 엘리먼트 태그 명
|
|
11
|
+
export type DEListElementName = "ul" | "ol";
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
// 해딩 테그 레벨
|
|
14
|
+
export type DEHeadingElementLevel = 1 | 2 | 3;
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
// 아이콘 종류
|
|
17
|
+
export type DEIconKind = "plus" | "bold" | "italic" | "underline" | "strikethrough" | "codeblock" | "add-link" | "remove-link" | "image" | "align-center" | "align-left" | "align-right" | "align-justify" | "move-up" | "move-down" | "move-first" | "move-last" | "indent-decrease" | "indent-increase";
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
// 메뉴용 블럭 추가 타입
|
|
20
|
+
export type DEBlockMenutype = Exclude<DEBlockType, "heading" | "list" | "image"> | "heading1" | "heading2" | "heading3" | "unordered-list" | "ordered-list";
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
// 정렬 종류
|
|
23
|
+
export type DETextalign = "left" | "right" | "center" | "justify";
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
// 데코레이션 클레스 종류
|
|
26
|
+
export type DEDecorationClass = "de-bold" | "de-italic" | "de-underline" | "de-strikethrough" | "de-code";
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
type
|
|
28
|
+
// 에디터 컴포넌트
|
|
29
|
+
export interface DragonEditor {
|
|
30
|
+
addBlock(name: DEBlockMenutype, textContent: string = ""): Promise<void>;
|
|
31
|
+
addImageBlock(src: string, caption: string = ""): Promise<void>;
|
|
32
|
+
updateLayout(): void;
|
|
33
|
+
checkDataIsEmpty(data?: DEContentData): boolean;
|
|
34
|
+
setDecoration(type: "bold" | "italic" | "underline" | "strikethrough" | "code"): void;
|
|
35
|
+
setAlign(align: DETextalign): void;
|
|
36
|
+
}
|
|
26
37
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
screenChangePoint: number;
|
|
39
|
-
firstData: DEContentData;
|
|
40
|
-
menuBarTop: number;
|
|
41
|
-
activeStatus: {
|
|
42
|
-
addBlockMenu: boolean;
|
|
43
|
-
anchorInputArea: boolean;
|
|
44
|
-
imageResizeEvent: boolean;
|
|
38
|
+
// 스토어 구조체
|
|
39
|
+
export interface DragonEditorStore {
|
|
40
|
+
data: DEContentData;
|
|
41
|
+
selectedBlockId: string;
|
|
42
|
+
selectedBlockIndex: number;
|
|
43
|
+
option: DEOption;
|
|
44
|
+
status: {
|
|
45
|
+
isParentOverflowHidden: boolean;
|
|
46
|
+
isImageResizeActive: boolean;
|
|
47
|
+
anchorHerf: string;
|
|
48
|
+
menuTop: number;
|
|
45
49
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
cursorSelection: null | Selection;
|
|
51
|
+
cursorRange: null | Range;
|
|
52
|
+
fn: {
|
|
53
|
+
updateEditorData: ((data: DEContentData) => void) | null;
|
|
54
|
+
uploadImage: ((files: File[]) => void) | null;
|
|
51
55
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
anchorValidation: boolean;
|
|
57
|
-
currentBlockType: DEBlock;
|
|
58
|
-
codeBlockTheme: DECodeblockTheme;
|
|
59
|
-
codeBlockLang: DECodeblockLang;
|
|
60
|
-
listBlockStyle: DEListStyle;
|
|
61
|
-
anchorTabType: "url" | "heading";
|
|
62
|
-
anchorHeadingList: DEHeadingItem[];
|
|
63
|
-
anchorHref: string;
|
|
64
|
-
previousCorsorData: DEditorCursor | null;
|
|
65
|
-
$anchorInput: HTMLInputElement | null;
|
|
66
|
-
$currentBlock: HTMLDivElement | null;
|
|
67
|
-
$transformElement: HTMLElement | null;
|
|
56
|
+
element: {
|
|
57
|
+
editor: null | HTMLDivElement;
|
|
58
|
+
body: null | HTMLDivElement;
|
|
59
|
+
scrollParentElement: HTMLElement | Window | null;
|
|
68
60
|
};
|
|
69
|
-
|
|
70
|
-
codeBlockTheme: DECodeItem<DECodeblockTheme>[];
|
|
71
|
-
listUlType: DECodeItem<DEListStyle>[];
|
|
72
|
-
listOlType: DECodeItem<DEListStyle>[];
|
|
73
|
-
$editor: HTMLDivElement | null;
|
|
74
|
-
$body: HTMLDivElement | null;
|
|
75
|
-
$controlBar: HTMLDivElement | null;
|
|
76
|
-
$parentWrap: HTMLElement | Window | null;
|
|
77
|
-
windowClickEvent(event: MouseEvent): void;
|
|
78
|
-
windowResizeEvent(event: Event): void;
|
|
79
|
-
windowMouseUpEvent(event: MouseEvent): void;
|
|
80
|
-
parentWrapScollEvent(event: Event): void;
|
|
81
|
-
emit: {
|
|
82
|
-
(e: "update:modelValue", data: DEContentData): void;
|
|
83
|
-
(e: "uploadImageEvent", file: File): void;
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
interface DEditorCursor {
|
|
88
|
-
type: "Range" | "Caret" | "None";
|
|
89
|
-
startNode: Node;
|
|
90
|
-
startOffset: number;
|
|
91
|
-
endNode: Node;
|
|
92
|
-
endOffset: number;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
interface DEArrangeCursorData {
|
|
96
|
-
startNode: Node;
|
|
97
|
-
startNodeIdx: number;
|
|
98
|
-
startOffset: number;
|
|
99
|
-
endNode: Node;
|
|
100
|
-
endNodeIdx: number;
|
|
101
|
-
endOffset: number;
|
|
61
|
+
codeBlockLnaguageList: { [key: string]: string };
|
|
102
62
|
}
|
|
103
63
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
64
|
+
// 스토어용 에디터 옵션
|
|
65
|
+
export interface DEOption {
|
|
66
|
+
mediaHostURL: string;
|
|
67
|
+
isMobile: boolean;
|
|
68
|
+
codeBlockSpaces: number;
|
|
69
|
+
acceptImageFormat: string;
|
|
70
|
+
anchorTagTarget: string;
|
|
107
71
|
}
|
|
108
72
|
|
|
109
|
-
|
|
110
|
-
|
|
73
|
+
// 컨텐츠 블럭 타입
|
|
74
|
+
export interface DETextBlock {
|
|
111
75
|
id: string;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// 컴포넌트 메서드용 타입
|
|
115
|
-
interface DragonEditor {
|
|
116
|
-
addBlock: (type: DEBlockData) => void;
|
|
117
|
-
setDecoration: (data: DEDecoration) => void;
|
|
118
|
-
setTextAlign: (type: DETextalign) => void;
|
|
119
|
-
changeEditorData: (data: DEContentData) => void;
|
|
120
|
-
updateLayout: () => void;
|
|
121
|
-
checkDataEmpty: (data?: DEContentData) => boolean;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
interface DETextBlock {
|
|
125
76
|
type: "text";
|
|
126
77
|
classList: string[];
|
|
127
78
|
depth?: number;
|
|
128
79
|
textContent: string;
|
|
129
80
|
}
|
|
130
81
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
level: number;
|
|
82
|
+
// 컨텐츠 해딩 타입
|
|
83
|
+
export interface DEHeadingBlock {
|
|
134
84
|
id: string;
|
|
135
|
-
|
|
85
|
+
type: "heading";
|
|
136
86
|
classList: string[];
|
|
87
|
+
level: DEHeadingElementLevel;
|
|
88
|
+
depth?: number;
|
|
137
89
|
textContent: string;
|
|
138
90
|
}
|
|
139
91
|
|
|
140
|
-
|
|
92
|
+
// 컨텐츠 리스트 자식 타입
|
|
93
|
+
export interface DEListItem {
|
|
94
|
+
id: string;
|
|
141
95
|
classList: string[];
|
|
96
|
+
depth?: number;
|
|
142
97
|
textContent: string;
|
|
143
98
|
}
|
|
144
99
|
|
|
145
|
-
|
|
100
|
+
// 컨텐츠 리스트 타입
|
|
101
|
+
export interface DEListBlock {
|
|
102
|
+
id: string;
|
|
146
103
|
type: "list";
|
|
147
104
|
element: DEListElementName;
|
|
148
|
-
depth?: number;
|
|
149
|
-
style: DEListStyle;
|
|
150
105
|
child: DEListItem[];
|
|
151
106
|
}
|
|
152
107
|
|
|
153
|
-
|
|
108
|
+
// 컨텐츠 이미지 타입
|
|
109
|
+
export interface DEImageBlock {
|
|
110
|
+
id: string;
|
|
154
111
|
type: "image";
|
|
112
|
+
classList: string[];
|
|
155
113
|
maxWidth: number;
|
|
156
114
|
src: string;
|
|
157
|
-
width: number;
|
|
158
|
-
height: number;
|
|
159
115
|
caption: string;
|
|
160
|
-
classList: string[];
|
|
161
116
|
}
|
|
162
117
|
|
|
163
|
-
|
|
118
|
+
// 컨텐츠 코드 블럭 타입
|
|
119
|
+
export interface DECodeBlock {
|
|
120
|
+
id: string;
|
|
164
121
|
type: "code";
|
|
165
|
-
language:
|
|
166
|
-
theme: DECodeblockTheme;
|
|
122
|
+
language: string;
|
|
167
123
|
filename: string;
|
|
168
124
|
textContent: string;
|
|
169
125
|
}
|
|
170
126
|
|
|
171
|
-
|
|
127
|
+
// 컨텐츠 커스텀 타입
|
|
128
|
+
export interface DECustomBlock {
|
|
129
|
+
id: string;
|
|
172
130
|
type: "custom";
|
|
173
|
-
classList: string[];
|
|
174
131
|
textContent: string;
|
|
175
132
|
}
|
|
176
133
|
|
|
177
|
-
|
|
134
|
+
// 컨텐츠 구분선 타입
|
|
135
|
+
export interface DEDividerBlock {
|
|
136
|
+
id: string;
|
|
178
137
|
type: "divider";
|
|
179
138
|
}
|
|
139
|
+
|
|
140
|
+
// 멀티라인 포지션
|
|
141
|
+
export interface DELinePosition {
|
|
142
|
+
curruntLine: number;
|
|
143
|
+
lineCount: number;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 커서 포지션
|
|
147
|
+
export interface DECurSorPosition {
|
|
148
|
+
isStart: boolean;
|
|
149
|
+
isEnd: boolean;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// 커서 오프샛
|
|
153
|
+
export interface DECursorOffset {
|
|
154
|
+
nodeIndex: number;
|
|
155
|
+
offset: number;
|
|
156
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DEContentData, DETextBlock, DEHeadingBlock, DEHeadingElementLevel, DEBlockType, DEBlockMenutype, DECodeBlock, DEImageBlock, DEDividerBlock, DECustomBlock, DEBlockData } from "../../type.d.mts.js";
|
|
2
|
+
export declare function _arrangementContentData(data: DEContentData): DEContentData;
|
|
3
|
+
export declare function _createTextBlockData(textContent?: string): DETextBlock;
|
|
4
|
+
export declare function _createHeadingBlockData(level: DEHeadingElementLevel, textContent?: string): DEHeadingBlock;
|
|
5
|
+
export declare function _createListBlockData(element: DEListElementName, childList?: DEListItem[]): DEListBlock;
|
|
6
|
+
export declare function _createListBlockChildData(textContent?: string, depth?: number): DEListItem;
|
|
7
|
+
export declare function _createImageBlockData(src: string, caption?: string, useHost?: boolean): DEImageBlock;
|
|
8
|
+
export declare function _createCodeBlockData(language?: string, textContent?: string, filename?: string): DECodeBlock;
|
|
9
|
+
export declare function _createDividerBlockData(): DEDividerBlock;
|
|
10
|
+
export declare function _createCustomBlockData(textContent?: string): DECustomBlock;
|
|
11
|
+
export declare function _getBlockType($block: HTMLElement): DEBlockType;
|
|
12
|
+
export declare function _addBlock(name: DEBlockMenutype, textContent?: string): Promise<void>;
|
|
13
|
+
export declare function _addImageBlock(src: string, caption?: string): Promise<void>;
|
|
14
|
+
export declare function _convertMarkdownToEditor(textDataList: string[]): Promise<DEBlockData[]>;
|
|
15
|
+
export declare function _moveBlockIndex(duration: "first" | "up" | "down" | "last"): Promise<void>;
|
|
16
|
+
export declare function _checkCanUseIndent(): boolean;
|
|
17
|
+
export declare function _setIndentData(type: "decrease" | "increase"): Promise<void>;
|
|
18
|
+
export declare function _checkCanUseAlign(): boolean;
|
|
19
|
+
export declare function _checkCanUseDecoration(): boolean;
|
|
20
|
+
export declare function _checkDataIsEmpty(data?: DEContentData): boolean;
|