Skip to content

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

:iphone: edge

Danieldd0faf9a3f93
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 62fe0d9c40..02e082cc6d 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -120,49 +120,6 @@ class App {
updateCardHV();
activeBlur();
});
- window.siyuan.mobile.size.isLandscape = window.matchMedia && window.matchMedia("(orientation: landscape)").matches;
- if (window.siyuan.mobile.size.isLandscape) {
- window.siyuan.mobile.size.landscape = {
- height1: window.innerHeight,
- height2: window.innerHeight,
- };
- } else {
- window.siyuan.mobile.size.portrait = {
- height1: window.innerHeight,
- height2: window.innerHeight,
- };
- }
- window.addEventListener("resize", () => {
- // 获取键盘高度
- window.siyuan.mobile.size.isLandscape = window.matchMedia && window.matchMedia("(orientation: landscape)").matches;
- if (window.siyuan.mobile.size.isLandscape) {
- if (!window.siyuan.mobile.size.landscape) {
- window.siyuan.mobile.size.landscape = {
- height1: window.innerHeight,
- height2: window.innerHeight,
- };
- }
- if (window.innerHeight < window.siyuan.mobile.size.landscape.height1) {
- window.siyuan.mobile.size.landscape.height2 = window.innerHeight;
- }
- if (window.innerHeight > window.siyuan.mobile.size.landscape.height1) {
- window.siyuan.mobile.size.landscape.height1 = window.innerHeight;
- }
- } else {
- if (!window.siyuan.mobile.size.portrait) {
- window.siyuan.mobile.size.portrait = {
- height1: window.innerHeight,
- height2: window.innerHeight,
- };
- }
- if (window.innerHeight < window.siyuan.mobile.size.portrait.height1) {
- window.siyuan.mobile.size.portrait.height2 = window.innerHeight;
- }
- if (window.innerHeight > window.siyuan.mobile.size.portrait.height1) {
- window.siyuan.mobile.size.portrait.height1 = window.innerHeight;
- }
- }
- });
fetchPost("/api/system/getConf", {}, async (confResponse) => {
addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index 7b10f91a34..a59e032506 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -12,7 +12,7 @@ import {getCurrentEditor} from "../editor";
import {fontEvent, getFontNodeElements} from "../../protyle/toolbar/Font";
import {hideElements} from "../../protyle/ui/hideElements";
import {softEnter} from "../../protyle/wysiwyg/enter";
-import {isInAndroid, isInHarmony} from "../../protyle/util/compatibility";
+import {isInAndroid, isInEdge, isInHarmony} from "../../protyle/util/compatibility";
import {tabCodeBlock} from "../../protyle/wysiwyg/codeBlock";
import {callMobileAppShowKeyboard} from "./mobileAppUtil";
@@ -502,7 +502,61 @@ export const initKeyboardToolbar = () => {
renderKeyboardToolbar();
}
}, false);
-
+ window.siyuan.mobile.size.isLandscape = window.matchMedia && window.matchMedia("(orientation: landscape)").matches;
+ if (window.siyuan.mobile.size.isLandscape) {
+ window.siyuan.mobile.size.landscape = {
+ height1: window.innerHeight,
+ height2: window.innerHeight,
+ };
+ } else {
+ window.siyuan.mobile.size.portrait = {
+ height1: window.innerHeight,
+ height2: window.innerHeight,
+ };
+ }
+ if (!isInEdge()) {
+ window.addEventListener("resize", () => {
+ // 获取键盘高度
+ window.siyuan.mobile.size.isLandscape = window.matchMedia && window.matchMedia("(orientation: landscape)").matches;
+ if (window.siyuan.mobile.size.isLandscape) {
+ if (!window.siyuan.mobile.size.landscape) {
+ window.siyuan.mobile.size.landscape = {
+ height1: window.innerHeight,
+ height2: window.innerHeight,
+ };
+ }
+ if (window.innerHeight < window.siyuan.mobile.size.landscape.height1 - 100) {
+ window.siyuan.mobile.size.landscape.height2 = window.innerHeight;
+ }
+ if (window.innerHeight > window.siyuan.mobile.size.landscape.height1) {
+ window.siyuan.mobile.size.landscape.height1 = window.innerHeight;
+ }
+ if (window.siyuan.mobile.size.landscape.height2 < window.innerHeight) {
+ activeBlur()
+ } else if (!preventRender) {
+ renderKeyboardToolbar();
+ }
+ } else {
+ if (!window.siyuan.mobile.size.portrait) {
+ window.siyuan.mobile.size.portrait = {
+ height1: window.innerHeight,
+ height2: window.innerHeight,
+ };
+ }
+ if (window.innerHeight < window.siyuan.mobile.size.portrait.height1 - 100) {
+ window.siyuan.mobile.size.portrait.height2 = window.innerHeight;
+ }
+ if (window.innerHeight > window.siyuan.mobile.size.portrait.height1) {
+ window.siyuan.mobile.size.portrait.height1 = window.innerHeight;
+ }
+ if (window.siyuan.mobile.size.portrait.height2 < window.innerHeight) {
+ activeBlur()
+ } else if (!preventRender) {
+ renderKeyboardToolbar();
+ }
+ }
+ });
+ }
const toolbarElement = document.getElementById("keyboardToolbar");
toolbarElement.innerHTML = `<div class="fn__flex keyboard__bar">
<div class="fn__flex-1">
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index dde1a2371f..3d28464303 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -348,6 +348,11 @@ export const isInHarmony = () => {
return window.siyuan.config.system.container === "harmony" && window.JSHarmony;
};
+export const isInEdge = () => {
+ const ua = navigator.userAgent;
+ return ua.indexOf("EdgA/") > -1 || ua.indexOf("Edge/") > -1;
+};
+
export const updateHotkeyAfterTip = (hotkey: string, split = " ") => {
if (hotkey) {
return split + updateHotkeyTip(hotkey);