Problem/Motivation

While testing #3348603: CKEditor 5 resizes images with % width instead of px width (the CKEditor 4 default): breaks image captions *and* is a regression with @lauriii, we realized that Olivero has img { display: block } which breaks the "In line" styles implied by ckeditor.

Block In line
Block Inline

Steps to reproduce

  1. Use Olivero + ckeditor5 + insert image with "In line" alignment.
  2. Save and View result

Proposed resolution

  1. Remove img { display: block } from base.css
  2. consider if it needs to be removed from video too?

Remaining tasks

User interface changes

Fixes integration with ckeditor alignment options.

API changes

Data model changes

Release notes snippet

Issue fork drupal-3351145

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Needs review

Patch is in play

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Can confirm the issue described and that the MR fixes it. Same as the screenshots provided.

mherchel’s picture

Status: Reviewed & tested by the community » Needs work

The reason this was added is that the default display: inline UA styles for <img> elements will leave space below the image in many circumstances (which can throw off vertical spacing).

Because CKEditor labels the mode as inline, I think we should support that (even though I can't really think of a use case). But we shouldn't change the styles within the entire site.

Instead of modifying base.pcss.css, let's create an override within text-content.pcss.css that sets it to display: revert. Using revert instead of inline will make it more explicit that we're trying to change back to the UA's default behavior.

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new848 bytes

Addressed #5, Instead modifying base.pcss.css file, I have overrided text-content.pcss.css file. please review

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Believe it was discussed on slack that maybe a class gets added for inline. To cover backwards compatibility.

muskan kumari’s picture

Assigned: Unassigned » muskan kumari

I am working on this.

wim leers’s picture

Title: 'In line' from Ckeditor5 alignment broken by CSS in Olivero » 'In line' from CKEditor 5 alignment broken by CSS in Olivero
Priority: Normal » Major
Issue tags: +CSS, +Usability
muskan kumari’s picture

Assigned: muskan kumari » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.5 KB

I have attached a patch, please verify it.

smustgrave’s picture

Status: Needs review » Needs work

Still seems to be trying to address it purely with css. Think a class should be attempted.

pradipmodh13’s picture

Hey @smustgrave,
Img is inline level element and in Olivero theme img tag css comes with 'display:block' css property from base.css file so I think we can remove display:block property.
For ref adding screenshot with display block and display inline property.
Can I remove property from base.css file and submit the patch ?

pradipmodh13’s picture

StatusFileSize
new644 bytes
new288.26 KB
new281.7 KB

Removed display:block css from base file and it is better solution as img is inline level element.
For ref attached before and after screenshot.
Please review.

pradipmodh13’s picture

Hey @smustgrave,
If my patch is good then please change the status from needs work to needs review.

joelpittet’s picture

Status: Needs work » Needs review

@pradipmodh13, whenever you put a new patch up it's good if you put an interdiff here's the documentation on how to do that:
https://www.drupal.org/node/1488712

And also feel free to set the status to Needs Review if you want people to look at the changes, that's it's intention. See the description of the statuses:
https://www.drupal.org/docs/develop/issues/fields-and-other-parts-of-an-...

smustgrave’s picture

Status: Needs review » Needs work

Removing this CSS will most likely caused a visual regression on existing sites.

If the current fix solves the issues going forward thats great but think we need to consider existing sites too.

Which is why I suggested some sort of new class being added that the css can work with. That way the problem is solved and existing sites should be left alone.

bskibinski’s picture

Just chiming in with some advice:
setting display: block on images only to fix the bottom "whitespace" issue is not the best way, images should be inline by default.

A simple non-intrusive fix for the whitespace at the bottom of images is to just set "vertical-align: top" or any other statement except 'baseline' (I usually go for top).

Hope this helps.

ricksta’s picture

I strongly agree with the approach in #16 above. The other alignments mostly utilize adding a CSS class, too. Though I notice a data-align="right" in the CKEditor "source" becomes class="align-right" when a page is saved. So, I'm not sure what that attribute would be that would then become a CSS display: inline. I also agree with comment #17 that the default should be one where the adjacent content doesn't fall to the bottom.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

saurav-drupal-dev’s picture

Status: Needs work » Needs review
StatusFileSize
new68.25 KB
new282.42 KB

hello,

i have tried the patch '3351145-in-line-from' and its working fine after remove 'display: block' from the code and create a separate style for video working fine please check attachment.

ck editor
ck editor

saurav-drupal-dev’s picture

saurav-drupal-dev’s picture

Status: Needs review » Needs work

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

joelpittet’s picture

Status: Needs work » Needs review

Not totally sure why it was 'Needs Work' but catching it up this stalled issue of mine.

joelpittet’s picture

Status: Needs review » Needs work

Oh 'existing sites' hmm needs more thought...

quietone’s picture

Title: 'In line' from CKEditor 5 alignment broken by CSS in Olivero » 'In line' from CKEditor 5 alignment broken by CSS
Status: Needs work » Postponed

The Olivero theme was approved for removal in #3590816: [policy, no patch] Deprecate Olivero and move to contrib.

This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3595082: [meta] Tasks to deprecate the Olivero theme and the removal work in #3595085: [meta] Tasks to remove the Olivero theme.

quietone’s picture

Project: Drupal core » Olivero
Version: main » 2.x-dev
Component: Olivero theme » Code
Status: Postponed » Needs work