Vanessa 2026-02-05 11:38:40 +08:00
parent d60415dd79
commit b14eec5c59
3 changed files with 13 additions and 2 deletions

View file

@ -20,7 +20,7 @@ import {bootSync} from "../dialog/processSystem";
import {initMessage, showMessage} from "../dialog/message";
import {goBack} from "./util/MobileBackFoward";
import {activeBlur, hideKeyboardToolbar, showKeyboardToolbar} from "./util/keyboardToolbar";
import {getLocalStorage, writeText} from "../protyle/util/compatibility";
import {getLocalStorage, isInIOS, writeText} from "../protyle/util/compatibility";
import {getCurrentEditor, openMobileFileById} from "./editor";
import {getSearch} from "../util/functions";
import {checkPublishServiceClosed} from "../util/processMessage";
@ -94,6 +94,9 @@ class App {
event.preventDefault();
}
if (isInIOS()) {
return;
}
const wysisygElement = hasClosestByClassName(event.target, "protyle-wysiwyg", true);
let editElement: HTMLElement;
if (["INPUT", "TEXTAREA"].includes(event.target.tagName) && event.target.getAttribute("readonly") !== "readonly") {
@ -102,7 +105,11 @@ class App {
editElement = hasClosestByAttribute(event.target, "contenteditable", "true") as HTMLElement;
}
if (editElement) {
window.JSAndroid?.showKeyboard();
if (window.JSAndroid && window.JSAndroid.showKeyboard) {
window.JSAndroid.showKeyboard();
} else if (window.JSHarmony && window.JSHarmony.showKeyboard) {
window.JSHarmony.showKeyboard();
}
}
});
window.addEventListener("beforeunload", () => {

View file

@ -487,6 +487,8 @@ export const hideKeyboardToolbar = () => {
export const activeBlur = () => {
if (window.JSAndroid && window.JSAndroid.hideKeyboard) {
window.JSAndroid.hideKeyboard();
} else if (window.JSHarmony && window.JSHarmony.hideKeyboard) {
window.JSHarmony.hideKeyboard();
}
hideKeyboardToolbar();
(document.activeElement as HTMLElement).blur();

View file

@ -254,6 +254,8 @@ interface Window {
exit(): void
};
JSHarmony: {
showKeyboard(): void
hideKeyboard(): void
openExternal(url: string): void
exportByDefault(url: string): void
changeStatusBarColor(color: string, mode: number): void