Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/18225

Vanessa60b791ffde8d
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index 34fdac2688..ce830d3b8d 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -19,6 +19,7 @@ import {isNotEditBlock} from "../../protyle/wysiwyg/getBlock";
import {getMirror} from "../../protyle/undo/globalUndo";
let renderKeyboardToolbarTimeout: number;
+let scrollSelectionIntoViewTimeout: number;
let showUtil = false;
const getSlashItem = (value: string, icon: string, text: string, focus = "false") => {
@@ -444,7 +445,11 @@ export const showKeyboardToolbar = () => {
item.eventBus.emit("mobile-keyboard-show");
});
}
- setTimeout(() => {
+ clearTimeout(scrollSelectionIntoViewTimeout);
+ scrollSelectionIntoViewTimeout = window.setTimeout(() => {
+ if (editor?.protyle.toolbar.isMultiSelectMode()) {
+ return;
+ }
const contentElement = hasClosestByClassName(range.startContainer, "protyle-content", true);
if (contentElement) {
let cursorTop = getSelectionPosition(contentElement).top;
@@ -473,6 +478,8 @@ export const showKeyboardToolbar = () => {
};
export const hideKeyboardToolbar = () => {
+ clearTimeout(renderKeyboardToolbarTimeout);
+ clearTimeout(scrollSelectionIntoViewTimeout);
if (showUtil) {
return;
}
diff --git a/app/src/mobile/util/touch.ts b/app/src/mobile/util/touch.ts
index 804990ebdb..c6a18df705 100644
--- a/app/src/mobile/util/touch.ts
+++ b/app/src/mobile/util/touch.ts
@@ -265,8 +265,10 @@ export const handleTouchStart = (event: TouchEvent) => {
if (blockElement && editor.protyle.wysiwyg.element.contains(blockElement)) {
longPressTimer = window.setTimeout(() => {
window.getSelection()?.removeAllRanges();
- activeBlur();
editor.protyle.toolbar.showMultiSelectMode(editor.protyle, blockElement);
+ if (editor.protyle.options.render.gutter) {
+ editor.protyle.gutter.render(editor.protyle, blockElement, target);
+ }
}, Constants.TIMEOUT_MULTIPLE_SELECT);
}
}