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

Composer.deleteContents() should clean selection attributes #3850

Closed
Reinmar opened this issue Oct 17, 2016 · 3 comments
Closed

Composer.deleteContents() should clean selection attributes #3850

Reinmar opened this issue Oct 17, 2016 · 3 comments
Labels
package:engine type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@Reinmar
Copy link
Member

Reinmar commented Oct 17, 2016

This issue is visible after ckeditor/ckeditor5-engine#634.

  1. Put caret at the end of a bolded word.
  2. Delete all the word.
  3. Type a letter.

This letter is now bolded, while it shouldn't. We agreed that deleting whole content of a bolded word should also remove the bold from the selection.

I'm not 100% sure whether this should be implemented by the composer.deleteContents() or the delete feature, but composer makes more sense.

BTW, @scofalik, what would be the easiest way to implement that? How can I now refresh selection attributes so it reads all of them from the content?

@scofalik
Copy link
Contributor

Honestly, this should work like you described. During character deletion, caret is moved so model.Document.selection#_updateAttributes( true ) should be fired. This means that all attributes should be cleared and only attributes from caret neighbourhood. It's weird it doesn't work like this. There should be no need to refresh attributes.

Anyway, right now, there is no method to do so. Even setting selection to same position as it is won't work. So you'd have to collapse selection at different selection and then move it back. Or just use _updateAttributes( true ) (but it should work right now for deleteing, so IDK).

@Reinmar
Copy link
Member Author

Reinmar commented Oct 18, 2016

Unfortunately, this doesn't work as expected because of... how smart we made all this :D.

After deleteContents() run batch.remove() the live selection moves automatically to the place where we expect it to be, so setting it there explicitly in the next line doesn't trigger change:range.

So it seems that we'll have to update those attributes there anyway. And this leads to my next question – how to update selection attributes? Can we make the _updateAttributes( true ) method public?

@Reinmar
Copy link
Member Author

Reinmar commented Oct 31, 2016

Fixed by ckeditor/ckeditor5-engine#653.

@Reinmar Reinmar closed this as completed Oct 31, 2016
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 4 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:bug This issue reports a buggy (incorrect) behavior. 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:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

No branches or pull requests

3 participants