ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
9.33k stars 3.68k forks source link

Image Style HTML tag behavior. #16740

Open blucayzer opened 1 month ago

blucayzer commented 1 month ago

📝 Ask a question

What is your question? Please be as specific as possible to help us understand it.

In changing the style of the image, to "inline", "wrap-text" or "break-text".

In Source Editing, the HTML tags of the image with "wrap-text" and "break-text" is a

. Shown in the screenshot below. Editor View: image

Source Editing Mode: image

But in "Inline" style, the HTML tag of the image is

. Shown in the screenshot below. Editor View: image

Source Editing Mode: image

The question is, is this the intended behavior of the "inline" style? or is it a bug?

This behavior was seen where I was testing the caption images in CKEditor.

If I have an image with a caption having a style of "wrap-text". image

Then I converted it to "inline", the caption was removed. image

Witoso commented 1 month ago

Yes, this is a standard behavior. As inline images are not a "block" wrapped in figure, they cannot contain captions (figcaption)

blucayzer commented 1 month ago

ok! Understood now. Thanks for the update.

blucayzer commented 1 month ago

Reopening this thread again as I have more further questions.

There is a use case where the tag is inconsistent for "wrap-text". 1.) have an image and has a style of "Break-text".

2.)then change the style of the image to "wrap-text" and check in the Source Editing that the HTML tag of the image is "Figure". image

3.) Change the style to "in-line". 4.) Then Change the style back to "wrap-text" image

Questions: 1.) With the reproduction steps above, why does the HTML tag of "Wrap-text" became <p> instead of <figure> when it is first at <figure>. 2.) Is there a way on having a caption on the image if the style is in "in-line"?