mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
change tree node icon for selected notes to quickly bring up bulk action dialog
This commit is contained in:
@@ -307,7 +307,14 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
const targetType = data.targetType;
|
||||
const node = data.node;
|
||||
|
||||
if (targetType === 'title' || targetType === 'icon') {
|
||||
if (node.isSelected() && targetType === 'icon') {
|
||||
this.triggerCommand('openBulkActionsDialog', {
|
||||
selectedOrActiveNoteIds: this.getSelectedOrActiveNoteIds(node)
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (targetType === 'title' || targetType === 'icon') {
|
||||
if (event.shiftKey) {
|
||||
const activeNode = this.getActiveNode();
|
||||
|
||||
@@ -540,8 +547,9 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
}
|
||||
});
|
||||
},
|
||||
select: () => {
|
||||
// TODO
|
||||
select: (event, {node}) => {
|
||||
$(node.span).find(".fancytree-custom-icon").attr("title",
|
||||
node.isSelected() ? "Apply bulk actions on selected notes" : "");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1288,6 +1296,15 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
||||
return nodes.map(node => node.data.branchId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {FancytreeNode} node
|
||||
*/
|
||||
getSelectedOrActiveNoteIds(node) {
|
||||
const nodes = this.getSelectedOrActiveNodes(node);
|
||||
|
||||
return nodes.map(node => node.data.noteId);
|
||||
}
|
||||
|
||||
async deleteNotesCommand({node}) {
|
||||
const branchIds = this.getSelectedOrActiveBranchIds(node)
|
||||
.filter(branchId => !branchId.startsWith('virt-')); // search results can't be deleted
|
||||
|
||||
Reference in New Issue
Block a user