mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	feat(mobile): improve editing toolbar positioning on Android
This commit is contained in:
		| @@ -171,6 +171,7 @@ export default class MobileLayout { | |||||||
|                                     .child(new NoteListWidget()) |                                     .child(new NoteListWidget()) | ||||||
|                                     .child(new FilePropertiesWidget().css("font-size", "smaller")) |                                     .child(new FilePropertiesWidget().css("font-size", "smaller")) | ||||||
|                             ) |                             ) | ||||||
|  |                             .child(new MobileEditorToolbar()) | ||||||
|                     ) |                     ) | ||||||
|                     .child(new ProtectedSessionPasswordDialog()) |                     .child(new ProtectedSessionPasswordDialog()) | ||||||
|                     .child(new ConfirmDialog()) |                     .child(new ConfirmDialog()) | ||||||
| @@ -182,7 +183,6 @@ export default class MobileLayout { | |||||||
|                     .child(new TabRowWidget().css("height", "40px")) |                     .child(new TabRowWidget().css("height", "40px")) | ||||||
|                     .child(new FlexContainer("row").class("horizontal").css("height", "53px").child(new LauncherContainer(true)).child(new GlobalMenuWidget(true)).id("launcher-pane")) |                     .child(new FlexContainer("row").class("horizontal").css("height", "53px").child(new LauncherContainer(true)).child(new GlobalMenuWidget(true)).id("launcher-pane")) | ||||||
|             ) |             ) | ||||||
|             .child(new MobileEditorToolbar()) |  | ||||||
|             .child(new AboutDialog()) |             .child(new AboutDialog()) | ||||||
|             .child(new HelpDialog()) |             .child(new HelpDialog()) | ||||||
|             .child(new RecentChangesDialog()) |             .child(new RecentChangesDialog()) | ||||||
|   | |||||||
| @@ -26,9 +26,6 @@ const TPL = /*html*/`\ | |||||||
|     body.mobile .classic-toolbar-widget.visible { |     body.mobile .classic-toolbar-widget.visible { | ||||||
|         display: flex; |         display: flex; | ||||||
|         align-items: flex-end; |         align-items: flex-end; | ||||||
|         position: absolute; |  | ||||||
|         left: 0; |  | ||||||
|         right: 0; |  | ||||||
|         overflow-x: auto; |         overflow-x: auto; | ||||||
|         overscroll-behavior: none; |         overscroll-behavior: none; | ||||||
|         z-index: 500; |         z-index: 500; | ||||||
| @@ -39,19 +36,6 @@ const TPL = /*html*/`\ | |||||||
|         height: 3px; |         height: 3px; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @media (max-width: 991px) { |  | ||||||
|         body.mobile .classic-toolbar-widget.visible { |  | ||||||
|             bottom: calc(var(--tab-bar-height) + var(--launcher-pane-height) + var(--mobile-bottom-offset)); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @media (min-width: 991px) { |  | ||||||
|         body.mobile .classic-toolbar-widget.visible { |  | ||||||
|             bottom: 0; |  | ||||||
|             left: 25%; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     body.mobile .classic-toolbar-widget.dropdown-active { |     body.mobile .classic-toolbar-widget.dropdown-active { | ||||||
|         height: 50vh; |         height: 50vh; | ||||||
|     } |     } | ||||||
| @@ -94,10 +78,6 @@ export default class MobileEditorToolbar extends NoteContextAwareWidget { | |||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|         this.contentSized(); |         this.contentSized(); | ||||||
|  |  | ||||||
|         // The virtual keyboard obscures the editing toolbar so we have to reposition by calculating the height of the keyboard. |  | ||||||
|         window.visualViewport?.addEventListener("resize", () => this.#adjustPosition()); |  | ||||||
|         window.addEventListener("scroll", () => this.#adjustPosition()); |  | ||||||
|  |  | ||||||
|         // Observe when a dropdown is expanded to apply a style that allows the dropdown to be visible, since we can't have the element both visible and the toolbar scrollable. |         // Observe when a dropdown is expanded to apply a style that allows the dropdown to be visible, since we can't have the element both visible and the toolbar scrollable. | ||||||
|         this.observer.disconnect(); |         this.observer.disconnect(); | ||||||
|         this.observer.observe(this.$widget[0], { |         this.observer.observe(this.$widget[0], { | ||||||
| @@ -111,15 +91,6 @@ export default class MobileEditorToolbar extends NoteContextAwareWidget { | |||||||
|         this.$widget[0].classList.toggle("dropdown-active", dropdownActive); |         this.$widget[0].classList.toggle("dropdown-active", dropdownActive); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     #adjustPosition() { |  | ||||||
|         let bottom = window.innerHeight - (window.visualViewport?.height || 0); |  | ||||||
|  |  | ||||||
|         // When the keyboard is not visible, align it to the launcher bar instead. |  | ||||||
|         bottom = Math.max(bottom, document.getElementById("mobile-bottom-bar")?.offsetHeight || 0); |  | ||||||
|  |  | ||||||
|         this.$widget.css("bottom", `${bottom}px`); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     async #shouldDisplay() { |     async #shouldDisplay() { | ||||||
|         if (!this.note || this.note.type !== "text") { |         if (!this.note || this.note.type !== "text") { | ||||||
|             return false; |             return false; | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ | |||||||
|     <link rel="shortcut icon" href="favicon.ico"> |     <link rel="shortcut icon" href="favicon.ico"> | ||||||
|     <meta name="mobile-web-app-capable" content="yes"> |     <meta name="mobile-web-app-capable" content="yes"> | ||||||
| 	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> | 	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> | ||||||
| 	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover" /> | 	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover, interactive-widget=resizes-content" /> | ||||||
|     <meta name="theme-color" content="#fff"> |     <meta name="theme-color" content="#fff"> | ||||||
|     <title>TriliumNext Notes</title> |     <title>TriliumNext Notes</title> | ||||||
|     <link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest"> |     <link rel="manifest" crossorigin="use-credentials" href="manifest.webmanifest"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user