bring back "create and link note" into more places, fixes #1653

This commit is contained in:
zadam 2021-02-18 20:10:44 +01:00
parent 4cbf9c2e86
commit 0c9a11db6f
6 changed files with 15 additions and 6 deletions

View file

@ -41,7 +41,10 @@ export async function showDialog(widget, text = '') {
$linkTitle.val(noteTitle);
}
noteAutocompleteService.initNoteAutocomplete($autoComplete, { allowExternalLinks: true });
noteAutocompleteService.initNoteAutocomplete($autoComplete, {
allowExternalLinks: true,
allowCreatingNotes: true
});
$autoComplete.on('autocomplete:noteselected', (event, suggestion, dataset) => {
if (!suggestion.notePath) {

View file

@ -17,7 +17,10 @@ export async function showDialog(widget) {
utils.openDialog($dialog);
noteAutocompleteService.initNoteAutocomplete($autoComplete, { hideGoToSelectedNoteButton: true });
noteAutocompleteService.initNoteAutocomplete($autoComplete, {
hideGoToSelectedNoteButton: true,
allowCreatingNotes: true
});
noteAutocompleteService.showRecentNotes($autoComplete);
}

View file

@ -279,7 +279,7 @@ export default class AttributeDetailWidget extends TabAwareWidget {
this.$rowTargetNote = this.$widget.find('.attr-row-target-note');
this.$inputTargetNote = this.$widget.find('.attr-input-target-note');
noteAutocompleteService.initNoteAutocomplete(this.$inputTargetNote)
noteAutocompleteService.initNoteAutocomplete(this.$inputTargetNote, {allowCreatingNotes: true})
.on('autocomplete:noteselected', (event, suggestion, dataset) => {
if (!suggestion.notePath) {
return false;

View file

@ -50,7 +50,7 @@ export default class SearchScript extends AbstractSearchOption {
doRender() {
const $option = $(TPL);
const $searchScript = $option.find('.search-script');
noteAutocompleteService.initNoteAutocomplete($searchScript);
noteAutocompleteService.initNoteAutocomplete($searchScript, {allowCreatingNotes: true});
$searchScript.on('autocomplete:closed', async () => {
const searchScriptNoteId = $searchScript.getSelectedNoteId();

View file

@ -210,7 +210,7 @@ export default class PromotedAttributesWidget extends TabAwareWidget {
}
// no need to wait for this
noteAutocompleteService.initNoteAutocomplete($input);
noteAutocompleteService.initNoteAutocomplete($input, {allowCreatingNotes: true});
$input.on('autocomplete:noteselected', (event, suggestion, dataset) => {
this.promotedAttributeChanged(event);

View file

@ -22,7 +22,10 @@ export default class EmptyTypeWidget extends TypeWidget {
this.contentSized();
this.$autoComplete = this.$widget.find(".note-autocomplete");
noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, { hideGoToSelectedNoteButton: true })
noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {
hideGoToSelectedNoteButton: true,
allowCreatingNotes: true
})
.on('autocomplete:noteselected', function(event, suggestion, dataset) {
if (!suggestion.notePath) {
return false;