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: https://github.com/siyuan-note/siyuan/issues/17725
Vanessa851aa702bf28
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.tsindex af5cc18cf2..a846d9da93 100644--- a/app/src/mobile/util/keyboardToolbar.ts+++ b/app/src/mobile/util/keyboardToolbar.ts@@ -692,16 +692,18 @@ export const initKeyboardToolbar = () => {preventRender = true;const nodeElements = getFontNodeElements(protyle);const itemElement = buttonElement.firstElementChild as HTMLElement;+ const focusRange = !buttonElement.classList.contains("keyboard__slash-item");if (type === "style1") {- fontEvent(protyle, nodeElements, type, itemElement.style.backgroundColor + Constants.ZWSP + itemElement.style.color);+ fontEvent(protyle, nodeElements, type,+ itemElement.style.backgroundColor + Constants.ZWSP + itemElement.style.color, focusRange);} else if (type === "fontSize") {- fontEvent(protyle, nodeElements, type, itemElement.textContent.trim());+ fontEvent(protyle, nodeElements, type, itemElement.textContent.trim(), focusRange);} else if (type === "backgroundColor") {- fontEvent(protyle, nodeElements, type, itemElement.style.backgroundColor);+ fontEvent(protyle, nodeElements, type, itemElement.style.backgroundColor, focusRange);} else if (type === "color") {- fontEvent(protyle, nodeElements, type, itemElement.style.color);+ fontEvent(protyle, nodeElements, type, itemElement.style.color, focusRange);} else {- fontEvent(protyle, nodeElements, type);+ fontEvent(protyle, nodeElements, type, undefined, focusRange);}setTimeout(() => {preventRender = false;diff --git a/app/src/protyle/toolbar/Font.ts b/app/src/protyle/toolbar/Font.tsindex 806b32fe76..2f6a39d056 100644--- a/app/src/protyle/toolbar/Font.ts+++ b/app/src/protyle/toolbar/Font.ts@@ -225,7 +225,8 @@ export const appearanceMenu = (protyle: IProtyle, nodeElements?: Element[]) => {return element;};-export const fontEvent = (protyle: IProtyle, nodeElements: Element[], type?: string, color?: string) => {+export const fontEvent = (protyle: IProtyle, nodeElements: Element[], type?: string, color?: string,+ focusRange = true) => {let localFontStyles = window.siyuan.storage[Constants.LOCAL_FONTSTYLES];if (type) {localFontStyles.splice(0, 0, `${type}${Constants.ZWSP}${color}`);@@ -277,12 +278,14 @@ export const fontEvent = (protyle: IProtyle, nodeElements: Element[], type?: strlineNumberRender(e.querySelector(".hljs"));}});- focusByRange(protyle.toolbar.range);+ if (focusRange) {+ focusByRange(protyle.toolbar.range);+ }} else {if (type === "clear") {- protyle.toolbar.setInlineMark(protyle, "clear", "range", {type: "text"});+ protyle.toolbar.setInlineMark(protyle, "clear", "range", {type: "text"}, focusRange);} else {- protyle.toolbar.setInlineMark(protyle, "text", "range", {type, color});+ protyle.toolbar.setInlineMark(protyle, "text", "range", {type, color}, focusRange);}}};diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex 01e205bef0..387cd0840c 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -309,7 +309,8 @@ export class Toolbar {return true;}- public setInlineMark(protyle: IProtyle, type: string, action: "range" | "toolbar", textObj?: ITextOption) {+ public setInlineMark(protyle: IProtyle, type: string, action: "range" | "toolbar",+ textObj?: ITextOption, focusRange = true) {const nodeElement = hasClosestBlock(this.range.startContainer);if (!nodeElement) {return;@@ -322,16 +323,16 @@ export class Toolbar {if (type === "a") {return;}- return this.setBlockRangesInlineMark(protyle, type, action, textObj);+ return this.setBlockRangesInlineMark(protyle, type, action, textObj, focusRange);}if (nodeElement.getAttribute("data-type") === "NodeCodeBlock") {return;}- return this.setInlineMarkInBlock(protyle, type, action, textObj);+ return this.setInlineMarkInBlock(protyle, type, action, textObj, undefined, focusRange);}private setBlockRangesInlineMark(protyle: IProtyle, type: string, action: "range" | "toolbar",- textObj?: ITextOption) {+ textObj?: ITextOption, focusRange = true) {const selectedRange = this.range.cloneRange();const startRange = selectedRange.cloneRange();startRange.collapse(true);@@ -399,7 +400,9 @@ export class Toolbar {selectionRange.setEnd(selectedRange.endContainer, selectedRange.endOffset);}this.range = selectionRange;- focusByRange(this.range);+ if (focusRange) {+ focusByRange(this.range);+ }}if (memoOldHTMLs) {const memoElements = newNodes.filter(item => item.nodeType !== 3 &&@@ -413,7 +416,7 @@ export class Toolbar {}private setInlineMarkInBlock(protyle: IProtyle, type: string, action: "range" | "toolbar",- textObj?: ITextOption, remove?: boolean) {+ textObj?: ITextOption, remove?: boolean, focusRange = true) {const nodeElement = hasClosestBlock(this.range.startContainer);if (!nodeElement || nodeElement.getAttribute("data-type") === "NodeCodeBlock") {return;@@ -972,7 +975,7 @@ export class Toolbar {this.range.setEnd(endContainer.firstChild, endOffset);}}- if (!isBatch) {+ if (!isBatch && focusRange) {focusByRange(this.range);}