clay / clay-kiln

Editing tools for Clay

Home Page:http://docs.clayplatform.com/clay-kiln/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve Quill link validation

mattoberle opened this issue · comments

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

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?

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.

this was released as v10.0.1!