Skip to content

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

:iphone: 编辑数据库单元格

Vanessa05e660d5f6c2
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 4c63574c71..62fe0d9c40 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -37,6 +37,7 @@ import {correctHotkey} from "../boot/globalEvent/commonHotkey";
import {processIOSPurchaseResponse} from "../util/iOSPurchase";
import {updateControlAlt} from "../protyle/util/hotKey";
import {nbsp2space} from "../protyle/util/normalizeText";
+import {callMobileAppShowKeyboard} from "./util/mobileAppUtil";
class App {
public plugins: import("../plugin").Plugin[] = [];
@@ -105,11 +106,7 @@ class App {
editElement = hasClosestByAttribute(event.target, "contenteditable", "true") as HTMLElement;
}
if (editElement) {
- if (window.JSAndroid && window.JSAndroid.showKeyboard) {
- window.JSAndroid.showKeyboard();
- } else if (window.JSHarmony && window.JSHarmony.showKeyboard) {
- window.JSHarmony.showKeyboard();
- }
+ callMobileAppShowKeyboard();
}
});
window.addEventListener("beforeunload", () => {
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index af9e9b0b16..5dafa19282 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -14,6 +14,7 @@ import {hideElements} from "../../protyle/ui/hideElements";
import {softEnter} from "../../protyle/wysiwyg/enter";
import {isInAndroid, isInHarmony} from "../../protyle/util/compatibility";
import {tabCodeBlock} from "../../protyle/wysiwyg/codeBlock";
+import {callMobileAppShowKeyboard} from "./mobileAppUtil";
let renderKeyboardToolbarTimeout: number;
let showUtil = false;
@@ -609,11 +610,7 @@ export const initKeyboardToolbar = () => {
if (type === "done") {
if (toolbarElement.clientHeight > 100) {
hideKeyboardToolbarUtil();
- if (window.JSAndroid && window.JSAndroid.showKeyboard) {
- window.JSAndroid.showKeyboard();
- } else if (window.JSHarmony && window.JSHarmony.showKeyboard) {
- window.JSHarmony.showKeyboard();
- }
+ callMobileAppShowKeyboard();
setTimeout(() => focusByRange(range), 256);
} else {
activeBlur();
@@ -696,11 +693,7 @@ export const initKeyboardToolbar = () => {
} else if (type === "add") {
if (buttonElement.classList.contains("protyle-toolbar__item--current")) {
hideKeyboardToolbarUtil();
- if (window.JSAndroid && window.JSAndroid.showKeyboard) {
- window.JSAndroid.showKeyboard();
- } else if (window.JSHarmony && window.JSHarmony.showKeyboard) {
- window.JSHarmony.showKeyboard();
- }
+ callMobileAppShowKeyboard();
setTimeout(() => focusByRange(range), 256);
} else {
(document.activeElement as HTMLElement)?.blur();
diff --git a/app/src/mobile/util/mobileAppUtil.ts b/app/src/mobile/util/mobileAppUtil.ts
new file mode 100644
index 0000000000..4b1e95dc9f
--- /dev/null
+++ b/app/src/mobile/util/mobileAppUtil.ts
@@ -0,0 +1,7 @@
+export const callMobileAppShowKeyboard = () => {
+ if (window.JSAndroid && window.JSAndroid.showKeyboard) {
+ window.JSAndroid.showKeyboard();
+ } else if (window.JSHarmony && window.JSHarmony.showKeyboard) {
+ window.JSHarmony.showKeyboard();
+ }
+};
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index 2caed317ed..d84acca9b0 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -38,6 +38,7 @@ import {escapeHtml} from "../../../util/escape";
import {editGalleryItem, openGalleryItemMenu} from "./gallery/util";
import {clearSelect} from "../../util/clear";
import {removeCompressURL} from "../../../util/image";
+import {callMobileAppShowKeyboard} from "../../../mobile/util/mobileAppUtil";
let foldTimeout: number;
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
@@ -327,7 +328,10 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
if (viewsElement) {
viewsElement.classList.add("av__views--show");
}
- searchElement.focus();
+ callMobileAppShowKeyboard();
+ setTimeout(() => {
+ searchElement.focus();
+ }, Constants.TIMEOUT_TRANSITION);
event.preventDefault();
event.stopPropagation();
return true;