mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-02 21:42:15 +08:00
fix(mobile): positioning of the classic toolbar
This commit is contained in:
parent
c1280be74a
commit
955542a991
@ -33,10 +33,10 @@ const TPL = `\
|
|||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 50vh;
|
height: 10vh;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
background: transparent;
|
|
||||||
z-index: 500;
|
z-index: 500;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.mobile .classic-toolbar-widget .ck.ck-toolbar {
|
body.mobile .classic-toolbar-widget .ck.ck-toolbar {
|
||||||
@ -69,16 +69,16 @@ export default class ClassicEditorToolbar extends NoteContextAwareWidget {
|
|||||||
this.contentSized();
|
this.contentSized();
|
||||||
|
|
||||||
if (utils.isMobile()) {
|
if (utils.isMobile()) {
|
||||||
let originalHeight = window.visualViewport.height;
|
window.visualViewport.addEventListener("resize", () => this.#adjustPosition());
|
||||||
let originalBottom = this.$widget[0].style.bottom;
|
window.addEventListener("scroll", () => this.#adjustPosition());
|
||||||
window.visualViewport.addEventListener("resize", () => {
|
|
||||||
const keyboardSize = originalHeight - window.visualViewport.height;
|
|
||||||
const bottom = Math.max(keyboardSize, originalBottom);
|
|
||||||
this.$widget.css("bottom", `${bottom}px`);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#adjustPosition() {
|
||||||
|
const bottom = window.innerHeight - window.visualViewport.height;
|
||||||
|
this.$widget.css("bottom", `${bottom}px`);
|
||||||
|
}
|
||||||
|
|
||||||
async getTitle() {
|
async getTitle() {
|
||||||
return {
|
return {
|
||||||
show: await this.#shouldDisplay(),
|
show: await this.#shouldDisplay(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user