Opened 9 years ago

Last modified 9 years ago

#13275 confirmed Bug

Images displayed as block may break CKEditor

Reported by: anrikun Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version:
Keywords: Cc:

Description

I have a bunch of images displayed as block elements through CSS. When I try to apply a block style to a paragraph containing such images, a new paragraph is created instead of getting the style applied. CKEditor works as expected when removing the display:block style from these images.

Change History (2)

comment:1 Changed 9 years ago by Piotrek Koszuliński

Status: newconfirmed
Version: 4.4.8 (GitHub - master)

I have problem with this ticket. First I wanted to reply that support for block images isn't feasible, because (... and here goes a long list of arguments, because it might not sound so, but it is extremely tricky ...). But then I realised that your case may be related to a single problem with the iterator which, when looking for block contents, bases on computed block style. I never liked this and cases like yours maybe why.

However, iterator worked this way for years and there may be reasons why it was implemented this way. It's also a very complex algorithm (it involves iterator + walker method + range methods) so frankly speaking no one will touch it without a strong case to support the work.

Second option is to try to make smallest possible changes in the algorithm so it at least fails gracefully. Right now I see that image disappears and that's the biggest problem I think. If you want to give it a try, then check the core/dom/iterator.js's code.

As a workaround I would try image2 which supports captioned images (which are blocks because of figure element which wraps them). Depending on your case you may not want captions, so you could hide them with CSS. It's not a perfect solution, but if you need block images then maybe it's justified. With some modifications you could achieve very similar results.

comment:2 Changed 9 years ago by anrikun

Thank you Reinmar, I will try your workaround!

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy