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

Yet another caption+undo bug: mapping empty caption. #5080

Closed
scofalik opened this issue Mar 20, 2017 · 2 comments · Fixed by ckeditor/ckeditor5-image#81
Closed

Yet another caption+undo bug: mapping empty caption. #5080

scofalik opened this issue Mar 20, 2017 · 2 comments · Fixed by ckeditor/ckeditor5-image#81
Labels
package:image type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@scofalik
Copy link
Contributor

Steps to reproduce:

  1. Create image (must have empty caption).
  2. Undo.

Expected: Image is removed.

Actual: Editor throws an error.

Reason:

To put things short and simple:

When model <caption> is empty, we remove <figcaption> element from view. But this causes a bug with undo:

  1. When creating image, insert operation for caption is performed.
  2. When undoing it, insert operation becomes remove operation for caption.
  3. Remove operation has a range to remove, which is in <figure>.
  4. However <figcaption> is not there, which throws an error (we are looking for a too big offset in <figure>).

It's easy to see that this is the problem, because you can undo the image insertion if you focus it.

Solutions:

There are two things we can do:

  1. Introduce remove:caption converter which will check if the <figcaption> is there and consume change + stop event if it's not there.
  2. Stop trying to fix all the issues that comes from the fact that we have element in model that sometimes is not in the view, and use CSS classes to hide it.

I am for 2.

@oleq
Copy link
Member

oleq commented Mar 20, 2017

[ Steps to reproduce, expected, actual ] triplet would be very helpful to verify and understand the problem.

@scofalik
Copy link
Contributor Author

Added.

@szymonkups szymonkups self-assigned this Mar 22, 2017
scofalik referenced this issue in ckeditor/ckeditor5-image Mar 30, 2017
Fix: Image captions in the view are hidden instead of being removed. Closes #77.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-image Oct 9, 2019
@mlewand mlewand added this to the iteration 9 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:bug This issue reports a buggy (incorrect) behavior. package:image labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:image type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants