mirror of
https://github.com/zadam/trilium.git
synced 2025-02-20 21:13:11 +08:00
add "erase all deleted notes now" also to recent changes
This commit is contained in:
parent
d9dac00a01
commit
d388b4d814
1 changed files with 21 additions and 6 deletions
|
@ -7,6 +7,7 @@ import appContext from "../../services/app_context.js";
|
|||
import hoistedNoteService from "../../services/hoisted_note.js";
|
||||
import BasicWidget from "../basic_widget.js";
|
||||
import dialogService from "../dialog.js";
|
||||
import toastService from "../../services/toast.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="recent-changes-dialog modal fade mx-auto" tabindex="-1" role="dialog">
|
||||
|
@ -14,7 +15,11 @@ const TPL = `
|
|||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Recent changes</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
|
||||
<button class="erase-deleted-notes-now-button btn btn-xs" style="padding: 0 10px">
|
||||
Erase deleted notes now</button>
|
||||
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -29,20 +34,30 @@ export default class RecentChangesDialog extends BasicWidget {
|
|||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$content = this.$widget.find(".recent-changes-content");
|
||||
this.$eraseDeletedNotesNow = this.$widget.find(".erase-deleted-notes-now-button");
|
||||
this.$eraseDeletedNotesNow.on("click", () => {
|
||||
server.post('notes/erase-deleted-notes-now').then(() => {
|
||||
this.refresh();
|
||||
|
||||
toastService.showMessage("Deleted notes have been erased.");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async showRecentChangesEvent({ancestorNoteId}) {
|
||||
await this.refresh(ancestorNoteId);
|
||||
this.ancestorNoteId = ancestorNoteId;
|
||||
|
||||
await this.refresh();
|
||||
|
||||
utils.openDialog(this.$widget);
|
||||
}
|
||||
|
||||
async refresh(ancestorNoteId) {
|
||||
if (!ancestorNoteId) {
|
||||
ancestorNoteId = hoistedNoteService.getHoistedNoteId();
|
||||
async refresh() {
|
||||
if (!this.ancestorNoteId) {
|
||||
this.ancestorNoteId = hoistedNoteService.getHoistedNoteId();
|
||||
}
|
||||
|
||||
const recentChangesRows = await server.get('recent-changes/' + ancestorNoteId);
|
||||
const recentChangesRows = await server.get('recent-changes/' + this.ancestorNoteId);
|
||||
|
||||
// preload all notes into cache
|
||||
await froca.getNotes(recentChangesRows.map(r => r.noteId), true);
|
||||
|
|
Loading…
Reference in a new issue