mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-17 01:21:14 +08:00
This commit is contained in:
parent
df298125ec
commit
e0be2e345a
@ -19,9 +19,14 @@ export const showKeyboardToolbar = (bottom = 0) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => { // Android 端事件需要滞后一些,所以这里统一延迟一下
|
if ("android" === window.siyuan.config.system.container && window.JSAndroid) {
|
||||||
|
// Android 端事件需要滞后一些,所以这里统一延迟一下
|
||||||
|
setTimeout(() => {
|
||||||
|
scrollCenter(window.siyuan.mobileEditor.protyle, undefined, false, (window.outerHeight - 65) / 2 - 30);
|
||||||
|
}, 100);
|
||||||
|
} else {
|
||||||
scrollCenter(window.siyuan.mobileEditor.protyle, undefined, false, (window.outerHeight - 65) / 2 - 30);
|
scrollCenter(window.siyuan.mobileEditor.protyle, undefined, false, (window.outerHeight - 65) / 2 - 30);
|
||||||
}, 100);
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const hideKeyboardToolbar = () => {
|
export const hideKeyboardToolbar = () => {
|
||||||
|
@ -44,10 +44,10 @@ export const scrollCenter = (protyle: IProtyle, nodeElement?: Element, top = fal
|
|||||||
const cursorTop = getSelectionPosition(editorElement).top - editorElement.getBoundingClientRect().top;
|
const cursorTop = getSelectionPosition(editorElement).top - editorElement.getBoundingClientRect().top;
|
||||||
if (offset) { // 仅移动端弹起键盘用到
|
if (offset) { // 仅移动端弹起键盘用到
|
||||||
editorElement.scroll({
|
editorElement.scroll({
|
||||||
top: editorElement.scrollLeft,
|
top: editorElement.scrollTop + cursorTop - offset,
|
||||||
left: editorElement.scrollTop + cursorTop - offset,
|
left: editorElement.scrollLeft,
|
||||||
behavior: "smooth"
|
behavior: "smooth"
|
||||||
})
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cursorTop < 0) {
|
if (cursorTop < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user