dragon-editor 3.5.21 → 3.6.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 +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/components/DragonEditor.vue +34 -3
- package/dist/runtime/components/DragonEditorViewer.vue +21 -3
- package/dist/runtime/scss/editor.css +21 -3
- package/dist/runtime/scss/viewer.css +21 -3
- package/dist/runtime/type.d.ts +8 -2
- package/dist/runtime/utils/event/data.js +14 -0
- package/dist/runtime/utils/event/window.js +1 -1
- package/dist/runtime/utils/layout/block.js +6 -0
- package/dist/runtime/utils/layout/body.js +4 -1
- package/dist/runtime/utils/layout/menuBar.js +12 -0
- package/dist/runtime/utils/node/block.d.ts +1 -0
- package/dist/runtime/utils/node/block.js +8 -0
- package/dist/runtime/utils/style/anchor.js +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/module.json
CHANGED
|
@@ -16,11 +16,13 @@ interface DEOption {
|
|
|
16
16
|
modelValue: DEContentData;
|
|
17
17
|
useMenuBar?: boolean;
|
|
18
18
|
imageHostURL?: string;
|
|
19
|
+
screenChangePoint?: number;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const props = withDefaults(defineProps<DEOption>(), {
|
|
22
23
|
useMenuBar: true,
|
|
23
24
|
imageHostURL: "",
|
|
25
|
+
screenChangePoint: 1200,
|
|
24
26
|
});
|
|
25
27
|
const emit = defineEmits<{
|
|
26
28
|
(e: "update:modelValue", data: DEContentData): void;
|
|
@@ -40,6 +42,7 @@ const editorStore = ref<DragonEditorStore>({
|
|
|
40
42
|
useMenuBar: props.useMenuBar,
|
|
41
43
|
imageHostURL: props.imageHostURL,
|
|
42
44
|
firstData: props.modelValue,
|
|
45
|
+
screenChangePoint: props.screenChangePoint,
|
|
43
46
|
menuBarTop: 0,
|
|
44
47
|
activeStatus: {
|
|
45
48
|
addBlockMenu: false,
|
|
@@ -201,6 +204,15 @@ function changeEditorData(data: DEContentData): void {
|
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
206
|
|
|
207
|
+
// 레이아웃 변경시 리마운트
|
|
208
|
+
function updateLayout(): void {
|
|
209
|
+
_eidtorUnmountEvent(editorStore);
|
|
210
|
+
|
|
211
|
+
setTimeout(() => {
|
|
212
|
+
_eidtorMountEvent(editorStore);
|
|
213
|
+
}, 250);
|
|
214
|
+
}
|
|
215
|
+
|
|
204
216
|
onMounted(() => {
|
|
205
217
|
_eidtorMountEvent(editorStore);
|
|
206
218
|
});
|
|
@@ -214,6 +226,7 @@ defineExpose({
|
|
|
214
226
|
setDecoration,
|
|
215
227
|
setAlign,
|
|
216
228
|
changeEditorData,
|
|
229
|
+
updateLayout,
|
|
217
230
|
});
|
|
218
231
|
</script>
|
|
219
232
|
|
|
@@ -243,6 +256,7 @@ defineExpose({
|
|
|
243
256
|
.dragon-editor legend,
|
|
244
257
|
.dragon-editor figure,
|
|
245
258
|
.dragon-editor menu,
|
|
259
|
+
.dragon-editor hr,
|
|
246
260
|
.dragon-editor-viewer h1,
|
|
247
261
|
.dragon-editor-viewer h2,
|
|
248
262
|
.dragon-editor-viewer h3,
|
|
@@ -259,7 +273,8 @@ defineExpose({
|
|
|
259
273
|
.dragon-editor-viewer fieldset,
|
|
260
274
|
.dragon-editor-viewer legend,
|
|
261
275
|
.dragon-editor-viewer figure,
|
|
262
|
-
.dragon-editor-viewer menu
|
|
276
|
+
.dragon-editor-viewer menu,
|
|
277
|
+
.dragon-editor-viewer hr {
|
|
263
278
|
margin: 0;
|
|
264
279
|
padding: 0;
|
|
265
280
|
border: 0;
|
|
@@ -293,7 +308,7 @@ defineExpose({
|
|
|
293
308
|
.dragon-editor-viewer h4,
|
|
294
309
|
.dragon-editor-viewer h5,
|
|
295
310
|
.dragon-editor-viewer h6 {
|
|
296
|
-
font-size:
|
|
311
|
+
font-size: inherit;
|
|
297
312
|
font-weight: normal;
|
|
298
313
|
}
|
|
299
314
|
.dragon-editor input,
|
|
@@ -323,6 +338,7 @@ defineExpose({
|
|
|
323
338
|
.dragon-editor-viewer input[type=reset] {
|
|
324
339
|
border: 0;
|
|
325
340
|
background: transparent;
|
|
341
|
+
color: inherit;
|
|
326
342
|
font-size: inherit;
|
|
327
343
|
cursor: pointer;
|
|
328
344
|
}
|
|
@@ -393,7 +409,6 @@ defineExpose({
|
|
|
393
409
|
.dragon-editor .de-body {
|
|
394
410
|
display: flex;
|
|
395
411
|
flex-direction: column;
|
|
396
|
-
min-height: 500px;
|
|
397
412
|
padding: 16px 20px;
|
|
398
413
|
line-height: 1.6;
|
|
399
414
|
}
|
|
@@ -923,6 +938,8 @@ defineExpose({
|
|
|
923
938
|
.dragon-editor .de-code-block {
|
|
924
939
|
display: flex;
|
|
925
940
|
flex-wrap: wrap;
|
|
941
|
+
margin: 2px 0;
|
|
942
|
+
padding: 0;
|
|
926
943
|
border-radius: var(--radius-default);
|
|
927
944
|
overflow: hidden;
|
|
928
945
|
}
|
|
@@ -1179,6 +1196,20 @@ defineExpose({
|
|
|
1179
1196
|
color: #ffd8d3;
|
|
1180
1197
|
background-color: #78191b;
|
|
1181
1198
|
}
|
|
1199
|
+
.dragon-editor .de-divider-block {
|
|
1200
|
+
display: flex;
|
|
1201
|
+
align-items: center;
|
|
1202
|
+
height: 20px;
|
|
1203
|
+
}
|
|
1204
|
+
.dragon-editor .de-divider-block::before {
|
|
1205
|
+
display: block;
|
|
1206
|
+
content: "";
|
|
1207
|
+
width: 100%;
|
|
1208
|
+
height: 2px;
|
|
1209
|
+
padding: 0;
|
|
1210
|
+
background: #e5e5e5;
|
|
1211
|
+
border-radius: 2px;
|
|
1212
|
+
}
|
|
1182
1213
|
.dragon-editor .de-bold {
|
|
1183
1214
|
font-weight: 700;
|
|
1184
1215
|
}
|
|
@@ -58,6 +58,7 @@ function structure(): VNode {
|
|
|
58
58
|
.dragon-editor legend,
|
|
59
59
|
.dragon-editor figure,
|
|
60
60
|
.dragon-editor menu,
|
|
61
|
+
.dragon-editor hr,
|
|
61
62
|
.dragon-editor-viewer h1,
|
|
62
63
|
.dragon-editor-viewer h2,
|
|
63
64
|
.dragon-editor-viewer h3,
|
|
@@ -74,7 +75,8 @@ function structure(): VNode {
|
|
|
74
75
|
.dragon-editor-viewer fieldset,
|
|
75
76
|
.dragon-editor-viewer legend,
|
|
76
77
|
.dragon-editor-viewer figure,
|
|
77
|
-
.dragon-editor-viewer menu
|
|
78
|
+
.dragon-editor-viewer menu,
|
|
79
|
+
.dragon-editor-viewer hr {
|
|
78
80
|
margin: 0;
|
|
79
81
|
padding: 0;
|
|
80
82
|
border: 0;
|
|
@@ -108,7 +110,7 @@ function structure(): VNode {
|
|
|
108
110
|
.dragon-editor-viewer h4,
|
|
109
111
|
.dragon-editor-viewer h5,
|
|
110
112
|
.dragon-editor-viewer h6 {
|
|
111
|
-
font-size:
|
|
113
|
+
font-size: inherit;
|
|
112
114
|
font-weight: normal;
|
|
113
115
|
}
|
|
114
116
|
.dragon-editor input,
|
|
@@ -138,6 +140,7 @@ function structure(): VNode {
|
|
|
138
140
|
.dragon-editor-viewer input[type=reset] {
|
|
139
141
|
border: 0;
|
|
140
142
|
background: transparent;
|
|
143
|
+
color: inherit;
|
|
141
144
|
font-size: inherit;
|
|
142
145
|
cursor: pointer;
|
|
143
146
|
}
|
|
@@ -193,7 +196,6 @@ function structure(): VNode {
|
|
|
193
196
|
.dragon-editor-viewer {
|
|
194
197
|
display: flex;
|
|
195
198
|
flex-direction: column;
|
|
196
|
-
gap: 4px;
|
|
197
199
|
width: 100%;
|
|
198
200
|
height: 100%;
|
|
199
201
|
line-height: 1.6;
|
|
@@ -542,6 +544,8 @@ function structure(): VNode {
|
|
|
542
544
|
.dragon-editor-viewer .de-code-block {
|
|
543
545
|
display: flex;
|
|
544
546
|
flex-wrap: wrap;
|
|
547
|
+
margin: 2px 0;
|
|
548
|
+
padding: 0;
|
|
545
549
|
border-radius: var(--radius-default);
|
|
546
550
|
overflow: hidden;
|
|
547
551
|
}
|
|
@@ -770,6 +774,20 @@ function structure(): VNode {
|
|
|
770
774
|
color: #ffd8d3;
|
|
771
775
|
background-color: #78191b;
|
|
772
776
|
}
|
|
777
|
+
.dragon-editor-viewer .de-divider-block {
|
|
778
|
+
display: flex;
|
|
779
|
+
align-items: center;
|
|
780
|
+
height: 20px;
|
|
781
|
+
}
|
|
782
|
+
.dragon-editor-viewer .de-divider-block::before {
|
|
783
|
+
display: block;
|
|
784
|
+
content: "";
|
|
785
|
+
width: 100%;
|
|
786
|
+
height: 2px;
|
|
787
|
+
padding: 0;
|
|
788
|
+
background: #e5e5e5;
|
|
789
|
+
border-radius: 2px;
|
|
790
|
+
}
|
|
773
791
|
.dragon-editor-viewer .de-bold {
|
|
774
792
|
font-weight: 700;
|
|
775
793
|
}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
.dragon-editor legend,
|
|
24
24
|
.dragon-editor figure,
|
|
25
25
|
.dragon-editor menu,
|
|
26
|
+
.dragon-editor hr,
|
|
26
27
|
.dragon-editor-viewer h1,
|
|
27
28
|
.dragon-editor-viewer h2,
|
|
28
29
|
.dragon-editor-viewer h3,
|
|
@@ -39,7 +40,8 @@
|
|
|
39
40
|
.dragon-editor-viewer fieldset,
|
|
40
41
|
.dragon-editor-viewer legend,
|
|
41
42
|
.dragon-editor-viewer figure,
|
|
42
|
-
.dragon-editor-viewer menu
|
|
43
|
+
.dragon-editor-viewer menu,
|
|
44
|
+
.dragon-editor-viewer hr {
|
|
43
45
|
margin: 0;
|
|
44
46
|
padding: 0;
|
|
45
47
|
border: 0;
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
.dragon-editor-viewer h4,
|
|
74
76
|
.dragon-editor-viewer h5,
|
|
75
77
|
.dragon-editor-viewer h6 {
|
|
76
|
-
font-size:
|
|
78
|
+
font-size: inherit;
|
|
77
79
|
font-weight: normal;
|
|
78
80
|
}
|
|
79
81
|
.dragon-editor input,
|
|
@@ -103,6 +105,7 @@
|
|
|
103
105
|
.dragon-editor-viewer input[type=reset] {
|
|
104
106
|
border: 0;
|
|
105
107
|
background: transparent;
|
|
108
|
+
color: inherit;
|
|
106
109
|
font-size: inherit;
|
|
107
110
|
cursor: pointer;
|
|
108
111
|
}
|
|
@@ -173,7 +176,6 @@
|
|
|
173
176
|
.dragon-editor .de-body {
|
|
174
177
|
display: flex;
|
|
175
178
|
flex-direction: column;
|
|
176
|
-
min-height: 500px;
|
|
177
179
|
padding: 16px 20px;
|
|
178
180
|
line-height: 1.6;
|
|
179
181
|
}
|
|
@@ -703,6 +705,8 @@
|
|
|
703
705
|
.dragon-editor .de-code-block {
|
|
704
706
|
display: flex;
|
|
705
707
|
flex-wrap: wrap;
|
|
708
|
+
margin: 2px 0;
|
|
709
|
+
padding: 0;
|
|
706
710
|
border-radius: var(--radius-default);
|
|
707
711
|
overflow: hidden;
|
|
708
712
|
}
|
|
@@ -959,6 +963,20 @@
|
|
|
959
963
|
color: #ffd8d3;
|
|
960
964
|
background-color: #78191b;
|
|
961
965
|
}
|
|
966
|
+
.dragon-editor .de-divider-block {
|
|
967
|
+
display: flex;
|
|
968
|
+
align-items: center;
|
|
969
|
+
height: 20px;
|
|
970
|
+
}
|
|
971
|
+
.dragon-editor .de-divider-block::before {
|
|
972
|
+
display: block;
|
|
973
|
+
content: "";
|
|
974
|
+
width: 100%;
|
|
975
|
+
height: 2px;
|
|
976
|
+
padding: 0;
|
|
977
|
+
background: #e5e5e5;
|
|
978
|
+
border-radius: 2px;
|
|
979
|
+
}
|
|
962
980
|
.dragon-editor .de-bold {
|
|
963
981
|
font-weight: 700;
|
|
964
982
|
}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
.dragon-editor legend,
|
|
24
24
|
.dragon-editor figure,
|
|
25
25
|
.dragon-editor menu,
|
|
26
|
+
.dragon-editor hr,
|
|
26
27
|
.dragon-editor-viewer h1,
|
|
27
28
|
.dragon-editor-viewer h2,
|
|
28
29
|
.dragon-editor-viewer h3,
|
|
@@ -39,7 +40,8 @@
|
|
|
39
40
|
.dragon-editor-viewer fieldset,
|
|
40
41
|
.dragon-editor-viewer legend,
|
|
41
42
|
.dragon-editor-viewer figure,
|
|
42
|
-
.dragon-editor-viewer menu
|
|
43
|
+
.dragon-editor-viewer menu,
|
|
44
|
+
.dragon-editor-viewer hr {
|
|
43
45
|
margin: 0;
|
|
44
46
|
padding: 0;
|
|
45
47
|
border: 0;
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
.dragon-editor-viewer h4,
|
|
74
76
|
.dragon-editor-viewer h5,
|
|
75
77
|
.dragon-editor-viewer h6 {
|
|
76
|
-
font-size:
|
|
78
|
+
font-size: inherit;
|
|
77
79
|
font-weight: normal;
|
|
78
80
|
}
|
|
79
81
|
.dragon-editor input,
|
|
@@ -103,6 +105,7 @@
|
|
|
103
105
|
.dragon-editor-viewer input[type=reset] {
|
|
104
106
|
border: 0;
|
|
105
107
|
background: transparent;
|
|
108
|
+
color: inherit;
|
|
106
109
|
font-size: inherit;
|
|
107
110
|
cursor: pointer;
|
|
108
111
|
}
|
|
@@ -158,7 +161,6 @@
|
|
|
158
161
|
.dragon-editor-viewer {
|
|
159
162
|
display: flex;
|
|
160
163
|
flex-direction: column;
|
|
161
|
-
gap: 4px;
|
|
162
164
|
width: 100%;
|
|
163
165
|
height: 100%;
|
|
164
166
|
line-height: 1.6;
|
|
@@ -507,6 +509,8 @@
|
|
|
507
509
|
.dragon-editor-viewer .de-code-block {
|
|
508
510
|
display: flex;
|
|
509
511
|
flex-wrap: wrap;
|
|
512
|
+
margin: 2px 0;
|
|
513
|
+
padding: 0;
|
|
510
514
|
border-radius: var(--radius-default);
|
|
511
515
|
overflow: hidden;
|
|
512
516
|
}
|
|
@@ -735,6 +739,20 @@
|
|
|
735
739
|
color: #ffd8d3;
|
|
736
740
|
background-color: #78191b;
|
|
737
741
|
}
|
|
742
|
+
.dragon-editor-viewer .de-divider-block {
|
|
743
|
+
display: flex;
|
|
744
|
+
align-items: center;
|
|
745
|
+
height: 20px;
|
|
746
|
+
}
|
|
747
|
+
.dragon-editor-viewer .de-divider-block::before {
|
|
748
|
+
display: block;
|
|
749
|
+
content: "";
|
|
750
|
+
width: 100%;
|
|
751
|
+
height: 2px;
|
|
752
|
+
padding: 0;
|
|
753
|
+
background: #e5e5e5;
|
|
754
|
+
border-radius: 2px;
|
|
755
|
+
}
|
|
738
756
|
.dragon-editor-viewer .de-bold {
|
|
739
757
|
font-weight: 700;
|
|
740
758
|
}
|
package/dist/runtime/type.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { codeToHtml } from "shiki";
|
|
|
2
2
|
|
|
3
3
|
type DEContentData = DEBlockData[];
|
|
4
4
|
|
|
5
|
-
type DEBlockData = DETextBlock | DEHeadingBlock | DEListBlock | DEImageBlock | DECodeBlock | DECustomBlock;
|
|
5
|
+
type DEBlockData = DETextBlock | DEHeadingBlock | DEListBlock | DEImageBlock | DECodeBlock | DECustomBlock | DEDividerBlock;
|
|
6
6
|
|
|
7
7
|
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" | "indent-decrease" | "indent-increase";
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ type DETextalign = "left" | "right" | "center" | "justify";
|
|
|
12
12
|
|
|
13
13
|
type DEBlock = "text" | "heading" | "ul" | "ol" | "image" | "code" | "custom";
|
|
14
14
|
|
|
15
|
-
type DEBlockMenutype = "text" | "heading1" | "heading2" | "heading3" | "ul" | "ol" | "image" | "code" | "custom";
|
|
15
|
+
type DEBlockMenutype = "text" | "heading1" | "heading2" | "heading3" | "ul" | "ol" | "image" | "code" | "custom" | "divider";
|
|
16
16
|
|
|
17
17
|
type DEListStyle = "disc" | "square" | "decimal" | "lower-alpha" | "upper-alpha" | "lower-roman" | "upper-roman";
|
|
18
18
|
|
|
@@ -35,6 +35,7 @@ interface DragonEditorStore {
|
|
|
35
35
|
};
|
|
36
36
|
useMenuBar: boolean;
|
|
37
37
|
imageHostURL: string;
|
|
38
|
+
screenChangePoint: number;
|
|
38
39
|
firstData: DEContentData;
|
|
39
40
|
menuBarTop: number;
|
|
40
41
|
activeStatus: {
|
|
@@ -113,6 +114,7 @@ interface DragonEditor {
|
|
|
113
114
|
setDecoration: (data: DEDecoration) => void;
|
|
114
115
|
setTextAlign: (type: DETextalign) => void;
|
|
115
116
|
changeEditorData: (data: DEContentData) => void;
|
|
117
|
+
updateLayout: () => void;
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
interface DETextBlock {
|
|
@@ -167,3 +169,7 @@ interface DECustomBlock {
|
|
|
167
169
|
classList: string[];
|
|
168
170
|
textContent: string;
|
|
169
171
|
}
|
|
172
|
+
|
|
173
|
+
interface DEDividerBlock {
|
|
174
|
+
type: "divider";
|
|
175
|
+
}
|
|
@@ -227,6 +227,15 @@ export function _updateModelData(store) {
|
|
|
227
227
|
})
|
|
228
228
|
);
|
|
229
229
|
break;
|
|
230
|
+
case $el.classList.contains("de-divider-block"):
|
|
231
|
+
workList.push(
|
|
232
|
+
new Promise((done) => {
|
|
233
|
+
done({
|
|
234
|
+
type: "divider"
|
|
235
|
+
});
|
|
236
|
+
})
|
|
237
|
+
);
|
|
238
|
+
break;
|
|
230
239
|
default:
|
|
231
240
|
workList.push(
|
|
232
241
|
new Promise((done) => {
|
|
@@ -282,6 +291,11 @@ export function _getDefaultBlockData(type) {
|
|
|
282
291
|
textContent: ""
|
|
283
292
|
};
|
|
284
293
|
break;
|
|
294
|
+
case "divider":
|
|
295
|
+
data = {
|
|
296
|
+
type: "divider"
|
|
297
|
+
};
|
|
298
|
+
break;
|
|
285
299
|
}
|
|
286
300
|
return data;
|
|
287
301
|
}
|
|
@@ -24,7 +24,7 @@ export function _windowResizeEvent(event, store) {
|
|
|
24
24
|
__checkAndSetUpMobile(store);
|
|
25
25
|
}
|
|
26
26
|
function __checkAndSetUpMobile(store) {
|
|
27
|
-
if (window.innerWidth >
|
|
27
|
+
if (window.innerWidth > store.value.screenChangePoint) {
|
|
28
28
|
store.value.controlStatus.isMobile = false;
|
|
29
29
|
} else {
|
|
30
30
|
store.value.controlStatus.isMobile = true;
|
|
@@ -22,6 +22,9 @@ export function _createBlockList({ blockList, isEditable, imageHostURL } = { blo
|
|
|
22
22
|
case "code":
|
|
23
23
|
blockArray.push(__createCodeBlock(block, isEditable));
|
|
24
24
|
break;
|
|
25
|
+
case "divider":
|
|
26
|
+
blockArray.push(__createDividerBlock());
|
|
27
|
+
break;
|
|
25
28
|
default:
|
|
26
29
|
blockArray.push(__createCustomBlock(block));
|
|
27
30
|
}
|
|
@@ -103,3 +106,6 @@ function __createCodeBlock(data, isEditable) {
|
|
|
103
106
|
function __createCustomBlock(data) {
|
|
104
107
|
return h("div", { class: ["de-block", "de-custom-block", ...data.classList], innerHTML: data.textContent });
|
|
105
108
|
}
|
|
109
|
+
function __createDividerBlock() {
|
|
110
|
+
return h("div", { class: ["de-block", "de-divider-block"] });
|
|
111
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "vue";
|
|
2
2
|
import { _createBlockList } from "./index.js";
|
|
3
3
|
import { _contentKeydownEvent, _contentKeyupEvent, _contentPasteEvent, _contentMouseupEvent, _contentMousedownEvnet, _contentTouchstartEvent, _getDefaultBlockData, _updateModelData } from "../event/index.js";
|
|
4
|
-
import { _createTextBlock, _createHeadingBlock, _createListBlock, _createImageBlock, _createCodeBlock, _createCustomBlock } from "../node/index.js";
|
|
4
|
+
import { _createTextBlock, _createHeadingBlock, _createListBlock, _createImageBlock, _createCodeBlock, _createCustomBlock, _createDividerBlock } from "../node/index.js";
|
|
5
5
|
export function _getBodyVNodeStructure(store) {
|
|
6
6
|
return h(
|
|
7
7
|
"div",
|
|
@@ -44,6 +44,9 @@ export function _updateBodyStructure(bodyData, store) {
|
|
|
44
44
|
case "code":
|
|
45
45
|
htmlSturcutre += _createCodeBlock(data, store).outerHTML;
|
|
46
46
|
break;
|
|
47
|
+
case "divider":
|
|
48
|
+
htmlSturcutre += _createDividerBlock().outerHTML;
|
|
49
|
+
break;
|
|
47
50
|
default:
|
|
48
51
|
htmlSturcutre += _createCustomBlock(data).outerHTML;
|
|
49
52
|
}
|
|
@@ -364,5 +364,17 @@ function __getBlockListStructure(store) {
|
|
|
364
364
|
"Code Block"
|
|
365
365
|
)
|
|
366
366
|
);
|
|
367
|
+
menuList.push(
|
|
368
|
+
h(
|
|
369
|
+
"button",
|
|
370
|
+
{
|
|
371
|
+
class: ["de-add-block"],
|
|
372
|
+
onClick: () => {
|
|
373
|
+
_addBlock("divider", store);
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
"Divider"
|
|
377
|
+
)
|
|
378
|
+
);
|
|
367
379
|
return h("div", { class: ["de-block-menu-area", "js-de-block-menu-area", { "--active": store.value.activeStatus.addBlockMenu }] }, h("div", { class: ["de-list"] }, menuList));
|
|
368
380
|
}
|
|
@@ -12,6 +12,7 @@ export declare function _createListItemBlock(child?: DEListItem): HTMLLIElement;
|
|
|
12
12
|
export declare function _createImageBlock(data: DEImageBlock, imageHostURL?: string): HTMLDivElement;
|
|
13
13
|
export declare function _createCodeBlock(data: DECodeBlock, store: Ref<DragonEditorStore>): HTMLDivElement;
|
|
14
14
|
export declare function _createCustomBlock(data: DECustomBlock): HTMLDivElement;
|
|
15
|
+
export declare function _createDividerBlock(): HTMLDivElement;
|
|
15
16
|
export declare function _updateCurrentBlock(event: Event, store: Ref<DragonEditorStore>): void;
|
|
16
17
|
export declare function _updateHeadingBlockList(store: Ref<DragonEditorStore>): void;
|
|
17
18
|
export declare function _setCodeBlockTheme(theme: DECodeblockTheme, store: Ref<DragonEditorStore>): Promise<void>;
|
|
@@ -21,6 +21,9 @@ export function _addBlock(type, store, data) {
|
|
|
21
21
|
case "custom":
|
|
22
22
|
$block = _createCustomBlock(blockData);
|
|
23
23
|
break;
|
|
24
|
+
case "divider":
|
|
25
|
+
$block = _createDividerBlock();
|
|
26
|
+
break;
|
|
24
27
|
}
|
|
25
28
|
if (store.value.controlStatus.$currentBlock === null) {
|
|
26
29
|
if (store.value.$body !== null) {
|
|
@@ -179,6 +182,11 @@ export function _createCustomBlock(data) {
|
|
|
179
182
|
$block.innerHTML = data.textContent;
|
|
180
183
|
return $block;
|
|
181
184
|
}
|
|
185
|
+
export function _createDividerBlock() {
|
|
186
|
+
const $block = document.createElement("div");
|
|
187
|
+
$block.classList.add("de-block", "de-divider-block");
|
|
188
|
+
return $block;
|
|
189
|
+
}
|
|
182
190
|
export function _updateCurrentBlock(event, store) {
|
|
183
191
|
let $target = event.target;
|
|
184
192
|
if ($target !== null) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { _setRangeCursor, _updateCursorData, _updateModelData, _sortingCursorDataOnElement } from "../event/index.js";
|
|
2
2
|
import { _findContentEditableElement, _findPoverTextNode } from "../node/index.js";
|
|
3
3
|
export function _setAnchorTag(url, isOutsideLink, store) {
|
|
4
|
-
console.log("url", url);
|
|
5
4
|
if (store.value.controlStatus.previousCorsorData !== null && store.value.controlStatus.$currentBlock !== null) {
|
|
6
5
|
const cursorData = store.value.controlStatus.previousCorsorData;
|
|
7
6
|
const typeIgnoreList = ["image", "code", "custom"];
|