ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
9.54k stars 3.7k forks source link

Autolink should not include trailing punctuation #14497

Open dtdesign opened 1 year ago

dtdesign commented 1 year ago

📝 Provide detailed reproduction steps (if any)

  1. Visit the demo at https://ckeditor.com/ckeditor-5/demo/feature-rich/.
  2. Copy the URL of the page into the clipboard.
  3. Discard the editor contents.
  4. Pretend that you are writing a sentence that ends with the URL from the clipboard.
  5. Paste the URL from the clipboard at the end.
  6. Hit . to end the sentence and hit <Space> to trigger the AutoLink plugin.

✔️ Expected result

The trailing dot should not be part of the implicitly created link.

❌ Actual result

The trailing dot is added at the end of the URL.

❓ Possible solution

The trailing space is already removed from the possible text in https://github.com/ckeditor/ckeditor5/blob/6d2257fbff2c34863243b9e5af4e42a8a251e84b/packages/ckeditor5-link/src/autolink.ts#L122. This could be extended to check if the last character of url contains a punctuation symbol and remove it from the url value.

I thought about adding this to the regex, but it is already complex enough and it could possibly be faster to simply check the last character of url.

📃 Other details


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

CKEditorBot commented 3 days ago

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

cadeyrn commented 3 days ago

There has been no activity on this issue for the past year.

Not quite true… there is an open PR for this issue for a half year (!) and nobody (except a bot) reviewed it …