dragon-editor 3.4.4 → 3.4.5
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
|
@@ -397,9 +397,23 @@ function checkOthersideClick(event: MouseEvent) {
|
|
|
397
397
|
function deleteBlock() {
|
|
398
398
|
if (editorStore.$currentBlock !== null) {
|
|
399
399
|
const childCount: number = editorStore.$content?.childElementCount ?? 1;
|
|
400
|
+
const preElement = editorStore.$currentBlock.previousElementSibling;
|
|
400
401
|
|
|
401
402
|
editorStore.$currentBlock.remove();
|
|
402
|
-
|
|
403
|
+
|
|
404
|
+
if (preElement === null) {
|
|
405
|
+
editorStore.setCurrentBlock(null);
|
|
406
|
+
} else {
|
|
407
|
+
const { type } = _getBlockType(editorStore.$currentBlock);
|
|
408
|
+
const activeList = ["text", "heading"];
|
|
409
|
+
|
|
410
|
+
if (activeList.includes(type) === true) {
|
|
411
|
+
editorStore.setCurrentBlock(preElement as HTMLElement);
|
|
412
|
+
_setCursor(preElement, 0);
|
|
413
|
+
} else {
|
|
414
|
+
editorStore.setCurrentBlock(null);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
403
417
|
|
|
404
418
|
if (childCount < 2) {
|
|
405
419
|
// 모든 엘리먼트를 지우려는 경우
|
|
@@ -27,13 +27,17 @@ export function _findContentEditableElement($target) {
|
|
|
27
27
|
$target = $target.parentNode;
|
|
28
28
|
}
|
|
29
29
|
const $baseElement = $target;
|
|
30
|
-
if ($baseElement.parentElement
|
|
30
|
+
if ($baseElement.parentElement === null) {
|
|
31
31
|
return null;
|
|
32
32
|
} else {
|
|
33
|
-
if ($baseElement.
|
|
34
|
-
return
|
|
33
|
+
if ($baseElement.parentElement.tagName === "BODY") {
|
|
34
|
+
return null;
|
|
35
35
|
} else {
|
|
36
|
-
|
|
36
|
+
if ($baseElement.getAttribute("contentEditable") === null) {
|
|
37
|
+
return _findContentEditableElement($baseElement.parentNode);
|
|
38
|
+
} else {
|
|
39
|
+
return $baseElement;
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
}
|
|
@@ -135,9 +135,10 @@ function defaultBlockEnterEvent(store, $element) {
|
|
|
135
135
|
$textBlock.insertAdjacentElement("afterend", $newTextBlock);
|
|
136
136
|
$newTextBlock.focus();
|
|
137
137
|
} else {
|
|
138
|
+
const brList = $textBlock.querySelectorAll("br");
|
|
138
139
|
let preStructure = [];
|
|
139
140
|
let nextStructure = [];
|
|
140
|
-
|
|
141
|
+
brList.forEach((_, i) => {
|
|
141
142
|
const $br = document.createElement("br");
|
|
142
143
|
if (store.cursorData.startOffset < i) {
|
|
143
144
|
preStructure.push($br);
|