mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 10:40:41 +01:00
Implement multi-branch prefix editing functionality
- Add setPrefixBatch API endpoint to handle batch prefix updates - Update branch_prefix dialog to support multiple branches - Remove noSelectedNotes constraint from edit branch prefix menu - Add translations for multi-branch prefix editing Co-authored-by: eliandoran <21236836+eliandoran@users.noreply.github.com>
This commit is contained in:
@@ -270,6 +270,29 @@ function setPrefix(req: Request) {
|
||||
branch.save();
|
||||
}
|
||||
|
||||
function setPrefixBatch(req: Request) {
|
||||
const { branchIds, prefix } = req.body;
|
||||
|
||||
if (!Array.isArray(branchIds)) {
|
||||
throw new ValidationError("branchIds must be an array");
|
||||
}
|
||||
|
||||
const normalizedPrefix = utils.isEmptyOrWhitespace(prefix) ? null : prefix;
|
||||
|
||||
for (const branchId of branchIds) {
|
||||
const branch = becca.getBranch(branchId);
|
||||
if (branch) {
|
||||
branch.prefix = normalizedPrefix;
|
||||
branch.save();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
count: branchIds.length
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
moveBranchToParent,
|
||||
moveBranchBeforeNote,
|
||||
@@ -277,5 +300,6 @@ export default {
|
||||
setExpanded,
|
||||
setExpandedForSubtree,
|
||||
deleteBranch,
|
||||
setPrefix
|
||||
setPrefix,
|
||||
setPrefixBatch
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user