Skip to content

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

:bug: Keep mobile block icon stable while typing https://github.com/siyuan-note/siyuan/issues/19773

Daniela43d7f422576
diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts
index 9b83188a40..fce877f9e8 100644
--- a/app/src/protyle/wysiwyg/input.ts
+++ b/app/src/protyle/wysiwyg/input.ts
@@ -34,6 +34,7 @@ import {
import {normalizeInlineFontFamilyStyle} from "../toolbar/fontFamilyCore";
import {sanitizeKernelHTML} from "../../util/hostCapabilities";
import {isProtyleListItemFirstParagraph} from "../runtimeCapabilities";
+import {isMobile} from "../../util/functions";
interface IInputOperations {
doOperations: IOperation[];
@@ -41,6 +42,14 @@ interface IInputOperations {
undoContext?: Record<string, string>;
}
+const updateGutterAfterInput = (protyle: IProtyle, blockElement: HTMLElement) => {
+ if (!isMobile()) {
+ hideElements(["gutter"], protyle);
+ } else if (protyle.gutter && !protyle.gutter.element.classList.contains("fn__none")) {
+ protyle.gutter.render(protyle, blockElement);
+ }
+};
+
const normalizeInlineFontFamilyStyles = (element: ParentNode) => {
element.querySelectorAll<HTMLElement>("span[style]").forEach(item => {
const fontFamily = item.style.fontFamily;
@@ -246,7 +255,7 @@ const inputBlock = async (protyle: IProtyle, blockElement: HTMLElement, range: R
}
focusByWbr(protyle.wysiwyg.element, range);
protyle.hint.render(protyle);
- hideElements(["gutter"], protyle);
+ updateGutterAfterInput(protyle, blockElement);
updateInput(html, protyle, id, inputOperations);
return;
}
@@ -564,7 +573,7 @@ const inputBlock = async (protyle: IProtyle, blockElement: HTMLElement, range: R
focusByWbr(protyle.wysiwyg.element, range);
protyle.hint.render(protyle);
}
- hideElements(["gutter"], protyle);
+ updateGutterAfterInput(protyle, blockElement);
updateInput(html, protyle, id, inputOperations);
};