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

deleteContent in graveyard fails #4498

Closed
scofalik opened this issue Mar 27, 2019 · 0 comments · Fixed by ckeditor/ckeditor5-engine#1707
Closed

deleteContent in graveyard fails #4498

scofalik opened this issue Mar 27, 2019 · 0 comments · Fixed by ckeditor/ckeditor5-engine#1707
Assignees
Labels
package:engine type:improvement This issue reports a possible enhancement of an existing feature.
Milestone

Comments

@scofalik
Copy link
Contributor

If deleteContent() is executed on a selection which is in the graveyard root it will fail. It's because startPos is created as a static position but since it is in the graveyard, it should be updated:

const startPos = selRange.start;
// ...
writer.remove( selRange );
// ...
mergeBranches( writer, startPos, endPos ); // <-- Incorrect `startPos` is used.

There are two possible solutions for this:

  1. Make startPos a LivePosition.
  2. Cancel deleteContent if selRange is in the graveyard.

We chose the second option because it is less prone to an error and generates no operations.

@scofalik scofalik self-assigned this Mar 27, 2019
Reinmar referenced this issue in ckeditor/ckeditor5-engine Mar 28, 2019
Fix: Model#deleteContent will not throw anymore if the passed selection is in the graveyard root. Closes #1706.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 23 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:improvement This issue reports a possible enhancement of an existing feature. package:engine labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:engine type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
2 participants