Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Caption is added twice. #5082

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

Caption is added twice. #5082

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

Comments

@scofalik
Copy link
Contributor

At the moment, there is a callback that adds <caption> to <image> whenever <image> without <caption> is inserted to the document. Unfortunately, there is a small bug in that fixer, which causes adding redundant <caption> (and it also makes the editor throw :P).

So the problem is when the change comes from OT (redo is taken care of because fixer checks type == 'insert'). Client A adds an image and generates <caption> using fixer.

Then on client B, first, you get the InsertOperation that inserts just the <image>. The fixer checks it and sees that empty <image> is added, so it adds the <caption>. But then you get the "fixer operation" from client A which adds additional <caption>.

There are two solutions possible.

  1. In batch.document.enqueueChanges block, check if the <image> is still empty, before adding second <caption>.
  2. Do not fix if batch.type is transparent.

I prefer 1 solution, at least for now. We haven't discussed how fixers and problems like this should be solved for OT yet (similar case will be with possible auto embed feature -- converted link should not be replaced twice).

@szymonkups szymonkups self-assigned this Mar 29, 2017
scofalik referenced this issue in ckeditor/ckeditor5-image Mar 31, 2017
Fix: Caption will not be automatically added second time if it was already added before "caption fixer" got fired. Closes #78.
@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
# for free to join this conversation on GitHub. Already have an account? # 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.

3 participants