mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-30 11:42:26 +08:00
Make note-detail-empty always display autocompletion.
This commit is contained in:
parent
2387bbd17f
commit
dbca50d9b0
@ -18,10 +18,9 @@ const TPL = `
|
|||||||
width: 130px;
|
width: 130px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
padding; 10px;
|
|
||||||
border: 1px transparent solid;
|
border: 1px transparent solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.workspace-notes .workspace-note:hover {
|
.workspace-notes .workspace-note:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: 1px solid var(--main-border-color);
|
border: 1px solid var(--main-border-color);
|
||||||
@ -33,14 +32,14 @@ const TPL = `
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<div class="workspace-notes"></div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>${t('empty.open_note_instruction')}</label>
|
<label>${t('empty.open_note_instruction')}</label>
|
||||||
<div class="input-group">
|
<div class="input-group mt-1">
|
||||||
<input class="form-control note-autocomplete" placeholder="${t('empty.search_placeholder')}">
|
<input class="form-control note-autocomplete" placeholder="${t('empty.search_placeholder')}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="note-detail-empty-results"></div>
|
||||||
<div class="workspace-notes"></div>
|
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
export default class EmptyTypeWidget extends TypeWidget {
|
export default class EmptyTypeWidget extends TypeWidget {
|
||||||
@ -51,10 +50,12 @@ export default class EmptyTypeWidget extends TypeWidget {
|
|||||||
|
|
||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
this.$autoComplete = this.$widget.find(".note-autocomplete");
|
this.$autoComplete = this.$widget.find(".note-autocomplete");
|
||||||
|
this.$results = this.$widget.find(".note-detail-empty-results");
|
||||||
|
|
||||||
noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {
|
noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {
|
||||||
hideGoToSelectedNoteButton: true,
|
hideGoToSelectedNoteButton: true,
|
||||||
allowCreatingNotes: true
|
allowCreatingNotes: true,
|
||||||
|
container: this.$results
|
||||||
})
|
})
|
||||||
.on('autocomplete:noteselected', function(event, suggestion, dataset) {
|
.on('autocomplete:noteselected', function(event, suggestion, dataset) {
|
||||||
if (!suggestion.notePath) {
|
if (!suggestion.notePath) {
|
||||||
@ -84,15 +85,10 @@ export default class EmptyTypeWidget extends TypeWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatically trigger autocomplete on focus.
|
|
||||||
this.$autoComplete.on('focus', () => {
|
|
||||||
// simulate pressing down arrow to trigger autocomplete
|
|
||||||
this.$autoComplete.trigger($.Event('keydown', { which: 40 })); // arrow down
|
|
||||||
this.$autoComplete.trigger($.Event('keydown', { which: 38 })); // arrow up
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$autoComplete
|
this.$autoComplete
|
||||||
.trigger('focus')
|
.trigger('focus')
|
||||||
.trigger('select');
|
.trigger('select');
|
||||||
|
|
||||||
|
noteAutocompleteService.showRecentNotes(this.$autoComplete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user