Skip to content

Build your personal knowledge base with Trilium Notes

Fix keyboard shortcut support and address code review feedback

copilot-swe-agent[bot]50a69248a76f
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 0000000000..3470f1018e
--- /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 26f6f0dff1..e715c894f6 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 (
<Modal
className="branch-prefix-dialog"
- title={t(titleKey, { count: branches.length })}
+ title={isSingleBranch ? t("branch_prefix.edit_branch_prefix") : t("branch_prefix.edit_branch_prefix_multiple", { count: branches.length })}
size="lg"
onShown={() => branchInput.current?.focus()}
onHidden={() => setShown(false)}
@@ -108,14 +108,14 @@ export default function BranchPrefixDialog() {
</div>
</FormGroup>
{!isSingleBranch && (
- <div className="branch-prefix-notes-list" style={{ marginTop: "10px" }}>
+ <div className="branch-prefix-notes-list">
<strong>{t("branch_prefix.affected_branches", { count: branches.length })}</strong>
- <ul style={{ maxHeight: "200px", overflow: "auto", marginTop: "5px" }}>
+ <ul>
{branches.map((branch) => {
const note = branch.getNoteFromCache();
return (
<li key={branch.branchId}>
- {branch.prefix && <span style={{ color: "#888" }}>{branch.prefix} - </span>}
+ {branch.prefix && <span className="branch-prefix-current">{branch.prefix} - </span>}
{note.title}
</li>
);
diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.ts
index f1c2ca7363..cb21206870 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;