dragon-editor 3.4.5 → 3.5.1

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.
Files changed (70) hide show
  1. package/README.md +9 -15
  2. package/dist/module.d.mts +5 -0
  3. package/dist/module.json +8 -1
  4. package/dist/module.mjs +6 -4
  5. package/dist/runtime/components/DragonEditor.vue +252 -734
  6. package/dist/runtime/components/DragonEditorViewer.vue +59 -45
  7. package/dist/runtime/scss/editor.css +83 -34
  8. package/dist/runtime/scss/viewer.css +31 -4
  9. package/dist/runtime/type.d.ts +89 -42
  10. package/dist/runtime/utils/event/block.d.ts +0 -0
  11. package/dist/runtime/utils/event/block.js +78 -0
  12. package/dist/runtime/utils/event/cursor.d.ts +0 -0
  13. package/dist/runtime/utils/{cursor.mjs → event/cursor.js} +4 -16
  14. package/dist/runtime/utils/event/data.d.ts +0 -0
  15. package/dist/runtime/utils/event/data.js +342 -0
  16. package/dist/runtime/utils/event/index.d.ts +8 -0
  17. package/dist/runtime/utils/event/index.js +8 -0
  18. package/dist/runtime/utils/event/keyboard.d.ts +0 -0
  19. package/dist/runtime/utils/event/keyboard.js +1368 -0
  20. package/dist/runtime/utils/event/mouse.d.ts +0 -0
  21. package/dist/runtime/utils/event/mouse.js +70 -0
  22. package/dist/runtime/utils/event/scroll.d.ts +0 -0
  23. package/dist/runtime/utils/event/scroll.js +29 -0
  24. package/dist/runtime/utils/event/touch.d.ts +0 -0
  25. package/dist/runtime/utils/event/touch.js +10 -0
  26. package/dist/runtime/utils/event/window.d.ts +0 -0
  27. package/dist/runtime/utils/event/window.js +32 -0
  28. package/dist/runtime/utils/layout/block.d.ts +0 -0
  29. package/dist/runtime/utils/layout/block.js +105 -0
  30. package/dist/runtime/utils/layout/body.d.ts +0 -0
  31. package/dist/runtime/utils/layout/body.js +22 -0
  32. package/dist/runtime/utils/layout/controlbar.d.ts +0 -0
  33. package/dist/runtime/utils/layout/controlbar.js +99 -0
  34. package/dist/runtime/utils/layout/icon.d.ts +0 -0
  35. package/dist/runtime/utils/layout/icon.js +156 -0
  36. package/dist/runtime/utils/layout/index.d.ts +5 -0
  37. package/dist/runtime/utils/layout/index.js +5 -0
  38. package/dist/runtime/utils/layout/menuBar.d.ts +0 -0
  39. package/dist/runtime/utils/layout/menuBar.js +358 -0
  40. package/dist/runtime/utils/node/block.d.ts +0 -0
  41. package/dist/runtime/utils/node/block.js +235 -0
  42. package/dist/runtime/utils/{element.d.ts → node/element.d.ts} +1 -0
  43. package/dist/runtime/utils/{element.mjs → node/element.js} +11 -0
  44. package/dist/runtime/utils/node/index.d.ts +2 -0
  45. package/dist/runtime/utils/node/index.js +2 -0
  46. package/dist/runtime/utils/style/anchor.d.ts +0 -0
  47. package/dist/runtime/utils/style/anchor.js +240 -0
  48. package/dist/runtime/utils/style/decoration.d.ts +0 -0
  49. package/dist/runtime/utils/style/decoration.js +378 -0
  50. package/dist/runtime/utils/style/index.d.ts +2 -0
  51. package/dist/runtime/utils/style/index.js +2 -0
  52. package/dist/types.d.mts +7 -0
  53. package/dist/types.d.ts +3 -3
  54. package/package.json +15 -16
  55. package/dist/runtime/store.d.ts +0 -11
  56. package/dist/runtime/store.mjs +0 -51
  57. package/dist/runtime/utils/block.d.ts +0 -13
  58. package/dist/runtime/utils/block.mjs +0 -144
  59. package/dist/runtime/utils/content.d.ts +0 -2
  60. package/dist/runtime/utils/content.mjs +0 -19
  61. package/dist/runtime/utils/controlBar.d.ts +0 -9
  62. package/dist/runtime/utils/controlBar.mjs +0 -172
  63. package/dist/runtime/utils/convertor.d.ts +0 -3
  64. package/dist/runtime/utils/convertor.mjs +0 -138
  65. package/dist/runtime/utils/cursor.d.ts +0 -6
  66. package/dist/runtime/utils/keyboardEvent.d.ts +0 -10
  67. package/dist/runtime/utils/keyboardEvent.mjs +0 -979
  68. package/dist/runtime/utils/style.d.ts +0 -5
  69. package/dist/runtime/utils/style.mjs +0 -617
  70. /package/dist/runtime/{plugin.mjs → plugin.js} +0 -0
