mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 13:26:01 +01:00
improvements in search UI
This commit is contained in:
@@ -1,20 +1,25 @@
|
||||
import TabAwareWidget from "./tab_aware_widget.js";
|
||||
import NoteListRenderer from "../services/note_list_renderer.js";
|
||||
import utils from "../services/utils.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="note-list-widget">
|
||||
<style>
|
||||
.note-list-widget {
|
||||
flex-grow: 100000;
|
||||
padding: 0 10px 10px 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.note-list-widget {
|
||||
flex-grow: 100000;
|
||||
flex-shrink: 100000;
|
||||
min-height: 0;
|
||||
padding: 0 10px 10px 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="note-list-widget-content">
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
export default class NoteListWidget extends TabAwareWidget {
|
||||
isEnabled() {
|
||||
return super.isEnabled() && !this.tabContext.autoBookDisabled && (
|
||||
return super.isEnabled() && (
|
||||
['book', 'search'].includes(this.note.type)
|
||||
|| (this.note.type === 'text' && this.note.hasChildren())
|
||||
);
|
||||
@@ -22,13 +27,23 @@ export default class NoteListWidget extends TabAwareWidget {
|
||||
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$content = this.$widget.find('.note-list-widget-content');
|
||||
this.contentSized();
|
||||
}
|
||||
|
||||
async refreshWithNote(note) {
|
||||
// this.tabContext.autoBookDisabled;
|
||||
//
|
||||
// const noteComplement = await this.tabContext.getNoteComplement();
|
||||
//
|
||||
// if (utils.isHtmlEmpty(noteComplement.content)) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
|
||||
const noteListRenderer = new NoteListRenderer(note, note.getChildNoteIds());
|
||||
|
||||
this.$widget.empty().append(await noteListRenderer.renderList());
|
||||
this.$content.empty().append(await noteListRenderer.renderList());
|
||||
}
|
||||
|
||||
autoBookDisabledEvent({tabContext}) {
|
||||
@@ -36,4 +51,10 @@ export default class NoteListWidget extends TabAwareWidget {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
searchResultsUpdatedEvent({searchNoteIds}) {
|
||||
if (searchNoteIds.includes(this.noteId)) {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user