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); $linkTitle.val(noteTitle);
} }
noteAutocompleteService.initNoteAutocomplete($autoComplete, { allowExternalLinks: true }); noteAutocompleteService.initNoteAutocomplete($autoComplete, {
allowExternalLinks: true,
allowCreatingNotes: true
});
$autoComplete.on('autocomplete:noteselected', (event, suggestion, dataset) => { $autoComplete.on('autocomplete:noteselected', (event, suggestion, dataset) => {
if (!suggestion.notePath) { if (!suggestion.notePath) {

View File

@ -17,7 +17,10 @@ export async function showDialog(widget) {
utils.openDialog($dialog); utils.openDialog($dialog);
noteAutocompleteService.initNoteAutocomplete($autoComplete, { hideGoToSelectedNoteButton: true }); noteAutocompleteService.initNoteAutocomplete($autoComplete, {
hideGoToSelectedNoteButton: true,
allowCreatingNotes: true
});
noteAutocompleteService.showRecentNotes($autoComplete); 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.$rowTargetNote = this.$widget.find('.attr-row-target-note');
this.$inputTargetNote = this.$widget.find('.attr-input-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) => { .on('autocomplete:noteselected', (event, suggestion, dataset) => {
if (!suggestion.notePath) { if (!suggestion.notePath) {
return false; return false;

View File

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

View File

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

View File

@ -22,7 +22,10 @@ export default class EmptyTypeWidget extends TypeWidget {
this.contentSized(); this.contentSized();
this.$autoComplete = this.$widget.find(".note-autocomplete"); 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) { .on('autocomplete:noteselected', function(event, suggestion, dataset) {
if (!suggestion.notePath) { if (!suggestion.notePath) {
return false; return false;