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/14979

Vanessa35b44fc1f022
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index 8f9ea471ee..bdaa8f2f0b 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -520,23 +520,23 @@ export const initKeyboardToolbar = () => {
<button class="keyboard__action" data-type="done"><svg style="width: 36px"><use xlink:href="#iconKeyboardHide"></use></svg></button>
</div>
<div class="keyboard__util"></div>`;
- // let startY = 0;
- // let moved = false;
- // toolbarElement.addEventListener("touchstart", e => {
- // startY = e.touches[0].clientY;
- // moved = false;
- // });
- // toolbarElement.addEventListener("touchmove", e => {
- // if (Math.abs(e.touches[0].clientY - startY) > 10) {
- // moved = true;
- // }
- // });
- toolbarElement.addEventListener(isInAndroid() || isInHarmony() ? "touchstart" : "click", (event) => {
- // console.log("moved", moved);
- // if (moved) {
- // return;
- // }
- console.log("touchend", getSelection().getRangeAt(0).toString());
+ let startY = 0;
+ let moved = false;
+ toolbarElement.addEventListener("touchstart", e => {
+ startY = e.touches[0].clientY;
+ moved = false;
+ });
+ toolbarElement.addEventListener("touchmove", e => {
+ if (Math.abs(e.touches[0].clientY - startY) > 10) {
+ moved = true;
+ }
+ });
+ toolbarElement.addEventListener(isInAndroid() || isInHarmony() ? "touchend" : "click", (event) => {
+ console.log("moved", moved);
+ if (moved) {
+ return;
+ }
+ console.log("touchend");
const protyle = getCurrentEditor()?.protyle;
const target = event.target as HTMLElement;
const slashBtnElement = hasClosestByClassName(event.target as HTMLElement, "keyboard__slash-item");
@@ -574,8 +574,8 @@ export const initKeyboardToolbar = () => {
}
}
- // event.preventDefault();
- // event.stopPropagation();
+ event.preventDefault();
+ event.stopPropagation();
if (getSelection().rangeCount === 0) {
return;
}
@@ -691,5 +691,5 @@ export const initKeyboardToolbar = () => {
focusByRange(range);
return;
}
- }, {passive: true});
+ });
};