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

Autolink should not include trailing punctuation #14497

Open
dtdesign opened this issue Jun 29, 2023 · 0 comments · May be fixed by #16264
Open

Autolink should not include trailing punctuation #14497

dtdesign opened this issue Jun 29, 2023 · 0 comments · May be fixed by #16264
Labels
domain:ui/ux This issue reports a problem related to UI or UX. intro Good first ticket. package:link squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@dtdesign
Copy link

📝 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

const url = getUrlAtTextEnd( text.substr( 0, text.length - 1 ) );
. 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

  • Browser: Chrome 114.0.5735.198
  • OS: macOS 13.4.1
  • First affected CKEditor version: Unknown
  • Installed CKEditor plugins: Online Demo

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

@dtdesign dtdesign added the type:bug This issue reports a buggy (incorrect) behavior. label Jun 29, 2023
@Witoso Witoso added package:link domain:ui/ux This issue reports a problem related to UI or UX. intro Good first ticket. squad:core Issue to be handled by the Core team. labels Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:ui/ux This issue reports a problem related to UI or UX. intro Good first ticket. package:link squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants