Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add frontend note prompt API #4397

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

benkaiser
Copy link

We would like to allow users with custom scripts to leverage the internal note selector interface. This allows for easily creating links to internal notes from custom rendered views.

Fixes #4395 .

@@ -77,30 +77,52 @@ export default class AddLinkDialog extends BasicWidget {

const linkTitle = this.getLinkType() === 'reference-link' ? null : this.$linkTitle.val();

this.textTypeWidget.addLink(this.$autoComplete.getSelectedNotePath(), linkTitle);
if (this.textTypeWidget) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check appears to be needed because in the context of a script extension theremay not be a textTypeWidget.

this.textTypeWidget.addLink(this.$autoComplete.getSelectedNotePath(), linkTitle);
}
if (this.resolve) {
this.resolve({
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on this return structure @zadam ?

@@ -121,7 +143,7 @@ export default class AddLinkDialog extends BasicWidget {
};

noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {
allowExternalLinks: true,
allowExternalLinks: false,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zadam when using the text editor control+L (i.e. using this dialog directly) I was never actually able to get an external link selected. Are we best off disabling it here, or should we fix external link selection inside the note selector?

@zadam
Copy link
Owner

zadam commented Nov 6, 2023

@benkaiser I don't like that the Add Link dialog now does two things - it inserts the link into the text note AND resolves the link. What if you just want the latter and not the former? Add Link dialog is also more specialized than mere selecting note (it allows defining a different link title)

What I thought you want to do is to create a pure note selection dialog ...

Alternatively, the Add Link dialog could be generalized in the sense that it would just resolve the selected note / title, and then the triggering code would handle inserting the content into the text note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Feature request) Autocomplete dialog support via scripting API
2 participants