Skip to content

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

:bug: Update mobile toolbar highlights immediately https://github.com/siyuan-note/siyuan/issues/19215

Daniel368e53b04390
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 6573d1e514..39ce976b8b 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -683,7 +683,8 @@ export class Toolbar {
return;
}
- const actionBtn = action === "toolbar" ? this.element.querySelector(`[data-type="${type}"]`) : undefined;
+ const toolbarElement = isMobile() ? document.querySelector("#keyboardToolbar .keyboard__dynamic").nextElementSibling : this.element;
+ const actionBtn = action === "toolbar" ? toolbarElement.querySelector(`[data-type="${type}"]`) : undefined;
const remove = type === "clear" || actionBtn?.classList.contains("protyle-toolbar__item--current") ||
(!textObj && ranges.every(item => this.hasInlineMark(item.editableElement, item.range, type)));
const visibleOffsets = new Map(ranges.map(item =>
@@ -1054,7 +1055,7 @@ export class Toolbar {
});
} else {
// 添加
- if (!this.element.classList.contains("fn__none") && type !== "text" && actionBtn) {
+ if (!toolbarElement.classList.contains("fn__none") && type !== "text" && actionBtn) {
actionBtn.classList.add("protyle-toolbar__item--current");
}
if (selectText === "" || (type === "text" && textObj?.type === "fontFamily" &&