Skip to content

Build your personal knowledge base with Trilium Notes

fix(mobile): positioning of the classic toolbar

Elian Doran955542a9916a
diff --git a/src/public/app/widgets/ribbon_widgets/classic_editor_toolbar.js b/src/public/app/widgets/ribbon_widgets/classic_editor_toolbar.js
index 0c8b96f46a..b3391cd566 100644
--- a/src/public/app/widgets/ribbon_widgets/classic_editor_toolbar.js
+++ b/src/public/app/widgets/ribbon_widgets/classic_editor_toolbar.js
@@ -33,10 +33,10 @@ const TPL = `\
left: 0;
bottom: 0;
right: 0;
- height: 50vh;
+ height: 10vh;
overflow-x: auto;
- background: transparent;
z-index: 500;
+ user-select: none;
}
body.mobile .classic-toolbar-widget .ck.ck-toolbar {
@@ -69,16 +69,16 @@ export default class ClassicEditorToolbar extends NoteContextAwareWidget {
this.contentSized();
if (utils.isMobile()) {
- let originalHeight = window.visualViewport.height;
- let originalBottom = this.$widget[0].style.bottom;
- window.visualViewport.addEventListener("resize", () => {
- const keyboardSize = originalHeight - window.visualViewport.height;
- const bottom = Math.max(keyboardSize, originalBottom);
- this.$widget.css("bottom", `${bottom}px`);
- });
+ window.visualViewport.addEventListener("resize", () => this.#adjustPosition());
+ window.addEventListener("scroll", () => this.#adjustPosition());
}
}
+ #adjustPosition() {
+ const bottom = window.innerHeight - window.visualViewport.height;
+ this.$widget.css("bottom", `${bottom}px`);
+ }
+
async getTitle() {
return {
show: await this.#shouldDisplay(),