added context menu "recent changes in subtree"

This commit is contained in:
zadam 2020-03-29 19:43:04 +02:00
parent cc298b1e7a
commit 189202b1f6
3 changed files with 14 additions and 3 deletions

View file

@ -9,10 +9,14 @@ import hoistedNoteService from "../services/hoisted_note.js";
const $dialog = $("#recent-changes-dialog");
const $content = $("#recent-changes-content");
export async function showDialog() {
export async function showDialog(ancestorNoteId) {
utils.openDialog($dialog);
const result = await server.get('recent-changes/' + hoistedNoteService.getHoistedNoteId());
if (!ancestorNoteId) {
ancestorNoteId = hoistedNoteService.getHoistedNoteId();
}
const result = await server.get('recent-changes/' + ancestorNoteId);
// preload all notes into cache
await treeCache.getNotes(result.map(r => r.noteId), true);

View file

@ -75,7 +75,8 @@ class TreeContextMenu {
{ title: "Advanced", uiIcon: "empty", enabled: true, items: [
{ title: 'Collapse subtree <kbd data-command="collapseSubtree"></kbd>', command: "collapseSubtree", uiIcon: "align-justify", enabled: noSelectedNotes },
{ title: "Force note sync", command: "forceNoteSync", uiIcon: "refresh", enabled: noSelectedNotes },
{ title: 'Sort alphabetically <kbd data-command="sortChildNotes"></kbd>', command: "sortChildNotes", uiIcon: "empty", enabled: noSelectedNotes && notSearch }
{ title: 'Sort alphabetically <kbd data-command="sortChildNotes"></kbd>', command: "sortChildNotes", uiIcon: "empty", enabled: noSelectedNotes && notSearch },
{ title: 'Recent changes in subtree', command: "recentChangesInSubtree", uiIcon: "history", enabled: noSelectedNotes }
] },
{ title: "----" },
{ title: "Protect subtree", command: "protectSubtree", uiIcon: "check-shield", enabled: noSelectedNotes },

View file

@ -737,6 +737,12 @@ export default class NoteTreeWidget extends TabAwareWidget {
treeService.sortAlphabetically(node.data.noteId);
}
async recentChangesInSubtreeCommand({node}) {
const recentChangesDialog = await import('../dialogs/recent_changes.js');
recentChangesDialog.showDialog(node.data.noteId);
}
selectAllNotesInParentCommand({node}) {
for (const child of node.getParent().getChildren()) {
child.setSelected(true);