mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-12 02:04:20 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
0e8432fd16
3 changed files with 61 additions and 45 deletions
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue