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

Typing over the link feature #7590

Merged
merged 8 commits into from
Jul 15, 2020
Merged

Typing over the link feature #7590

merged 8 commits into from
Jul 15, 2020

Conversation

pomek
Copy link
Member

@pomek pomek commented Jul 9, 2020

Suggested merge commit message (convention)

Feature (link): Typing over the selected link will not remove the link itself. Instead, the typed text will replace the link text. Closes #4762.

@pomek pomek requested a review from jodator July 9, 2020 10:12
@pomek
Copy link
Member Author

pomek commented Jul 9, 2020

@ckeditor/qa-team, could you check how the solution works with CF?

@Mgsy
Copy link
Member

Mgsy commented Jul 9, 2020

It works fine 👌  We've tested it in all browser and on mobiles.

Copy link
Contributor

@jodator jodator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for feature activation (so a whole link and only link is selected) needs improvement.

@Reinmar
Copy link
Member

Reinmar commented Jul 10, 2020

cc @scofalik I think you should know about this change as it touches the very fragile typing/insert/delete content.

@Reinmar
Copy link
Member

Reinmar commented Jul 10, 2020

Just to be sure:

  • Does this PR also change the behavior at the beginning of the link? It should, as it was part of the issue too.
  • Does it affect pasting and other forms of inserting content other than typing? It should not, as we only want to affect typing.

@scofalik
Copy link
Contributor

At first sight, it looks like the change should be safe for track changes:

  • deleteContent callback does not modify anything. If I correctly imagine what will happen, this should work just fine.
  • insertContent callback, AFAICS, just adds some attributes to the model that hasn't been inserted yet:
    • this callback and track change's callback have the same priority,
    • if this callback is fired before track change's callback, track changes will never know that something happened,
    • if it is fired after it, AFAICS from the execution flow, the new callback will be fired anyway (track change's callback eventually fires insertContent too and your callback should be executed then).

This needs testing, but as I said, as I look at it now, it should be fine.

@pomek
Copy link
Member Author

pomek commented Jul 14, 2020

Guys, I've just pushed fixes. Could you check the feature once again?

cc: @jodator, @scofalik @ckeditor/qa-team

@jodator
Copy link
Contributor

jodator commented Jul 14, 2020

@pomek  for pasting and basic link integration - now it works nice with the typing detection 👍

The only thing left is my previous comment: #7590 (comment). In case of multiple other attributes over a link. It is kinda corner case but IMO we could treat it as typing over a link.

@pomek
Copy link
Member Author

pomek commented Jul 14, 2020

@jodator, should I write additional test for such case? In the code, we copy the selection's attributes.

@jodator
Copy link
Contributor

jodator commented Jul 14, 2020

Yes, please :) I think that something like below (sample is without values) should work (three text nodes):

foo [<$text linkHref>b</$text><$text linkHref bold>a</$text><$text linkHref>r</$text>] baz

after type "box":

foo <$text linkHref>box[]</$text> baz

@FilipTokarski
Copy link
Member

Checked in all browsers and apart from the case with attributes, it looks ok 👍

@pomek
Copy link
Member Author

pomek commented Jul 15, 2020

@jodator, done. Ready for review once again. I hope, it will be the last one.

@jodator jodator merged commit de476bb into master Jul 15, 2020
@jodator jodator deleted the i/4762 branch July 15, 2020 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typing over the link (replacing link text)
6 participants