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

Restored selection range is not a correct selection range #2726

Closed
scofalik opened this issue Sep 11, 2017 · 0 comments · Fixed by ckeditor/ckeditor5-undo#73
Closed

Restored selection range is not a correct selection range #2726

scofalik opened this issue Sep 11, 2017 · 0 comments · Fixed by ckeditor/ckeditor5-undo#73
Assignees
Labels
package:undo type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@scofalik
Copy link
Contributor

  1. Assume an editor with contents <p>[]</p>.
  2. Copy & paste two paragraphs into it.
  3. Following deltas will be generated: remove old p, insert new p 1, insert new p 2. The remove will be the first one. After it is applied, undo will try to save the batch. Since there is nothing in editor at this point, the selection will be placed at [ 0 ] and it will be saved this way.

Then undo.

  1. New paragraphs will be removed.
  2. Old paragraph will be recovered.
  3. Selection will be restored. It will start from [ 0 ]. After it will be transformed by all deltas, it ends up at [ 1 ]. Which is incorrect selection position: <p></p>[].

In ckeditor/ckeditor5-engine#1138 I introduce DocumentSelection#hasOwnRange to overcome this issue.

@scofalik scofalik self-assigned this Sep 11, 2017
Reinmar referenced this issue in ckeditor/ckeditor5-undo Sep 13, 2017
Fix: Selection should be correctly restored when undoing after all editor content was replaced or removed. Closes #72.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-undo Oct 9, 2019
@mlewand mlewand added this to the iteration 12 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:bug This issue reports a buggy (incorrect) behavior. labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:undo type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants