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

Improve Quill link validation #1504

Closed
mattoberle opened this issue Nov 18, 2020 · 3 comments
Closed

Improve Quill link validation #1504

mattoberle opened this issue Nov 18, 2020 · 3 comments
Labels
feature slate Requests from Slate Team ux

Comments

@mattoberle
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When an invalid link is provided via Quill the default behavior is to cast it to about:blank.

This does not provide great visual feedback to the end user, meaning invalid URLs may remain in published content.

Describe the solution you'd like

  • Option 1: Do not add anchor tags when an invalid URL is pasted.

This would provide some degree of visual feedback to the end user to let them know a link was not created.
It doesn't provide a detailed error message, but it's an improvement over an invalid or empty link.

  • Option 2: Perform validation on links and provide direct feedback to the end user.

This solution is more complex than Option 1 but provides a better user experience.
We'd need to weigh the cost of the complexity of this solution against the benefit it brings.

Additional context here: #1502

@mattoberle mattoberle added slate Requests from Slate Team ux feature labels Nov 18, 2020
@mattoberle
Copy link
Contributor Author

I put together this WIP: #1505

This is by no means the final product but I was able to come up with a proof-of-concept where a Quill Blot can remove itself in response to some light validation. We know it's possible, but is this particular implementation a terrible hack?

@mattoberle
Copy link
Contributor Author

I updated #1505 to use a built-in validator rather than the custom Blot hack.

This is an example of what a validation error will report ("confirmed that" is the hyperlinked text in this case).
It differs slightly from the report provided by edit-links.js in that it displays the hyperlink text containing the invalid link (rather than just the first lines of the paragraph). Based on the tests present for edit-links.js I believe this implementation was actually the intended behavior.

2020-11-20_125234

@macgyver -- Tagging you here based on your feedback in #1502.

@reubenson
Copy link
Contributor

this was released as v10.0.1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature slate Requests from Slate Team ux
Projects
None yet
Development

No branches or pull requests

2 participants