mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-27 01:14:07 +01:00
🎨 Improve soft keyboard toolbar pop-up https://github.com/siyuan-note/siyuan/issues/16548
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
65f1c76de0
commit
0343e3cc1c
3 changed files with 34 additions and 17 deletions
|
|
@ -53,17 +53,7 @@ class App {
|
|||
dialogs: [],
|
||||
blockPanels: [],
|
||||
mobile: {
|
||||
size: {
|
||||
isLandscape: window.matchMedia && window.matchMedia("(orientation: landscape)").matches,
|
||||
landscape: {
|
||||
height1: window.innerWidth,
|
||||
height2: window.innerWidth,
|
||||
}, // 横屏
|
||||
portrait: {
|
||||
height1: window.innerHeight,
|
||||
height2: window.innerHeight,
|
||||
}
|
||||
},
|
||||
size: {},
|
||||
docks: {
|
||||
outline: null,
|
||||
file: null,
|
||||
|
|
@ -170,6 +160,19 @@ class App {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -199,15 +202,29 @@ 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;
|
||||
} else {
|
||||
}
|
||||
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;
|
||||
} else {
|
||||
}
|
||||
if (window.innerHeight > window.siyuan.mobile.size.portrait.height1) {
|
||||
window.siyuan.mobile.size.portrait.height1 = window.innerHeight;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const popSide = (render = true) => {
|
|||
export const handleTouchEnd = (event: TouchEvent, app: App) => {
|
||||
const target = event.target as HTMLElement;
|
||||
const wysisygElement = hasClosestByClassName(target, "protyle-wysiwyg", true);
|
||||
if (!yDiff || Math.abs(yDiff) < 24) {
|
||||
if (!yDiff || Math.abs(yDiff) < 8) {
|
||||
let editElement: HTMLElement;
|
||||
if (["INPUT", "TEXTAREA"].includes(target.tagName) && target.getAttribute("readonly") !== "readonly") {
|
||||
editElement = target;
|
||||
|
|
|
|||
6
app/src/types/index.d.ts
vendored
6
app/src/types/index.d.ts
vendored
|
|
@ -489,12 +489,12 @@ interface ISiyuan {
|
|||
backStack?: IBackStack[],
|
||||
mobile?: {
|
||||
size: {
|
||||
isLandscape:boolean,
|
||||
landscape: {
|
||||
isLandscape?: boolean,
|
||||
landscape?: {
|
||||
height1: number,
|
||||
height2: number, // 键盘弹起时的高度
|
||||
}, // 横屏
|
||||
portrait: {
|
||||
portrait?: {
|
||||
height1: number,
|
||||
height2: number,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue