Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
mobile layout fixes + fix mobile delete note
zadam1e1709ca6abe
diff --git a/src/public/app/layouts/mobile_layout.js b/src/public/app/layouts/mobile_layout.jsindex a1eb75cb9c..ae994cc581 100644--- a/src/public/app/layouts/mobile_layout.js+++ b/src/public/app/layouts/mobile_layout.js@@ -76,13 +76,13 @@ export default class MobileLayout {.child(new NoteTreeWidget("main").cssBlock(FANCYTREE_CSS))).child(new ScreenContainer("detail", "column").class("d-sm-flex d-md-flex d-lg-flex d-xl-flex col-12 col-sm-7 col-md-8 col-lg-8")- .child(new FlexContainer('row')+ .child(new FlexContainer('row').overflowing()+ .css('font-size', 'larger')+ .css('align-items', 'center').child(new MobileDetailMenuWidget())- .child(new NoteTitleWidget()- .css('padding', '10px')- .css('font-size', 'larger'))+ .child(new NoteTitleWidget()).child(new CloseDetailButtonWidget())).child(new NoteDetailWidget().css('padding', '5px 20px 10px 0')));}-}\ No newline at end of file+}diff --git a/src/public/app/services/tree.js b/src/public/app/services/tree.jsindex 9f82375423..bc1b3e0a75 100644--- a/src/public/app/services/tree.js+++ b/src/public/app/services/tree.js@@ -158,6 +158,12 @@ function getNoteIdFromNotePath(notePath) {return lastSegment.split("-")[0];}+async function getBranchIdFromNotePath(notePath) {+ const {noteId, parentNoteId} = getNoteIdAndParentIdFromNotePath(notePath);++ return await treeCache.getBranchId(parentNoteId, noteId);+}+function getNoteIdAndParentIdFromNotePath(notePath) {if (notePath === 'root') {return {@@ -185,7 +191,7 @@ function getNoteIdAndParentIdFromNotePath(notePath) {return {parentNoteId,noteId- }+ };}function getNotePath(node) {@@ -286,6 +292,7 @@ export default {getNotePath,getNoteIdFromNotePath,getNoteIdAndParentIdFromNotePath,+ getBranchIdFromNotePath,getNoteTitle,getNotePathTitle,getHashValueFromAddress,diff --git a/src/public/app/widgets/mobile_widgets/close_detail_button.js b/src/public/app/widgets/mobile_widgets/close_detail_button.jsindex 038a606b23..af4ab4c4a7 100644--- a/src/public/app/widgets/mobile_widgets/close_detail_button.js+++ b/src/public/app/widgets/mobile_widgets/close_detail_button.js@@ -1,13 +1,14 @@import BasicWidget from "../basic_widget.js";const TPL = `-<button type="button" class="action-button d-sm-none d-md-none d-lg-none d-xl-none" aria-label="Close">+<button type="button" class="action-button d-sm-none d-md-none d-lg-none d-xl-none" aria-label="Close" style="padding-top: 10px;"><span aria-hidden="true">×</span></button>`;class CloseDetailButtonWidget extends BasicWidget {doRender() {this.$widget = $(TPL);+ this.overflowing();this.$widget.on('click', () => this.triggerCommand('setActiveScreen', {screen:'tree'}));}diff --git a/src/public/app/widgets/mobile_widgets/mobile_detail_menu.js b/src/public/app/widgets/mobile_widgets/mobile_detail_menu.jsindex 6eacc43302..eb41682972 100644--- a/src/public/app/widgets/mobile_widgets/mobile_detail_menu.js+++ b/src/public/app/widgets/mobile_widgets/mobile_detail_menu.js@@ -3,12 +3,14 @@ import appContext from "../../services/app_context.js";import contextMenu from "../../services/context_menu.js";import noteCreateService from "../../services/note_create.js";import branchService from "../../services/branches.js";+import treeService from "../../services/tree.js";-const TPL = `<button type="button" class="action-button bx bx-menu"></button>`;+const TPL = `<button type="button" class="action-button bx bx-menu" style="padding-top: 10px;"></button>`;class MobileDetailMenuWidget extends BasicWidget {doRender() {this.$widget = $(TPL);+ this.overflowing();this.$widget.on("click", async e => {const note = appContext.tabManager.getActiveTabNote();@@ -27,9 +29,15 @@ class MobileDetailMenuWidget extends BasicWidget {noteCreateService.createNote(note.noteId);}else if (command === "delete") {- if (await branchService.deleteNotes(note.getBranchIds()[0])) {- // move to the tree- togglePanes();+ const notePath = appContext.tabManager.getActiveTabNotePath();+ const branchId = await treeService.getBranchIdFromNotePath(notePath);++ if (!branchId) {+ throw new Error(`Cannot get branchId for notePath ${notePath}`);+ }++ if (await branchService.deleteNotes([branchId])) {+ this.triggerCommand('setActiveScreen', {screen:'tree'})}}else {diff --git a/src/public/app/widgets/mobile_widgets/mobile_global_buttons.js b/src/public/app/widgets/mobile_widgets/mobile_global_buttons.jsindex 629794ae68..beb09c2260 100644--- a/src/public/app/widgets/mobile_widgets/mobile_global_buttons.js+++ b/src/public/app/widgets/mobile_widgets/mobile_global_buttons.js@@ -32,8 +32,9 @@ const WIDGET_TPL = `class MobileGlobalButtonsWidget extends BasicWidget {doRender() {- return this.$widget = $(WIDGET_TPL);+ this.$widget = $(WIDGET_TPL);+ this.overflowing();}}-export default MobileGlobalButtonsWidget;\ No newline at end of file+export default MobileGlobalButtonsWidget;diff --git a/src/views/mobile.ejs b/src/views/mobile.ejsindex dc8988871f..85e6797b77 100644--- a/src/views/mobile.ejs+++ b/src/views/mobile.ejs@@ -101,6 +101,8 @@<div class="dropdown-menu dropdown-menu-sm" id="context-menu-container"></div>+<%- include('dialogs/confirm.ejs') %>+<script type="text/javascript">window.baseApiUrl = 'api/';window.device = "mobile";