dragon-editor 3.7.2 → 3.7.3
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { _setCodeBlockStatus, _setListBlockStyle } from "../node/index.js";
|
|
3
3
|
import { CODEBLOCKLANG } from "../event/index.js";
|
|
4
4
|
export function _getControlbarVNodeStructure(store) {
|
|
5
5
|
const childList = [];
|
|
@@ -16,7 +16,7 @@ export function _getControlbarVNodeStructure(store) {
|
|
|
16
16
|
onChange: (event) => {
|
|
17
17
|
const $target = event.currentTarget;
|
|
18
18
|
if ($target !== null) {
|
|
19
|
-
|
|
19
|
+
_setCodeBlockStatus($target.value, store.value.controlStatus.codeBlockLang, store);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
},
|
|
@@ -37,7 +37,7 @@ export function _getControlbarVNodeStructure(store) {
|
|
|
37
37
|
onChange: (event) => {
|
|
38
38
|
const $target = event.currentTarget;
|
|
39
39
|
if ($target !== null) {
|
|
40
|
-
|
|
40
|
+
_setCodeBlockStatus(store.value.controlStatus.codeBlockTheme, $target.value, store);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
},
|
|
@@ -14,6 +14,7 @@ export function _getMenuBarVNodeStructure(store) {
|
|
|
14
14
|
"button",
|
|
15
15
|
{
|
|
16
16
|
class: ["de-btn", { "--active": store.value.controlStatus.anchorTabType === "url" }],
|
|
17
|
+
type: "button",
|
|
17
18
|
onClick: () => {
|
|
18
19
|
store.value.controlStatus.anchorTabType = "url";
|
|
19
20
|
}
|
|
@@ -24,6 +25,7 @@ export function _getMenuBarVNodeStructure(store) {
|
|
|
24
25
|
"button",
|
|
25
26
|
{
|
|
26
27
|
class: ["de-btn", { "--active": store.value.controlStatus.anchorTabType === "heading" }],
|
|
28
|
+
type: "button",
|
|
27
29
|
onClick: () => {
|
|
28
30
|
store.value.controlStatus.anchorTabType = "heading";
|
|
29
31
|
}
|
|
@@ -43,6 +45,7 @@ export function _getMenuBarVNodeStructure(store) {
|
|
|
43
45
|
"button",
|
|
44
46
|
{
|
|
45
47
|
class: ["de-btn"],
|
|
48
|
+
type: "button",
|
|
46
49
|
onClick: () => {
|
|
47
50
|
_setAnchorTag(store.value.controlStatus.anchorHref, true, store);
|
|
48
51
|
}
|
|
@@ -57,6 +60,7 @@ export function _getMenuBarVNodeStructure(store) {
|
|
|
57
60
|
"button",
|
|
58
61
|
{
|
|
59
62
|
class: ["de-btn", { "--active": store.value.controlStatus.anchorHref === `#${item.id}` }],
|
|
63
|
+
type: "button",
|
|
60
64
|
onClick: () => {
|
|
61
65
|
store.value.activeStatus.anchorInputArea = false;
|
|
62
66
|
_setAnchorTag(item.id, false, store);
|
|
@@ -78,6 +82,7 @@ function __getMenuListStructure(store) {
|
|
|
78
82
|
"button",
|
|
79
83
|
{
|
|
80
84
|
class: ["de-menu", "de-menu-add", "js-de-menu-add"],
|
|
85
|
+
type: "button",
|
|
81
86
|
onClick: () => {
|
|
82
87
|
store.value.activeStatus.addBlockMenu = !store.value.activeStatus.addBlockMenu;
|
|
83
88
|
}
|
|
@@ -92,6 +97,7 @@ function __getMenuListStructure(store) {
|
|
|
92
97
|
"button",
|
|
93
98
|
{
|
|
94
99
|
class: ["de-menu"],
|
|
100
|
+
type: "button",
|
|
95
101
|
onClick: () => {
|
|
96
102
|
_setDecoration("de-bold", store);
|
|
97
103
|
}
|
|
@@ -102,6 +108,7 @@ function __getMenuListStructure(store) {
|
|
|
102
108
|
"button",
|
|
103
109
|
{
|
|
104
110
|
class: ["de-menu"],
|
|
111
|
+
type: "button",
|
|
105
112
|
onClick: () => {
|
|
106
113
|
_setDecoration("de-italic", store);
|
|
107
114
|
}
|
|
@@ -112,6 +119,7 @@ function __getMenuListStructure(store) {
|
|
|
112
119
|
"button",
|
|
113
120
|
{
|
|
114
121
|
class: ["de-menu"],
|
|
122
|
+
type: "button",
|
|
115
123
|
onClick: () => {
|
|
116
124
|
_setDecoration("de-underline", store);
|
|
117
125
|
}
|
|
@@ -122,6 +130,7 @@ function __getMenuListStructure(store) {
|
|
|
122
130
|
"button",
|
|
123
131
|
{
|
|
124
132
|
class: ["de-menu"],
|
|
133
|
+
type: "button",
|
|
125
134
|
onClick: () => {
|
|
126
135
|
_setDecoration("de-strikethrough", store);
|
|
127
136
|
}
|
|
@@ -132,6 +141,7 @@ function __getMenuListStructure(store) {
|
|
|
132
141
|
"button",
|
|
133
142
|
{
|
|
134
143
|
class: ["de-menu"],
|
|
144
|
+
type: "button",
|
|
135
145
|
onClick: () => {
|
|
136
146
|
_setDecoration("de-code", store);
|
|
137
147
|
}
|
|
@@ -146,6 +156,7 @@ function __getMenuListStructure(store) {
|
|
|
146
156
|
"button",
|
|
147
157
|
{
|
|
148
158
|
class: ["de-menu", "js-de-link-btn"],
|
|
159
|
+
type: "button",
|
|
149
160
|
onClick: (event) => {
|
|
150
161
|
_openAnchorArea(event, store);
|
|
151
162
|
}
|
|
@@ -156,6 +167,7 @@ function __getMenuListStructure(store) {
|
|
|
156
167
|
"button",
|
|
157
168
|
{
|
|
158
169
|
class: ["de-menu", { "--disabled": store.value.controlStatus.anchorHref === "" }],
|
|
170
|
+
type: "button",
|
|
159
171
|
onClick: () => {
|
|
160
172
|
_unsetAnchorTag(store);
|
|
161
173
|
}
|
|
@@ -190,6 +202,7 @@ function __getMenuListStructure(store) {
|
|
|
190
202
|
"button",
|
|
191
203
|
{
|
|
192
204
|
class: ["de-menu"],
|
|
205
|
+
type: "button",
|
|
193
206
|
onClick: () => {
|
|
194
207
|
_setTextAlign("left", store);
|
|
195
208
|
}
|
|
@@ -200,6 +213,7 @@ function __getMenuListStructure(store) {
|
|
|
200
213
|
"button",
|
|
201
214
|
{
|
|
202
215
|
class: ["de-menu"],
|
|
216
|
+
type: "button",
|
|
203
217
|
onClick: () => {
|
|
204
218
|
_setTextAlign("center", store);
|
|
205
219
|
}
|
|
@@ -210,6 +224,7 @@ function __getMenuListStructure(store) {
|
|
|
210
224
|
"button",
|
|
211
225
|
{
|
|
212
226
|
class: ["de-menu"],
|
|
227
|
+
type: "button",
|
|
213
228
|
onClick: () => {
|
|
214
229
|
_setTextAlign("right", store);
|
|
215
230
|
}
|
|
@@ -220,6 +235,7 @@ function __getMenuListStructure(store) {
|
|
|
220
235
|
"button",
|
|
221
236
|
{
|
|
222
237
|
class: ["de-menu"],
|
|
238
|
+
type: "button",
|
|
223
239
|
onClick: () => {
|
|
224
240
|
_setTextAlign("justify", store);
|
|
225
241
|
}
|
|
@@ -234,6 +250,7 @@ function __getMenuListStructure(store) {
|
|
|
234
250
|
"button",
|
|
235
251
|
{
|
|
236
252
|
class: ["de-menu"],
|
|
253
|
+
type: "button",
|
|
237
254
|
onClick: () => {
|
|
238
255
|
_setIndent(store, "minus");
|
|
239
256
|
}
|
|
@@ -244,6 +261,7 @@ function __getMenuListStructure(store) {
|
|
|
244
261
|
"button",
|
|
245
262
|
{
|
|
246
263
|
class: ["de-menu"],
|
|
264
|
+
type: "button",
|
|
247
265
|
onClick: () => {
|
|
248
266
|
_setIndent(store, "plus");
|
|
249
267
|
}
|
|
@@ -258,6 +276,7 @@ function __getMenuListStructure(store) {
|
|
|
258
276
|
"button",
|
|
259
277
|
{
|
|
260
278
|
class: ["de-menu"],
|
|
279
|
+
type: "button",
|
|
261
280
|
onClick: () => {
|
|
262
281
|
_moveBlock("up", store);
|
|
263
282
|
}
|
|
@@ -268,6 +287,7 @@ function __getMenuListStructure(store) {
|
|
|
268
287
|
"button",
|
|
269
288
|
{
|
|
270
289
|
class: ["de-menu"],
|
|
290
|
+
type: "button",
|
|
271
291
|
onClick: () => {
|
|
272
292
|
_moveBlock("down", store);
|
|
273
293
|
}
|
|
@@ -285,6 +305,7 @@ function __getBlockListStructure(store) {
|
|
|
285
305
|
"button",
|
|
286
306
|
{
|
|
287
307
|
class: ["de-add-block"],
|
|
308
|
+
type: "button",
|
|
288
309
|
onClick: () => {
|
|
289
310
|
_addBlock("text", store);
|
|
290
311
|
}
|
|
@@ -297,6 +318,7 @@ function __getBlockListStructure(store) {
|
|
|
297
318
|
"button",
|
|
298
319
|
{
|
|
299
320
|
class: ["de-add-block"],
|
|
321
|
+
type: "button",
|
|
300
322
|
onClick: () => {
|
|
301
323
|
_addBlock("heading1", store);
|
|
302
324
|
}
|
|
@@ -309,6 +331,7 @@ function __getBlockListStructure(store) {
|
|
|
309
331
|
"button",
|
|
310
332
|
{
|
|
311
333
|
class: ["de-add-block"],
|
|
334
|
+
type: "button",
|
|
312
335
|
onClick: () => {
|
|
313
336
|
_addBlock("heading2", store);
|
|
314
337
|
}
|
|
@@ -321,6 +344,7 @@ function __getBlockListStructure(store) {
|
|
|
321
344
|
"button",
|
|
322
345
|
{
|
|
323
346
|
class: ["de-add-block"],
|
|
347
|
+
type: "button",
|
|
324
348
|
onClick: () => {
|
|
325
349
|
_addBlock("heading3", store);
|
|
326
350
|
}
|
|
@@ -333,6 +357,7 @@ function __getBlockListStructure(store) {
|
|
|
333
357
|
"button",
|
|
334
358
|
{
|
|
335
359
|
class: ["de-add-block"],
|
|
360
|
+
type: "button",
|
|
336
361
|
onClick: () => {
|
|
337
362
|
_addBlock("ul", store);
|
|
338
363
|
}
|
|
@@ -345,6 +370,7 @@ function __getBlockListStructure(store) {
|
|
|
345
370
|
"button",
|
|
346
371
|
{
|
|
347
372
|
class: ["de-add-block"],
|
|
373
|
+
type: "button",
|
|
348
374
|
onClick: () => {
|
|
349
375
|
_addBlock("ol", store);
|
|
350
376
|
}
|
|
@@ -357,6 +383,7 @@ function __getBlockListStructure(store) {
|
|
|
357
383
|
"button",
|
|
358
384
|
{
|
|
359
385
|
class: ["de-add-block"],
|
|
386
|
+
type: "button",
|
|
360
387
|
onClick: () => {
|
|
361
388
|
_addBlock("code", store);
|
|
362
389
|
}
|
|
@@ -369,6 +396,7 @@ function __getBlockListStructure(store) {
|
|
|
369
396
|
"button",
|
|
370
397
|
{
|
|
371
398
|
class: ["de-add-block"],
|
|
399
|
+
type: "button",
|
|
372
400
|
onClick: () => {
|
|
373
401
|
_addBlock("divider", store);
|
|
374
402
|
}
|
|
@@ -15,6 +15,5 @@ export declare function _createCustomBlock(data: DECustomBlock): HTMLDivElement;
|
|
|
15
15
|
export declare function _createDividerBlock(): HTMLDivElement;
|
|
16
16
|
export declare function _updateCurrentBlock(event: Event, store: Ref<DragonEditorStore>): void;
|
|
17
17
|
export declare function _updateHeadingBlockList(store: Ref<DragonEditorStore>): void;
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function _setCodeBlockLanguage(language: DECodeblockLang, store: Ref<DragonEditorStore>): Promise<void>;
|
|
18
|
+
export declare function _setCodeBlockStatus(theme: DECodeblockTheme, language: DECodeblockLang, store: Ref<DragonEditorStore>): Promise<void>;
|
|
20
19
|
export declare function _setListBlockStyle(style: DEListStyle, store: Ref<DragonEditorStore>): void;
|
|
@@ -213,33 +213,14 @@ export function _updateHeadingBlockList(store) {
|
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
export async function
|
|
217
|
-
if (store.value.controlStatus.$currentBlock !== null) {
|
|
218
|
-
const $target = store.value.controlStatus.$currentBlock.querySelector(".de-language");
|
|
219
|
-
const $code = store.value.controlStatus.$currentBlock.querySelector(".de-code-content");
|
|
220
|
-
if ($target !== null && $code !== null) {
|
|
221
|
-
const convert = await store.value.codeToHtml($code.textContent ?? "", { lang: store.value.controlStatus.codeBlockLang, theme });
|
|
222
|
-
const $div = document.createElement("div");
|
|
223
|
-
$div.innerHTML = convert;
|
|
224
|
-
const $childCode = $div.querySelector("code");
|
|
225
|
-
if ($childCode !== null) {
|
|
226
|
-
$code.innerHTML = $childCode.innerHTML;
|
|
227
|
-
store.value.controlStatus.codeBlockTheme = theme;
|
|
228
|
-
store.value.controlStatus.$currentBlock.dataset["theme"] = theme;
|
|
229
|
-
}
|
|
230
|
-
_updateCursorData(store);
|
|
231
|
-
_updateModelData(store);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
export async function _setCodeBlockLanguage(language, store) {
|
|
216
|
+
export async function _setCodeBlockStatus(theme, language, store) {
|
|
236
217
|
if (store.value.controlStatus.$currentBlock !== null) {
|
|
237
218
|
const $target = store.value.controlStatus.$currentBlock.querySelector(".de-language");
|
|
238
219
|
const $code = store.value.controlStatus.$currentBlock.querySelector(".de-code-content");
|
|
239
220
|
if ($target !== null && $code !== null) {
|
|
240
221
|
const targetValue = CODEBLOCKLANG.find((item) => item.code === language);
|
|
241
222
|
if (targetValue !== void 0) {
|
|
242
|
-
const convert = await store.value.codeToHtml($code.textContent ?? "", { lang: language, theme
|
|
223
|
+
const convert = await store.value.codeToHtml($code.textContent ?? "", { lang: language, theme });
|
|
243
224
|
const $div = document.createElement("div");
|
|
244
225
|
$div.innerHTML = convert;
|
|
245
226
|
const $childCode = $div.querySelector("code");
|
|
@@ -247,6 +228,8 @@ export async function _setCodeBlockLanguage(language, store) {
|
|
|
247
228
|
$target.textContent = targetValue.text;
|
|
248
229
|
$code.innerHTML = $childCode.innerHTML;
|
|
249
230
|
store.value.controlStatus.codeBlockLang = targetValue.code;
|
|
231
|
+
store.value.controlStatus.codeBlockTheme = theme;
|
|
232
|
+
store.value.controlStatus.$currentBlock.dataset["theme"] = theme;
|
|
250
233
|
_updateCursorData(store);
|
|
251
234
|
_updateModelData(store);
|
|
252
235
|
}
|