@@ -0,0 +1,358 @@
1
+ import { h } from "vue";
2
+ import { _getIconNode } from "./index.js";
3
+ import { _addBlock } from "../node/index.js";
4
+ import { _setDecoration, _setTextAlign, _setAnchorTag, _unsetAnchorTag } from "../style/index.js";
5
+ import { _setIndent, _moveBlock, _openAnchorArea } from "../event/index.js";
6
+ export function _getMenuBarVNodeStructure(store) {
7
+ const childNode = [];
8
+ childNode.push(__getMenuListStructure(store));
9
+ childNode.push(__getBlockListStructure(store));
10
+ return h("div", { class: ["de-menu-bar"], style: { top: `${store.value.menuBarTop}px` } }, childNode);
11
+ }
12
+ function __getMenuListStructure(store) {
13
+ const menuGroupNode = [];
14
+ menuGroupNode.push(
15
+ h("div", { class: ["de-col"] }, [
16
+ h(
17
+ "button",
18
+ {
19
+ class: ["de-menu", "de-menu-add", "js-de-menu-add"],
20
+ onClick: () => {
21
+ store.value.activeStatus.addBlockMenu = !store.value.activeStatus.addBlockMenu;
22
+ }
23
+ },
24
+ [_getIconNode("plus")]
25
+ )
26
+ ])
27
+ );
28
+ menuGroupNode.push(
29
+ h("div", { class: ["de-col"] }, [
30
+ h(
31
+ "button",
32
+ {
33
+ class: ["de-menu"],
34
+ onClick: () => {
35
+ _setDecoration("de-bold", store);
36
+ }
37
+ },
38
+ [_getIconNode("bold")]
39
+ ),
40
+ h(
41
+ "button",
42
+ {
43
+ class: ["de-menu"],
44
+ onClick: () => {
45
+ _setDecoration("de-italic", store);
46
+ }
47
+ },
48
+ [_getIconNode("italic")]
49
+ ),
50
+ h(
51
+ "button",
52
+ {
53
+ class: ["de-menu"],
54
+ onClick: () => {
55
+ _setDecoration("de-underline", store);
56
+ }
57
+ },
58
+ [_getIconNode("underline")]
59
+ ),
60
+ h(
61
+ "button",
62
+ {
63
+ class: ["de-menu"],
64
+ onClick: () => {
65
+ _setDecoration("de-strikethrough", store);
66
+ }
67
+ },
68
+ [_getIconNode("strikethrough")]
69
+ ),
70
+ h(
71
+ "button",
72
+ {
73
+ class: ["de-menu"],
74
+ onClick: () => {
75
+ _setDecoration("de-code", store);
76
+ }
77
+ },
78
+ [_getIconNode("codeblock")]
79
+ )
80
+ ])
81
+ );
82
+ menuGroupNode.push(
83
+ h("div", { class: ["de-col"] }, [
84
+ h(
85
+ "button",
86
+ {
87
+ class: ["de-menu", "js-de-link-btn"],
88
+ onClick: () => {
89
+ _openAnchorArea(store);
90
+ }
91
+ },
92
+ [_getIconNode("add-link")]
93
+ ),
94
+ h(
95
+ "button",
96
+ {
97
+ class: ["de-menu", { "--disabled": store.value.controlStatus.anchorHref === "" }],
98
+ onClick: () => {
99
+ _unsetAnchorTag(store);
100
+ }
101
+ },
102
+ [_getIconNode("remove-link")]
103
+ ),
104
+ h("div", { class: ["de-link-exit-area", "js-de-link-exit-area", { "--active": store.value.activeStatus.anchorInputArea }] }, [
105
+ h("div", { class: ["de-btn-area"] }, [
106
+ h(
107
+ "button",
108
+ {
109
+ class: ["de-btn", { "--active": store.value.controlStatus.anchorTabType === "url" }],
110
+ onClick: () => {
111
+ store.value.controlStatus.anchorTabType = "url";
112
+ }
113
+ },
114
+ "Text"
115
+ ),
116
+ h(
117
+ "button",
118
+ {
119
+ class: ["de-btn", { "--active": store.value.controlStatus.anchorTabType === "heading" }],
120
+ onClick: () => {
121
+ store.value.controlStatus.anchorTabType = "heading";
122
+ }
123
+ },
124
+ "Heading"
125
+ )
126
+ ]),
127
+ store.value.controlStatus.anchorTabType === "url" ? h("div", { class: ["de-link-text-area"] }, [
128
+ h("input", {
129
+ class: ["de-input", { "--error": store.value.controlStatus.anchorValidation === false }],
130
+ value: store.value.controlStatus.anchorHref,
131
+ onChange: (event) => {
132
+ store.value.controlStatus.anchorHref = event.currentTarget.value;
133
+ }
134
+ }),
135
+ h("button", { class: ["de-btn"], onClick: () => {
136
+ } }, "Set")
137
+ ]) : h(
138
+ "div",
139
+ { class: ["de-link-heading-area"] },
140
+ store.value.controlStatus.anchorHeadingList.map((item) => {
141
+ return h(
142
+ "button",
143
+ {
144
+ class: ["de-btn", { "--active": store.value.controlStatus.anchorHref === `#${item.id}` }],
145
+ onClick: () => {
146
+ store.value.activeStatus.anchorInputArea = false;
147
+ _setAnchorTag(item.id, false, store);
148
+ }
149
+ },
150
+ item.name
151
+ );
152
+ })
153
+ )
154
+ ])
155
+ ])
156
+ );
157
+ menuGroupNode.push(
158
+ h("div", { class: ["de-col"] }, [
159
+ h("label", { class: ["de-menu"] }, [
160
+ h("input", {
161
+ type: "file",
162
+ hidden: true,
163
+ accept: ".jpg,.jpeg,.png,.webp,.gif",
164
+ onChange: (event) => {
165
+ const $target = event.target;
166
+ if ($target.files !== null) {
167
+ const file = $target.files[0];
168
+ store.value.emit("uploadImageEvent", file);
169
+ $target.value = "";
170
+ }
171
+ }
172
+ }),
173
+ _getIconNode("image")
174
+ ])
175
+ ])
176
+ );
177
+ menuGroupNode.push(
178
+ h("div", { class: ["de-col"] }, [
179
+ h(
180
+ "button",
181
+ {
182
+ class: ["de-menu"],
183
+ onClick: () => {
184
+ _setTextAlign("left", store);
185
+ }
186
+ },
187
+ [_getIconNode("align-left")]
188
+ ),
189
+ h(
190
+ "button",
191
+ {
192
+ class: ["de-menu"],
193
+ onClick: () => {
194
+ _setTextAlign("center", store);
195
+ }
196
+ },
197
+ [_getIconNode("align-center")]
198
+ ),
199
+ h(
200
+ "button",
201
+ {
202
+ class: ["de-menu"],
203
+ onClick: () => {
204
+ _setTextAlign("right", store);
205
+ }
206
+ },
207
+ [_getIconNode("align-right")]
208
+ ),
209
+ h(
210
+ "button",
211
+ {
212
+ class: ["de-menu"],
213
+ onClick: () => {
214
+ _setTextAlign("justify", store);
215
+ }
216
+ },
217
+ [_getIconNode("align-justify")]
218
+ )
219
+ ])
220
+ );
221
+ menuGroupNode.push(
222
+ h("div", { class: ["de-col"] }, [
223
+ h(
224
+ "button",
225
+ {
226
+ class: ["de-menu"],
227
+ onClick: () => {
228
+ _setIndent(store, "minus");
229
+ }
230
+ },
231
+ [_getIconNode("indent-decrease")]
232
+ ),
233
+ h(
234
+ "button",
235
+ {
236
+ class: ["de-menu"],
237
+ onClick: () => {
238
+ _setIndent(store, "plus");
239
+ }
240
+ },
241
+ [_getIconNode("indent-increase")]
242
+ )
243
+ ])
244
+ );
245
+ menuGroupNode.push(
246
+ h("div", { class: ["de-col"] }, [
247
+ h(
248
+ "button",
249
+ {
250
+ class: ["de-menu"],
251
+ onClick: () => {
252
+ _moveBlock("up", store);
253
+ }
254
+ },
255
+ [_getIconNode("move-up")]
256
+ ),
257
+ h(
258
+ "button",
259
+ {
260
+ class: ["de-menu"],
261
+ onClick: () => {
262
+ _moveBlock("down", store);
263
+ }
264
+ },
265
+ [_getIconNode("move-down")]
266
+ )
267
+ ])
268
+ );
269
+ return h("div", { class: ["de-menu-wrap"] }, menuGroupNode);
270
+ }
271
+ function __getBlockListStructure(store) {
272
+ const menuList = [];
273
+ menuList.push(
274
+ h(
275
+ "button",
276
+ {
277
+ class: ["de-add-block"],
278
+ onClick: () => {
279
+ _addBlock("text", store);
280
+ }
281
+ },
282
+ "Text"
283
+ )
284
+ );
285
+ menuList.push(
286
+ h(
287
+ "button",
288
+ {
289
+ class: ["de-add-block"],
290
+ onClick: () => {
291
+ _addBlock("heading1", store);
292
+ }
293
+ },
294
+ "Heading-1"
295
+ )
296
+ );
297
+ menuList.push(
298
+ h(
299
+ "button",
300
+ {
301
+ class: ["de-add-block"],
302
+ onClick: () => {
303
+ _addBlock("heading2", store);
304
+ }
305
+ },
306
+ "Heading-2"
307
+ )
308
+ );
309
+ menuList.push(
310
+ h(
311
+ "button",
312
+ {
313
+ class: ["de-add-block"],
314
+ onClick: () => {
315
+ _addBlock("heading3", store);
316
+ }
317
+ },
318
+ "Heading-3"
319
+ )
320
+ );
321
+ menuList.push(
322
+ h(
323
+ "button",
324
+ {
325
+ class: ["de-add-block"],
326
+ onClick: () => {
327
+ _addBlock("ul", store);
328
+ }
329
+ },
330
+ "Unodered List"
331
+ )
332
+ );
333
+ menuList.push(
334
+ h(
335
+ "button",
336
+ {
337
+ class: ["de-add-block"],
338
+ onClick: () => {
339
+ _addBlock("ol", store);
340
+ }
341
+ },
342
+ "Odered List"
343
+ )
344
+ );
345
+ menuList.push(
346
+ h(
347
+ "button",
348
+ {
349
+ class: ["de-add-block"],
350
+ onClick: () => {
351
+ _addBlock("code", store);
352
+ }
353
+ },
354
+ "Code Block"
355
+ )
356
+ );
357
+ return h("div", { class: ["de-block-menu-area", "js-de-block-menu-area", { "--active": store.value.activeStatus.addBlockMenu }] }, h("div", { class: ["de-list"] }, menuList));
358
+ }
File without changes
@@ -0,0 +1,235 @@
1
+ import { _getDefaultBlockData, _generateId, _updateModelData, _updateCursorData, _decideWhetherOpenControlBar, _updateControlBarStatus, CODEBLOCKLANG } from "../event/index.js";
2
+ import hljs from "highlight.js";
3
+ export function _addBlock(type, store, data) {
4
+ const blockData = data === void 0 ? _getDefaultBlockData(type) : data;
5
+ let $block = _createTextBlock(_getDefaultBlockData("text"));
6
+ switch (blockData.type) {
7
+ case "text":
8
+ $block = _createTextBlock(blockData);
9
+ break;
10
+ case "heading":
11
+ $block = _createHeadingBlock(blockData);
12
+ break;
13
+ case "image":
14
+ $block = _createImageBlock(blockData, store.value.imageHostURL);
15
+ break;
16
+ case "list":
17
+ $block = _createListBlock(blockData);
18
+ break;
19
+ case "code":
20
+ $block = _createCodeBlock(blockData, store);
21
+ break;
22
+ case "custom":
23
+ $block = _createCustomBlock(blockData);
24
+ break;
25
+ }
26
+ if (store.value.controlStatus.$currentBlock === null) {
27
+ if (store.value.$body !== null) {
28
+ store.value.$body.insertAdjacentElement("beforeend", $block);
29
+ } else {
30
+ }
31
+ } else {
32
+ store.value.controlStatus.$currentBlock.insertAdjacentElement("afterend", $block);
33
+ }
34
+ if (blockData.type === "list") {
35
+ $block.children[0].focus();
36
+ } else if (blockData.type === "code") {
37
+ $block.querySelector(".de-code-content").focus();
38
+ } else if (blockData.type === "text" || blockData.type === "heading") {
39
+ $block.focus();
40
+ } else if (blockData.type === "image") {
41
+ $block.querySelector(".de-caption").focus();
42
+ }
43
+ const { type: blockType, $element } = _getCurrentBlock($block);
44
+ store.value.activeStatus.addBlockMenu = false;
45
+ store.value.controlStatus.currentBlockType = blockType;
46
+ store.value.controlStatus.$currentBlock = $element;
47
+ _updateModelData(store);
48
+ _updateCursorData(store);
49
+ _decideWhetherOpenControlBar(store);
50
+ }
51
+ export function _getCurrentBlock($target) {
52
+ const $block = $target.closest(".de-block");
53
+ let typeName = "text";
54
+ if ($block !== null) {
55
+ switch (true) {
56
+ case $block.classList.contains("de-text-block"):
57
+ typeName = "text";
58
+ break;
59
+ case $block.classList.contains("de-heading-block"):
60
+ typeName = "heading";
61
+ break;
62
+ case $block.classList.contains("de-list-block"):
63
+ if ($block.tagName === "OL") {
64
+ typeName = "ol";
65
+ } else {
66
+ typeName = "ul";
67
+ }
68
+ break;
69
+ case $block.classList.contains("de-image-block"):
70
+ typeName = "image";
71
+ break;
72
+ case $block.classList.contains("de-code-block"):
73
+ typeName = "code";
74
+ break;
75
+ default:
76
+ typeName = "custom";
77
+ }
78
+ }
79
+ return {
80
+ type: typeName,
81
+ $element: $block
82
+ };
83
+ }
84
+ export function _createTextBlock(data) {
85
+ const $paragraph = document.createElement("p");
86
+ $paragraph.classList.add("de-block", "de-text-block", ...data.classList);
87
+ $paragraph.setAttribute("contenteditable", "true");
88
+ $paragraph.innerHTML = data.textContent;
89
+ return $paragraph;
90
+ }
91
+ export function _createHeadingBlock(data) {
92
+ const $headingBlock = document.createElement(`h${data.level}`);
93
+ if (data.id === "") {
94
+ $headingBlock.id = _generateId();
95
+ } else {
96
+ $headingBlock.id = data.id;
97
+ }
98
+ $headingBlock.classList.add("de-block", "de-heading-block", ...data.classList);
99
+ $headingBlock.dataset["level"] = String(data.level);
100
+ $headingBlock.setAttribute("contenteditable", "true");
101
+ $headingBlock.innerHTML = data.textContent;
102
+ return $headingBlock;
103
+ }
104
+ export function _createListBlock(data) {
105
+ const $block = document.createElement(data.element);
106
+ $block.classList.add("de-block", "de-list-block");
107
+ $block.dataset["style"] = data.style;
108
+ data.child.forEach((child) => {
109
+ $block.appendChild(_createListItemBlock(child));
110
+ });
111
+ return $block;
112
+ }
113
+ export function _createListItemBlock(child = { textContent: "", classList: [] }) {
114
+ const $li = document.createElement("li");
115
+ $li.classList.add("de-item", ...child.classList);
116
+ $li.setAttribute("contenteditable", "true");
117
+ $li.innerHTML = child.textContent;
118
+ return $li;
119
+ }
120
+ export function _createImageBlock(data, imageHostURL = "") {
121
+ const $wrap = document.createElement("div");
122
+ const $div = document.createElement("div");
123
+ const $leftBtn = document.createElement("button");
124
+ const $rightBtn = document.createElement("button");
125
+ const $image = document.createElement("img");
126
+ const $p = document.createElement("p");
127
+ $wrap.classList.add("de-block", "de-image-block", ...data.classList);
128
+ $div.classList.add("de-image-area");
129
+ $leftBtn.classList.add("de-btn", "de-btn-left");
130
+ $rightBtn.classList.add("de-btn", "de-btn-right");
131
+ $image.classList.add("de-img");
132
+ $p.contentEditable = "true";
133
+ $p.classList.add("de-caption");
134
+ if (data.width / data.height < 1) {
135
+ $div.dataset["maxwidth"] = "40";
136
+ } else {
137
+ $div.dataset["maxwidth"] = String(data.maxWidth);
138
+ }
139
+ $image.src = imageHostURL + data.src;
140
+ $image.width = data.width;
141
+ $image.height = data.height;
142
+ $image.draggable = false;
143
+ if (data.caption !== void 0) {
144
+ $p.textContent = data.caption;
145
+ }
146
+ $div.appendChild($image);
147
+ $div.appendChild($leftBtn);
148
+ $div.appendChild($rightBtn);
149
+ $wrap.appendChild($div);
150
+ $wrap.appendChild($p);
151
+ return $wrap;
152
+ }
153
+ export function _createCodeBlock(data, store) {
154
+ const $wrap = document.createElement("div");
155
+ const $file = document.createElement("p");
156
+ const $lang = document.createElement("p");
157
+ const $pre = document.createElement("pre");
158
+ const $code = document.createElement("code");
159
+ const targetValue = CODEBLOCKLANG.find((item) => item.code === data.language);
160
+ $wrap.classList.add("de-block", "de-code-block");
161
+ $wrap.dataset["theme"] = data.theme;
162
+ $file.contentEditable = "true";
163
+ $file.classList.add("de-filename");
164
+ $file.textContent = data.filename;
165
+ $lang.textContent = targetValue?.text ?? "Plan Text";
166
+ $lang.classList.add("de-language");
167
+ $pre.classList.add("de-pre");
168
+ $code.contentEditable = "true";
169
+ $code.classList.add("de-code-content");
170
+ $code.innerHTML = data.textContent;
171
+ $pre.appendChild($code);
172
+ $wrap.appendChild($file);
173
+ $wrap.appendChild($lang);
174
+ $wrap.appendChild($pre);
175
+ return $wrap;
176
+ }
177
+ export function _createCustomBlock(data) {
178
+ const $block = document.createElement("div");
179
+ $block.classList.add("de-block", "de-custom-block", ...data.classList);
180
+ $block.innerHTML = data.textContent;
181
+ return $block;
182
+ }
183
+ export function _updateCurrentBlock(event, store) {
184
+ let $target = event.target;
185
+ if ($target !== null) {
186
+ $target = $target.constructor.name === "Text" ? $target.parentElement : $target;
187
+ const $menuBar = $target.closest(".de-menu-bar");
188
+ const $controlBar = $target.closest(".js-de-controlbar");
189
+ if ($menuBar === null && $controlBar === null) {
190
+ const { type, $element } = _getCurrentBlock($target);
191
+ store.value.controlStatus.currentBlockType = type;
192
+ store.value.controlStatus.$currentBlock = $element;
193
+ _decideWhetherOpenControlBar(store);
194
+ _updateControlBarStatus(store);
195
+ }
196
+ }
197
+ }
198
+ export function _updateHeadingBlockList(store) {
199
+ if (store.value.$body !== null) {
200
+ const $headingList = store.value.$body.querySelectorAll(".de-heading-block");
201
+ store.value.controlStatus.anchorHeadingList = Array.from($headingList).map(($element) => {
202
+ return {
203
+ name: $element.textContent ?? "",
204
+ id: $element.id ?? ""
205
+ };
206
+ });
207
+ }
208
+ }
209
+ export function _setCodeBlockTheme(theme, store) {
210
+ if (store.value.controlStatus.$currentBlock !== null) {
211
+ store.value.controlStatus.codeBlockTheme = theme;
212
+ store.value.controlStatus.$currentBlock.dataset["theme"] = theme;
213
+ }
214
+ }
215
+ export function _setCodeBlockLanguage(language, store) {
216
+ if (store.value.controlStatus.$currentBlock !== null) {
217
+ const $target = store.value.controlStatus.$currentBlock.querySelector(".de-language");
218
+ const $code = store.value.controlStatus.$currentBlock.querySelector(".de-code-content");
219
+ if ($target !== null && $code !== null) {
220
+ const targetValue = CODEBLOCKLANG.find((item) => item.code === language);
221
+ if (targetValue !== void 0) {
222
+ const convert = hljs.highlight($code.textContent ?? "", { language });
223
+ $target.textContent = targetValue.text;
224
+ $code.innerHTML = convert.value;
225
+ store.value.controlStatus.codeBlockLang = targetValue.code;
226
+ }
227
+ }
228
+ }
229
+ }
230
+ export function _setListBlockStyle(style, store) {
231
+ if (store.value.controlStatus.$currentBlock !== null) {
232
+ store.value.controlStatus.listBlockStyle = style;
233
+ store.value.controlStatus.$currentBlock.dataset["style"] = style;
234
+ }
235
+ }
@@ -1,3 +1,4 @@
1
1
  export declare function _findScrollingElement($target: HTMLElement): HTMLElement | Window;
2
2
  export declare function _getParentElementIfNodeIsText($target: Node, $block: HTMLElement): Node;
3
3
  export declare function _findContentEditableElement($target: Node): HTMLElement | null;
4
+ export declare function _findPoverTextNode(node: Element, idx: number): number;
@@ -41,3 +41,14 @@ export function _findContentEditableElement($target) {
41
41
  }
42
42
  }
43
43
  }
44
+ export function _findPoverTextNode(node, idx) {
45
+ if (node.previousSibling !== null) {
46
+ if (node.previousSibling.constructor.name === "Text") {
47
+ return _findPoverTextNode(node.previousSibling, idx -= 1);
48
+ } else {
49
+ return idx;
50
+ }
51
+ } else {
52
+ return idx;
53
+ }
54
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./element.js";
2
+ export * from "./block.js";
@@ -0,0 +1,2 @@
1
+ export * from "./element.js";
2
+ export * from "./block.js";
File without changes