mirror of https://github.com/TriliumNext/Notes
empty widget type works
parent
746181689f
commit
adb9ce5e93
@ -0,0 +1,61 @@
|
|||||||
|
import noteAutocompleteService from '../../services/note_autocomplete.js';
|
||||||
|
import treeService from "../../services/tree.js";
|
||||||
|
import TypeWidget from "./type_widget.js";
|
||||||
|
|
||||||
|
const TPL = `
|
||||||
|
<div class="note-detail-empty note-detail-printable">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Open note by typing note's title into input below or choose a note in the tree.</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input class="form-control note-autocomplete" placeholder="search for note by its name">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
class NoteDetailEmpty extends TypeWidget {
|
||||||
|
static getType() { return "empty"; }
|
||||||
|
|
||||||
|
doRender() {
|
||||||
|
// FIXME: this might be optimized - cleaned up after use since it's always used only for new tab
|
||||||
|
|
||||||
|
this.$widget = $(TPL);
|
||||||
|
this.$autoComplete = this.$widget.find(".note-autocomplete");
|
||||||
|
|
||||||
|
noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, { hideGoToSelectedNoteButton: true })
|
||||||
|
.on('autocomplete:selected', function(event, suggestion, dataset) {
|
||||||
|
if (!suggestion.path) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
treeService.activateNote(suggestion.path);
|
||||||
|
});
|
||||||
|
|
||||||
|
noteAutocompleteService.showRecentNotes(this.$autoComplete);
|
||||||
|
this.$autoComplete.trigger('focus');
|
||||||
|
|
||||||
|
return this.$widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh() {
|
||||||
|
if (this.tabContext.note) {
|
||||||
|
this.toggle(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.toggle(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
show() {}
|
||||||
|
|
||||||
|
getContent() {}
|
||||||
|
|
||||||
|
focus() {}
|
||||||
|
|
||||||
|
onNoteChange() {}
|
||||||
|
|
||||||
|
cleanup() {}
|
||||||
|
|
||||||
|
scrollToTop() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NoteDetailEmpty;
|
||||||
@ -1,44 +0,0 @@
|
|||||||
import noteAutocompleteService from '../../services/note_autocomplete.js';
|
|
||||||
import treeService from "../../services/tree.js";
|
|
||||||
|
|
||||||
class NoteDetailEmpty {
|
|
||||||
/**
|
|
||||||
* @param {TabContext} ctx
|
|
||||||
*/
|
|
||||||
constructor(ctx) {
|
|
||||||
this.ctx = ctx;
|
|
||||||
this.$component = ctx.$tabContent.find('.note-detail-empty');
|
|
||||||
this.$autoComplete = ctx.$tabContent.find(".note-autocomplete");
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
this.$component.show();
|
|
||||||
this.ctx.$noteTitleRow.hide();
|
|
||||||
|
|
||||||
noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, { hideGoToSelectedNoteButton: true })
|
|
||||||
.on('autocomplete:selected', function(event, suggestion, dataset) {
|
|
||||||
if (!suggestion.path) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
treeService.activateNote(suggestion.path);
|
|
||||||
});
|
|
||||||
|
|
||||||
noteAutocompleteService.showRecentNotes(this.$autoComplete);
|
|
||||||
this.$autoComplete.trigger('focus');
|
|
||||||
}
|
|
||||||
|
|
||||||
show() {}
|
|
||||||
|
|
||||||
getContent() {}
|
|
||||||
|
|
||||||
focus() {}
|
|
||||||
|
|
||||||
onNoteChange() {}
|
|
||||||
|
|
||||||
cleanup() {}
|
|
||||||
|
|
||||||
scrollToTop() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default NoteDetailEmpty;
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<div class="note-detail-empty note-detail-printable">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Open note by typing note's title into input below or choose a note in the tree.</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<input class="form-control note-autocomplete" placeholder="search for note by its name">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
Loading…
Reference in New Issue