From 0c9a11db6fa1058c19679f30651a016ab953e0fd Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 18 Feb 2021 20:10:44 +0100 Subject: [PATCH] bring back "create and link note" into more places, fixes #1653 --- src/public/app/dialogs/add_link.js | 5 ++++- src/public/app/dialogs/include_note.js | 5 ++++- src/public/app/widgets/attribute_widgets/attribute_detail.js | 2 +- src/public/app/widgets/search_options/search_script.js | 2 +- .../app/widgets/type_property_widgets/promoted_attributes.js | 2 +- src/public/app/widgets/type_widgets/empty.js | 5 ++++- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/public/app/dialogs/add_link.js b/src/public/app/dialogs/add_link.js index 3e5bc5d1b..047ef73a9 100644 --- a/src/public/app/dialogs/add_link.js +++ b/src/public/app/dialogs/add_link.js @@ -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) { diff --git a/src/public/app/dialogs/include_note.js b/src/public/app/dialogs/include_note.js index 9f92c3a92..0bb6de912 100644 --- a/src/public/app/dialogs/include_note.js +++ b/src/public/app/dialogs/include_note.js @@ -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); } diff --git a/src/public/app/widgets/attribute_widgets/attribute_detail.js b/src/public/app/widgets/attribute_widgets/attribute_detail.js index 39f3d2414..b4f79ba6d 100644 --- a/src/public/app/widgets/attribute_widgets/attribute_detail.js +++ b/src/public/app/widgets/attribute_widgets/attribute_detail.js @@ -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; diff --git a/src/public/app/widgets/search_options/search_script.js b/src/public/app/widgets/search_options/search_script.js index 785358340..72a2e22f9 100644 --- a/src/public/app/widgets/search_options/search_script.js +++ b/src/public/app/widgets/search_options/search_script.js @@ -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(); diff --git a/src/public/app/widgets/type_property_widgets/promoted_attributes.js b/src/public/app/widgets/type_property_widgets/promoted_attributes.js index e8d1c39a8..80b54ab02 100644 --- a/src/public/app/widgets/type_property_widgets/promoted_attributes.js +++ b/src/public/app/widgets/type_property_widgets/promoted_attributes.js @@ -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); diff --git a/src/public/app/widgets/type_widgets/empty.js b/src/public/app/widgets/type_widgets/empty.js index 0508d99fe..18a640342 100644 --- a/src/public/app/widgets/type_widgets/empty.js +++ b/src/public/app/widgets/type_widgets/empty.js @@ -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;