From 1369cd8b1634f5894d9340eafd3abdbd083f5d43 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 18 Jan 2025 18:45:13 +0200 Subject: [PATCH] feat(client): implement move to available/visible launchers on mobile as well --- src/public/app/menus/launcher_context_menu.ts | 4 ++-- src/public/app/widgets/note_tree.js | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/public/app/menus/launcher_context_menu.ts b/src/public/app/menus/launcher_context_menu.ts index 8c2b157cd..3c4fb68f3 100644 --- a/src/public/app/menus/launcher_context_menu.ts +++ b/src/public/app/menus/launcher_context_menu.ts @@ -34,8 +34,8 @@ export default class LauncherContextMenu implements SelectMenuItemEventListener< const isVisibleRoot = note?.noteId === "_lbVisibleLaunchers"; const isAvailableRoot = note?.noteId === "_lbAvailableLaunchers"; - const isVisibleItem = parentNoteId === "_lbVisibleLaunchers"; - const isAvailableItem = parentNoteId === "_lbAvailableLaunchers"; + const isVisibleItem = (parentNoteId === "_lbVisibleLaunchers" || parentNoteId === "_lbMobileVisibleLaunchers"); + const isAvailableItem = (parentNoteId === "_lbAvailableLaunchers" || parentNoteId === "_lbMobileAvailableLaunchers"); const isItem = isVisibleItem || isAvailableItem; const canBeDeleted = !note?.noteId.startsWith("_"); // fixed notes can't be deleted const canBeReset = !canBeDeleted && note?.isLaunchBarConfig(); diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js index 158a31677..4afe57117 100644 --- a/src/public/app/widgets/note_tree.js +++ b/src/public/app/widgets/note_tree.js @@ -1637,11 +1637,23 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { } moveLauncherToVisibleCommand({ selectedOrActiveBranchIds }) { - branchService.moveToParentNote(selectedOrActiveBranchIds, "_lbRoot__lbVisibleLaunchers"); + this.#moveLaunchers(selectedOrActiveBranchIds, "_lbVisibleLaunchers", "_lbMobileVisibleLaunchers"); } moveLauncherToAvailableCommand({ selectedOrActiveBranchIds }) { - branchService.moveToParentNote(selectedOrActiveBranchIds, "_lbRoot__lbAvailableLaunchers"); + this.#moveLaunchers(selectedOrActiveBranchIds, "_lbAvailableLaunchers", "_lbMobileAvailableLaunchers"); + } + + #moveLaunchers(selectedOrActiveBranchIds, desktopParent, mobileParent) { + const desktopLaunchersToMove = selectedOrActiveBranchIds.filter((branchId) => !branchId.startsWith("_lbMobile")); + if (desktopLaunchersToMove) { + branchService.moveToParentNote(desktopLaunchersToMove, "_lbRoot_" + desktopParent); + } + + const mobileLaunchersToMove = selectedOrActiveBranchIds.filter((branchId) => branchId.startsWith("_lbMobile")); + if (mobileLaunchersToMove) { + branchService.moveToParentNote(mobileLaunchersToMove, "_lbMobileRoot_" + mobileParent); + } } addNoteLauncherCommand({ node }) {