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

Selection could be outside of the link after pasting #6053

Closed
ma2ciek opened this issue Jan 8, 2020 · 5 comments · Fixed by ckeditor/ckeditor5-link#261
Closed

Selection could be outside of the link after pasting #6053

ma2ciek opened this issue Jan 8, 2020 · 5 comments · Fixed by ckeditor/ckeditor5-link#261
Assignees
Labels
domain:ui/ux This issue reports a problem related to UI or UX. package:link type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@ma2ciek
Copy link
Contributor

ma2ciek commented Jan 8, 2020

📝 Provide a description of the improvement

How the feature works now and what you'd like to change?

When pasting a link the selection (cursor) could be moved outside of the link, so after pasting typing won't extend the pasted link. This behavior doesn't exist in CKEditor 4 and other editors.

📃 Other details

  • Browser: Chrome
  • OS: MacOS
  • CKEditor version: 16

If you'd like to see this improvement implemented, add a 👍 reaction to this post.

@ma2ciek ma2ciek added type:improvement This issue reports a possible enhancement of an existing feature. package:link labels Jan 8, 2020
@Mgsy Mgsy added this to the backlog milestone Jan 9, 2020
@Reinmar Reinmar modified the milestones: backlog, next Jan 21, 2020
@Reinmar Reinmar added the domain:ui/ux This issue reports a problem related to UI or UX. label Jan 21, 2020
@fredck
Copy link
Contributor

fredck commented Feb 23, 2020

Actually this issue seems to be related to a yet bigger problem: unexpected auto-linking when pasting urls... but just those copied from the browser address bar (Chrome only?).

For example:

  1. Go to this fiddle:
    1. Copy the URL from the browser address bar (not the one in the textarea).
    2. Paste it inside CKEditor -> auto-linking DOES happen.
  2. Go back to that fiddle:
    1. Now copy the URL from the textarea in the results pane.
    2. Paste it inside CKEditor -> auto-linking DOES NOT happen.

We have an inconsistent behavior here. Users may feel that what happens is right but the fact is that CKEditor is having no control of it... and no control is not good.

The fact is that the browser itself is saving in the clipboard the url copied from its address bar in both HTML and plain-text format. The HTML version is something like <a href="url">url</a> and that's the one used by CKEditor. When copying from the textarea, the clipboard has plain-text only.

I believe the proper solution here is not auto-linking in such situation and leave the auto-linking feature to be handled by a future feature that will do so in all cases, no matter if copied from the address bar or a plain-text source.

@fredck
Copy link
Contributor

fredck commented Feb 23, 2020

just those copied from the browser address bar (Chrome only?)

Tested with Firefox and Safari... these browsers don't put a HTML version in the clipboard so this issue doesn't happen there.

@wwalc
Copy link
Member

wwalc commented Mar 30, 2020

Related: #1016 (see e.g. use case described in #1016 (comment))

@Reinmar
Copy link
Member

Reinmar commented Apr 2, 2020

I think that this can be fixed by listening on model#insertContent and changing the gravity of the selection to "right" when we detected that a link was pasted.

@oleq
Copy link
Member

oleq commented Apr 17, 2020

OK, we have two separate problems in this issue:

  1. The gravity of the selection could be improved after pasting a link. i/6053: The gravity of the selection should be overridden if a link was pasted for better typing experience ckeditor5-link#260 addresses this problem.
  2. There's a discussion about whether links should be pasted as rich or plain text (if data transfer provides an HTML). I'm creating a follow-up for this, so please let's move the discussion there because it's a separate topic.

jodator added a commit to ckeditor/ckeditor5-link that referenced this issue Apr 21, 2020
Fix: Link selection attributes should be cleared after inserting a link via `Model#insertContent()` for better UX. Closes ckeditor/ckeditor5#6053.
mlewand pushed a commit that referenced this issue May 1, 2020
Fix: Link selection attributes should be cleared after inserting a link via `Model#insertContent()` for better UX. Closes #6053.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment