mirror of
https://github.com/zadam/trilium.git
synced 2024-09-23 09:06:00 +08:00
added context menu "recent changes in subtree"
This commit is contained in:
parent
cc298b1e7a
commit
189202b1f6
|
@ -9,10 +9,14 @@ import hoistedNoteService from "../services/hoisted_note.js";
|
||||||
const $dialog = $("#recent-changes-dialog");
|
const $dialog = $("#recent-changes-dialog");
|
||||||
const $content = $("#recent-changes-content");
|
const $content = $("#recent-changes-content");
|
||||||
|
|
||||||
export async function showDialog() {
|
export async function showDialog(ancestorNoteId) {
|
||||||
utils.openDialog($dialog);
|
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
|
// preload all notes into cache
|
||||||
await treeCache.getNotes(result.map(r => r.noteId), true);
|
await treeCache.getNotes(result.map(r => r.noteId), true);
|
||||||
|
|
|
@ -75,7 +75,8 @@ class TreeContextMenu {
|
||||||
{ title: "Advanced", uiIcon: "empty", enabled: true, items: [
|
{ title: "Advanced", uiIcon: "empty", enabled: true, items: [
|
||||||
{ title: 'Collapse subtree <kbd data-command="collapseSubtree"></kbd>', command: "collapseSubtree", uiIcon: "align-justify", enabled: noSelectedNotes },
|
{ 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: "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: "----" },
|
||||||
{ title: "Protect subtree", command: "protectSubtree", uiIcon: "check-shield", enabled: noSelectedNotes },
|
{ title: "Protect subtree", command: "protectSubtree", uiIcon: "check-shield", enabled: noSelectedNotes },
|
||||||
|
|
|
@ -737,6 +737,12 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||||
treeService.sortAlphabetically(node.data.noteId);
|
treeService.sortAlphabetically(node.data.noteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async recentChangesInSubtreeCommand({node}) {
|
||||||
|
const recentChangesDialog = await import('../dialogs/recent_changes.js');
|
||||||
|
|
||||||
|
recentChangesDialog.showDialog(node.data.noteId);
|
||||||
|
}
|
||||||
|
|
||||||
selectAllNotesInParentCommand({node}) {
|
selectAllNotesInParentCommand({node}) {
|
||||||
for (const child of node.getParent().getChildren()) {
|
for (const child of node.getParent().getChildren()) {
|
||||||
child.setSelected(true);
|
child.setSelected(true);
|
||||||
|
|
Loading…
Reference in a new issue