mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-08 00:04:21 +01:00
This commit is contained in:
parent
52369911b1
commit
b983ba7f54
1 changed files with 12 additions and 4 deletions
|
|
@ -288,15 +288,23 @@ export const showKeyboardToolbarUtil = (oldScrollTop: number) => {
|
|||
showUtil = true;
|
||||
|
||||
const toolbarElement = document.getElementById("keyboardToolbar");
|
||||
const keyboardHeight = ((window.siyuan.mobile.size.isLandscape ? window.siyuan.mobile.size.landscape.height1 - window.siyuan.mobile.size.landscape.height2 : window.siyuan.mobile.size.portrait.height1 - window.siyuan.mobile.size.portrait.height2) ||
|
||||
(window.innerHeight / 2 - 42)) + "px";
|
||||
let keyboardHeight = window.innerHeight / 2 - 42;
|
||||
if (window.siyuan.mobile.size.isLandscape) {
|
||||
if (window.siyuan.mobile.size.landscape.height1 !== window.siyuan.mobile.size.landscape.height2) {
|
||||
keyboardHeight = window.siyuan.mobile.size.landscape.height1 - window.siyuan.mobile.size.landscape.height2 + 42;
|
||||
}
|
||||
} else {
|
||||
if (window.siyuan.mobile.size.portrait.height1 !== window.siyuan.mobile.size.portrait.height2) {
|
||||
keyboardHeight = window.siyuan.mobile.size.portrait.height1 - window.siyuan.mobile.size.portrait.height2 + 42;
|
||||
}
|
||||
}
|
||||
const editor = getCurrentEditor();
|
||||
if (editor) {
|
||||
editor.protyle.element.parentElement.style.paddingBottom = keyboardHeight;
|
||||
editor.protyle.element.parentElement.style.paddingBottom = keyboardHeight + "px";
|
||||
editor.protyle.contentElement.scrollTop = oldScrollTop;
|
||||
}
|
||||
setTimeout(() => {
|
||||
toolbarElement.style.height = keyboardHeight;
|
||||
toolbarElement.style.height = keyboardHeight + "px";
|
||||
}, Constants.TIMEOUT_TRANSITION); // 防止抖动
|
||||
setTimeout(() => {
|
||||
showUtil = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue