diff --git a/src/public/app/layouts/mobile_layout.js b/src/public/app/layouts/mobile_layout.js index a1eb75cb9..ae994cc58 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.js index 9f8237542..bc1b3e0a7 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.js index 038a606b2..af4ab4c4a 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 = ` -`; 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.js index 6eacc4330..eb4168297 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 = ``; +const TPL = ``; 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.js index 629794ae6..beb09c226 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.ejs index dc8988871..85e6797b7 100644 --- a/src/views/mobile.ejs +++ b/src/views/mobile.ejs @@ -101,6 +101,8 @@ +<%- include('dialogs/confirm.ejs') %> +