mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 15:58:49 +01:00
This commit is contained in:
parent
2ac7f67d75
commit
0e5b85f8dc
1 changed files with 13 additions and 11 deletions
|
|
@ -22,17 +22,19 @@ export const showKeyboardToolbar = (bottom = 0) => {
|
|||
toolbarElement.classList.remove("fn__none");
|
||||
toolbarElement.style.bottom = bottom + "px";
|
||||
|
||||
const contentElement = window.siyuan.mobileEditor.protyle.contentElement
|
||||
const cursorTop = getSelectionPosition(contentElement).top - contentElement.getBoundingClientRect().top;
|
||||
if (cursorTop < window.innerHeight - 96) {
|
||||
return;
|
||||
}
|
||||
contentElement.scroll({
|
||||
top: contentElement.scrollTop + cursorTop - ((window.outerHeight - 65) / 2 - 30),
|
||||
left: contentElement.scrollLeft,
|
||||
behavior: "smooth"
|
||||
});
|
||||
alert(cursorTop + "," + window.innerHeight);
|
||||
setTimeout(() => {
|
||||
const contentElement = window.siyuan.mobileEditor.protyle.contentElement
|
||||
const cursorTop = getSelectionPosition(contentElement).top - contentElement.getBoundingClientRect().top;
|
||||
if (cursorTop < window.innerHeight - 96) {
|
||||
return;
|
||||
}
|
||||
contentElement.scroll({
|
||||
top: contentElement.scrollTop + cursorTop - ((window.outerHeight - 65) / 2 - 30),
|
||||
left: contentElement.scrollLeft,
|
||||
behavior: "smooth"
|
||||
});
|
||||
alert(cursorTop + "," + window.innerHeight);
|
||||
})
|
||||
// if ("android" === window.siyuan.config.system.container && window.JSAndroid) {
|
||||
// // Android 端事件需要滞后一些,所以这里延迟一下
|
||||
// setTimeout(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue