An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: https://github.com/siyuan-note/siyuan/issues/2911 选择 span 中的一部分需进行包裹
Vanessadcee38bcfa36
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex a77f4a09e5..7cae8a15d2 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -309,11 +309,22 @@ export class Toolbar {// aaa**bbb** 选中 aaa 加粗nextElement = nextSibling as HTMLElement;}- const wbrElement = document.createElement("wbr");- this.range.insertNode(wbrElement);+ this.range.insertNode(document.createElement("wbr"));const html = nodeElement.outerHTML;const contents = this.range.extractContents();this.mergeNode(contents.childNodes);+ // 选择 span 中的一部分需进行包裹+ if (previousElement && nextElement && previousElement.isSameNode(nextElement) && contents.firstChild.nodeType === 3) {+ const attributes = previousElement.attributes;+ contents.childNodes.forEach(item => {+ const spanElement = document.createElement("span");+ for (let i = 0; i < attributes.length; i++) {+ spanElement.setAttribute(attributes[i].name, attributes[i].value);+ }+ spanElement.innerHTML = item.textContent;+ item.replaceWith(spanElement);+ })+ }const actionBtn = action === "toolbar" ? this.element.querySelector(`[data-type="${type}"]`) : undefined;const newNodes: Node[] = [];if (actionBtn?.classList.contains("protyle-toolbar__item--current") || (@@ -506,7 +517,10 @@ export class Toolbar {}nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, html);- wbrElement.remove();+ const wbrElement = nodeElement.querySelector("wbr")+ if (wbrElement) {+ wbrElement.remove();+ }}public showFileAnnotationRef(protyle: IProtyle, refElement: HTMLElement) {