mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-04 06:31:35 +08:00
feat(mobile): improve positioning of jump to note
This commit is contained in:
parent
57ed133c7f
commit
90ec7919ba
@ -269,6 +269,8 @@ async function openDialog($dialog: JQuery<HTMLElement>, closeActDialog = true) {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const keyboardActionsService = (await import("./keyboard_actions.js")).default;
|
const keyboardActionsService = (await import("./keyboard_actions.js")).default;
|
||||||
keyboardActionsService.updateDisplayedShortcuts($dialog);
|
keyboardActionsService.updateDisplayedShortcuts($dialog);
|
||||||
|
|
||||||
|
return $dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isHtmlEmpty(html: string) {
|
function isHtmlEmpty(html: string) {
|
||||||
|
@ -46,7 +46,30 @@ export default class JumpToNoteDialog extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async jumpToNoteEvent() {
|
async jumpToNoteEvent() {
|
||||||
utils.openDialog(this.$widget);
|
const dialogPromise = utils.openDialog(this.$widget)
|
||||||
|
if (utils.isMobile()) {
|
||||||
|
dialogPromise.then(($dialog) => {
|
||||||
|
const el = $dialog.find(">.modal-dialog")[0];
|
||||||
|
|
||||||
|
function reposition() {
|
||||||
|
const offset = 100;
|
||||||
|
const modalHeight = window.visualViewport.height - offset;
|
||||||
|
const safeAreaInsetBottom = window.visualViewport.height - window.innerHeight;
|
||||||
|
el.style.height = `${modalHeight}px`;
|
||||||
|
el.style.bottom = `${window.visualViewport.height - modalHeight - safeAreaInsetBottom - offset}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$autoComplete.on("focus", () => {
|
||||||
|
reposition();
|
||||||
|
});
|
||||||
|
|
||||||
|
window.visualViewport.addEventListener("resize", () => {
|
||||||
|
reposition();
|
||||||
|
});
|
||||||
|
|
||||||
|
reposition();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// first open dialog, then refresh since refresh is doing focus which should be visible
|
// first open dialog, then refresh since refresh is doing focus which should be visible
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
@ -1267,6 +1267,15 @@ body.mobile #launcher-pane .dropdown-menu.show {
|
|||||||
body.mobile .options-section table {
|
body.mobile .options-section table {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.mobile .jump-to-note-dialog .modal-content {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.mobile .jump-to-note-dialog .modal-dialog .aa-dropdown-menu {
|
||||||
|
max-height: unset;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mobile, tablet mode */
|
/* Mobile, tablet mode */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user