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

Images with an inline style display: block should be upcasted as block images #12811

Closed
niegowski opened this issue Nov 7, 2022 · 0 comments · Fixed by #12876
Closed

Images with an inline style display: block should be upcasted as block images #12811

niegowski opened this issue Nov 7, 2022 · 0 comments · Fixed by #12876
Assignees
Labels
package:image squad:core Issue to be handled by the Core team. support:2 An issue reported by a commercially licensed client. type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@niegowski
Copy link
Contributor

📝 Provide a description of the improvement

<img src="..." style="display: block">

Should be upcasted as a block image

📃 Other details

Probably a simple change:

--- a/packages/ckeditor5-image/src/image/utils.js
+++ b/packages/ckeditor5-image/src/image/utils.js
@@ -69,7 +69,8 @@ export function getImgViewElementMatcher( editor, matchImageType ) {
 
                // The <img> can be standalone, wrapped in <figure>...</figure> (ImageBlock plugin) or
                // wrapped in <figure><a>...</a></figure> (LinkImage plugin).
-               const imageType = element.findAncestor( imageUtils.isBlockImageView ) ? 'imageBlock' : 'imageInline';
+               const imageType = element.getStyle( 'display' ) == 'block' || element.findAncestor( imageUtils.isBlockImageView ) ?
+                       'imageBlock' : 'imageInline';
 
                if ( imageType !== matchImageType ) {
                        return null;

If you'd like to see this improvement implemented, add a 👍 reaction to this post.

@niegowski niegowski added type:improvement This issue reports a possible enhancement of an existing feature. squad:core Issue to be handled by the Core team. labels Nov 7, 2022
@martynawierzbicka martynawierzbicka added the support:2 An issue reported by a commercially licensed client. label Nov 10, 2022
@CKEditorBot CKEditorBot added the status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. label Nov 14, 2022
@arkflpc arkflpc self-assigned this Nov 16, 2022
@CKEditorBot CKEditorBot added status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. and removed status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. labels Nov 16, 2022
niegowski added a commit that referenced this issue Nov 22, 2022
Feature (image): Upcasts `<img>` with `display:block` style as a block image. Closes #12811.
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Nov 22, 2022
@CKEditorBot CKEditorBot added this to the iteration 59 milestone Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:image squad:core Issue to be handled by the Core team. support:2 An issue reported by a commercially licensed client. type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants