diff --git a/apps/client/src/widgets/dialogs/branch_prefix.css b/apps/client/src/widgets/dialogs/branch_prefix.css new file mode 100644 index 000000000..3470f1018 --- /dev/null +++ b/apps/client/src/widgets/dialogs/branch_prefix.css @@ -0,0 +1,13 @@ +.branch-prefix-dialog .branch-prefix-notes-list { + margin-top: 10px; +} + +.branch-prefix-dialog .branch-prefix-notes-list ul { + max-height: 200px; + overflow: auto; + margin-top: 5px; +} + +.branch-prefix-dialog .branch-prefix-current { + opacity: 0.6; +} diff --git a/apps/client/src/widgets/dialogs/branch_prefix.tsx b/apps/client/src/widgets/dialogs/branch_prefix.tsx index 26f6f0dff..e715c894f 100644 --- a/apps/client/src/widgets/dialogs/branch_prefix.tsx +++ b/apps/client/src/widgets/dialogs/branch_prefix.tsx @@ -11,6 +11,7 @@ import FormGroup from "../react/FormGroup.js"; import { useTriliumEvent } from "../react/hooks.jsx"; import FBranch from "../../entities/fbranch.js"; import type { ContextMenuCommandData } from "../../components/app_context.js"; +import "./branch_prefix.css"; // Virtual branches (e.g., from search results) start with this prefix const VIRTUAL_BRANCH_PREFIX = "virt-"; @@ -84,12 +85,11 @@ export default function BranchPrefixDialog() { } const isSingleBranch = branches.length === 1; - const titleKey = isSingleBranch ? "branch_prefix.edit_branch_prefix" : "branch_prefix.edit_branch_prefix_multiple"; return ( branchInput.current?.focus()} onHidden={() => setShown(false)} @@ -108,14 +108,14 @@ export default function BranchPrefixDialog() { {!isSingleBranch && ( -
+
{t("branch_prefix.affected_branches", { count: branches.length })} -
    +
      {branches.map((branch) => { const note = branch.getNoteFromCache(); return (
    • - {branch.prefix && {branch.prefix} - } + {branch.prefix && {branch.prefix} - } {note.title}
    • ); diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.ts index f1c2ca736..cb2120687 100644 --- a/apps/client/src/widgets/note_tree.ts +++ b/apps/client/src/widgets/note_tree.ts @@ -1591,6 +1591,20 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { this.clearSelectedNodes(); } + async editBranchPrefixCommand({ node }: CommandListenerData<"editBranchPrefix">) { + const branchIds = this.getSelectedOrActiveBranchIds(node).filter((branchId) => !branchId.startsWith("virt-")); + + if (!branchIds.length) { + return; + } + + // Trigger the event with the selected branch IDs + appContext.triggerEvent("editBranchPrefix", { + selectedOrActiveBranchIds: branchIds, + node: node + }); + } + canBeMovedUpOrDown(node: Fancytree.FancytreeNode) { if (node.data.noteId === "root") { return false;