An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/10592
Vanessa20e6445f86f7
diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.tsindex 01a50cea87..a556b57f48 100644--- a/app/src/protyle/wysiwyg/remove.ts+++ b/app/src/protyle/wysiwyg/remove.ts@@ -351,14 +351,6 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran}return;}- if (blockElement.getAttribute("data-type") === "NodeHeading") {- turnsIntoTransaction({- protyle: protyle,- selectsElement: [blockElement],- type: "Blocks2Ps",- });- return;- }if (!blockElement.previousElementSibling && blockElement.parentElement.getAttribute("data-type") === "NodeBlockquote") {range.insertNode(document.createElement("wbr"));const blockParentElement = blockElement.parentElement;@@ -404,7 +396,15 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: RanremoveLi(protyle, blockElement, range, type === "Delete");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")) {return;}@@ -558,14 +558,14 @@ export const moveToPrevious = (blockElement: Element, range: Range, isDelete: boif (previousBlockElement) {const previousEditElement = getContenteditableElement(getLastBlock(previousBlockElement));if (previousEditElement) {- setLastNodeRange(previousEditElement, range, false);+ return setLastNodeRange(previousEditElement, range, false);}}}};// 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 imgPreviousSibling = hasPreviousSibling(imgSelectElement);if (imgPreviousSibling && imgPreviousSibling.textContent.endsWith(Constants.ZWSP)) {diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex 155234e4d5..4a47aa7ebf 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -856,6 +856,7 @@ export const turnsIntoTransaction = (options: {type: TTurnInto,level?: number,isContinue?: boolean,+ range?: Range}) => {let selectsElement: Element[] = options.selectsElement;let range: Range;@@ -977,8 +978,8 @@ export const turnsIntoTransaction = (options: {highlightRender(options.protyle.wysiwyg.element);avRender(options.protyle.wysiwyg.element, options.protyle);blockRender(options.protyle, options.protyle.wysiwyg.element);- if (range) {- focusByWbr(options.protyle.wysiwyg.element, range);+ if (range || options.range) {+ focusByWbr(options.protyle.wysiwyg.element, range || options.range);} else {focusBlock(options.protyle.wysiwyg.element.querySelector(`[data-node-id="${selectsElement[0].getAttribute("data-node-id")}"]`));}