mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
full search should be already triggered when going from quick search
This commit is contained in:
parent
703fbd30df
commit
c115628f1f
1
TODO
1
TODO
@ -1,3 +1,4 @@
|
|||||||
- new icon
|
- new icon
|
||||||
- polish becca entities API
|
- polish becca entities API
|
||||||
- separate private and public APIs in becca entities
|
- separate private and public APIs in becca entities
|
||||||
|
- what to do with calendar, edited_notes and what_links_here?
|
||||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -8508,9 +8508,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "7.5.1",
|
"version": "7.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.2.tgz",
|
||||||
"integrity": "sha512-2c6faOUH/nhoQN6abwMloF7Iyl0ZS2E9HGtsiLrWn0zOOMWlhtDmdf/uihDt6jnuCxgtwGBNy6Onsoy2s2O2Ow=="
|
"integrity": "sha512-lkF7AWRicoB9mAgjeKbGqVUekLnSNO4VjKVnuPHpQeOxZOErX6BPXwJk70nFslRCEEA8EVW7ZjKwXaP9N+1sKQ=="
|
||||||
},
|
},
|
||||||
"xdg-basedir": {
|
"xdg-basedir": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
"tmp": "^0.2.1",
|
"tmp": "^0.2.1",
|
||||||
"turndown": "7.1.1",
|
"turndown": "7.1.1",
|
||||||
"unescape": "1.0.1",
|
"unescape": "1.0.1",
|
||||||
"ws": "7.5.1",
|
"ws": "7.5.2",
|
||||||
"yauzl": "2.10.0"
|
"yauzl": "2.10.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,115 +0,0 @@
|
|||||||
import server from "../../services/server.js";
|
|
||||||
import CollapsibleWidget from "../collapsible_widget.js";
|
|
||||||
|
|
||||||
const TPL = `
|
|
||||||
<ul class="note-revision-list" style="max-height: 150px; overflow: auto;">
|
|
||||||
</ul>
|
|
||||||
`;
|
|
||||||
|
|
||||||
class NoteRevisionsWidget extends CollapsibleWidget {
|
|
||||||
isEnabled() {
|
|
||||||
return super.isEnabled() && !this.note.hasLabel('noteRevisionsWidgetDisabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
get widgetTitle() { return "Note revisions"; }
|
|
||||||
|
|
||||||
get help() {
|
|
||||||
return {
|
|
||||||
title: "Note revisions track changes in the note across the time.",
|
|
||||||
url: "https://github.com/zadam/trilium/wiki/Note-revisions"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
get headerActions() {
|
|
||||||
const $showFullButton = $("<a>")
|
|
||||||
.addClass("bx bx-list-ul")
|
|
||||||
.addClass('widget-header-action')
|
|
||||||
.attr('title', 'Show Note revisions dialog');
|
|
||||||
|
|
||||||
$showFullButton.on('click', async () => {
|
|
||||||
const attributesDialog = await import("../../dialogs/note_revisions.js");
|
|
||||||
attributesDialog.showCurrentNoteRevisions(this.noteId);
|
|
||||||
});
|
|
||||||
|
|
||||||
return [$showFullButton];
|
|
||||||
}
|
|
||||||
|
|
||||||
noteSwitched() {
|
|
||||||
const noteId = this.noteId;
|
|
||||||
|
|
||||||
// avoid executing this expensive operation multiple times when just going through notes (with keyboard especially)
|
|
||||||
// until the users settles on a note
|
|
||||||
setTimeout(() => {
|
|
||||||
if (this.noteId === noteId) {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
async refreshWithNote(note) {
|
|
||||||
const revisionItems = await server.get(`notes/${note.noteId}/revisions`);
|
|
||||||
|
|
||||||
if (revisionItems.length === 0) {
|
|
||||||
this.$body.text("No revisions yet...");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const groupedRevisionItems = this.getGroupedRevisionItems(revisionItems);
|
|
||||||
|
|
||||||
if (note.noteId !== this.noteId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$body.html(TPL);
|
|
||||||
|
|
||||||
const $list = this.$body.find('.note-revision-list');
|
|
||||||
|
|
||||||
for (const [date, items] of groupedRevisionItems) {
|
|
||||||
const $listItem = $('<li>').append($("<strong>").text(date + ": "));
|
|
||||||
const revsWithinADay = [];
|
|
||||||
|
|
||||||
for (const item of items) {
|
|
||||||
const $rev = $("<span>");
|
|
||||||
|
|
||||||
|
|
||||||
$rev.append($("<a>", {
|
|
||||||
'data-action': 'note-revision',
|
|
||||||
'data-note-path': note.noteId,
|
|
||||||
'data-note-revision-id': item.noteRevisionId,
|
|
||||||
title: 'This revision was last edited on ' + item.dateLastEdited,
|
|
||||||
href: 'javascript:'
|
|
||||||
})
|
|
||||||
.text(item.dateLastEdited.substr(11, 5)));
|
|
||||||
|
|
||||||
revsWithinADay.push($rev.html());
|
|
||||||
}
|
|
||||||
|
|
||||||
$listItem.append(revsWithinADay.join(", "));
|
|
||||||
$list.append($listItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getGroupedRevisionItems(revisionItems) {
|
|
||||||
const grouped = new Map(); // map preserves order of insertion
|
|
||||||
|
|
||||||
for (const item of revisionItems) {
|
|
||||||
const [date] = item.dateLastEdited.substr(0, 16).split(" ");
|
|
||||||
|
|
||||||
if (!grouped.has(date)) {
|
|
||||||
grouped.set(date, []);
|
|
||||||
}
|
|
||||||
|
|
||||||
grouped.get(date).push(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return grouped;
|
|
||||||
}
|
|
||||||
|
|
||||||
entitiesReloadedEvent({loadResults}) {
|
|
||||||
if (loadResults.hasNoteRevisionForNote(this.noteId)) {
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default NoteRevisionsWidget;
|
|
@ -136,6 +136,8 @@ export default class QuickSearchWidget extends BasicWidget {
|
|||||||
async showInFullSearch() {
|
async showInFullSearch() {
|
||||||
const searchNote = await dateNotesService.createSearchNote({searchString: this.$searchString.val()});
|
const searchNote = await dateNotesService.createSearchNote({searchString: this.$searchString.val()});
|
||||||
|
|
||||||
|
await froca.loadSearchNote(searchNote.noteId);
|
||||||
|
|
||||||
await appContext.tabManager.getActiveContext().setNote(searchNote.noteId);
|
await appContext.tabManager.getActiveContext().setNote(searchNote.noteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user