📱 edge

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-02-07 19:42:51 +08:00
parent 59b7d611c3
commit dd0faf9a3f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 61 additions and 45 deletions

View file

@ -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");

View file

@ -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">

View file

@ -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);