|
@@ -351,14 +351,6 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (blockElement.getAttribute("data-type") === "NodeHeading") {
|
|
|
|
- turnsIntoTransaction({
|
|
|
|
- protyle: protyle,
|
|
|
|
- selectsElement: [blockElement],
|
|
|
|
- type: "Blocks2Ps",
|
|
|
|
- });
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
if (!blockElement.previousElementSibling && blockElement.parentElement.getAttribute("data-type") === "NodeBlockquote") {
|
|
if (!blockElement.previousElementSibling && blockElement.parentElement.getAttribute("data-type") === "NodeBlockquote") {
|
|
range.insertNode(document.createElement("wbr"));
|
|
range.insertNode(document.createElement("wbr"));
|
|
const blockParentElement = blockElement.parentElement;
|
|
const blockParentElement = blockElement.parentElement;
|
|
@@ -404,7 +396,15 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
|
|
removeLi(protyle, blockElement, range, type === "Delete");
|
|
removeLi(protyle, blockElement, range, type === "Delete");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ if (blockElement.getAttribute("data-type") === "NodeHeading") {
|
|
|
|
+ turnsIntoTransaction({
|
|
|
|
+ protyle: protyle,
|
|
|
|
+ selectsElement: [blockElement],
|
|
|
|
+ type: "Blocks2Ps",
|
|
|
|
+ range: moveToPrevious(blockElement, range, type === "Delete")
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if (blockElement.previousElementSibling && blockElement.previousElementSibling.classList.contains("protyle-breadcrumb__bar")) {
|
|
if (blockElement.previousElementSibling && blockElement.previousElementSibling.classList.contains("protyle-breadcrumb__bar")) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -558,14 +558,14 @@ export const moveToPrevious = (blockElement: Element, range: Range, isDelete: bo
|
|
if (previousBlockElement) {
|
|
if (previousBlockElement) {
|
|
const previousEditElement = getContenteditableElement(getLastBlock(previousBlockElement));
|
|
const previousEditElement = getContenteditableElement(getLastBlock(previousBlockElement));
|
|
if (previousEditElement) {
|
|
if (previousEditElement) {
|
|
- setLastNodeRange(previousEditElement, range, false);
|
|
|
|
|
|
+ return setLastNodeRange(previousEditElement, range, false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
// https://github.com/siyuan-note/siyuan/issues/10393
|
|
// https://github.com/siyuan-note/siyuan/issues/10393
|
|
-export const removeImage = (imgSelectElement: Element, nodeElement:HTMLElement, range:Range, protyle:IProtyle) => {
|
|
|
|
|
|
+export const removeImage = (imgSelectElement: Element, nodeElement: HTMLElement, range: Range, protyle: IProtyle) => {
|
|
const oldHTML = nodeElement.outerHTML;
|
|
const oldHTML = nodeElement.outerHTML;
|
|
const imgPreviousSibling = hasPreviousSibling(imgSelectElement);
|
|
const imgPreviousSibling = hasPreviousSibling(imgSelectElement);
|
|
if (imgPreviousSibling && imgPreviousSibling.textContent.endsWith(Constants.ZWSP)) {
|
|
if (imgPreviousSibling && imgPreviousSibling.textContent.endsWith(Constants.ZWSP)) {
|