Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://ld246.com/article/1653490331030?r=88250

Vanessae92c8e95c9e8
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.ts
index 23a181eed5..2f0afbbe47 100644
--- a/app/src/protyle/wysiwyg/remove.ts
+++ b/app/src/protyle/wysiwyg/remove.ts
@@ -185,7 +185,7 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
topElementId = topElement.getAttribute("data-node-id");
if (topElement.parentElement.classList.contains("protyle-wysiwyg") && topElement.getAttribute("data-type") === "NodeListItem") {
// 缩放后列表项不能全选删除
- return;
+ return true;
}
const id = topElement.getAttribute("data-node-id");
deletes.push({
@@ -235,24 +235,25 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
topElement.remove();
}
});
- if ((sideElement.classList.contains("protyle-wysiwyg") && protyle.wysiwyg.element.childElementCount === 0) ||
- ((sideElement.classList.contains("bq") || sideElement.classList.contains("sb")) && sideElement.childElementCount === 1)) {
- const emptyElement = genEmptyElement(false, true, topElementId);
- sideElement.insertAdjacentElement("afterbegin", emptyElement);
- deletes.push({
- action: "insert",
- data: emptyElement.outerHTML,
- id: topElementId,
- parentID: sideElement.getAttribute("data-node-id") || protyle.block.parentID
- });
- inserts.push({
- action: "delete",
- id: topElementId,
- });
- sideElement = undefined;
- focusByWbr(emptyElement, range);
- }
if (sideElement) {
+ if ((sideElement.classList.contains("protyle-wysiwyg") && protyle.wysiwyg.element.childElementCount === 0) ||
+ ((sideElement.classList.contains("bq") || sideElement.classList.contains("sb")) && sideElement.childElementCount === 1)) {
+ const emptyElement = genEmptyElement(false, true, topElementId);
+ sideElement.insertAdjacentElement("afterbegin", emptyElement);
+ deletes.push({
+ action: "insert",
+ data: emptyElement.outerHTML,
+ id: topElementId,
+ parentID: sideElement.getAttribute("data-node-id") || protyle.block.parentID
+ });
+ inserts.push({
+ action: "delete",
+ id: topElementId,
+ });
+ sideElement = undefined;
+ focusByWbr(emptyElement, range);
+ }
+
focusBlock(sideElement, undefined, false);
if (listElement) {
inserts.push({
@@ -268,7 +269,9 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran
});
}
}
- transaction(protyle, deletes, inserts.reverse());
+ if (deletes.length > 0) {
+ transaction(protyle, deletes, inserts.reverse());
+ }
hideElements(["util"], protyle);
return;
}