drimage not refreshing images inside layout builder

Created on 13 December 2021, about 3 years ago
Updated 29 November 2023, about 1 year ago

Problem/Motivation

Drimage images are blank after a updating a block inside layout builder

Steps to reproduce

Add a block with configured drimage in one column and add another block to a second column. After updating the left block the completed section is replaced by layout builder. drimage tries to recalculate the image width but in this moment el.offsetWidth is null at that moment

if (el.offsetWidth === 0) {
    return { 0: 0, 1: 0 };
}

Proposed resolution

Add a setTimeout to ensure that the el.offsetWidth is recalculated correctly.

🐛 Bug report
Status

Closed: won't fix

Version

2.0

Component

Code

Created by

🇩🇪Germany Christian.wiedemann

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇧🇪Belgium weseze

    I'm marking this as won't fix. Setting an arbitrary delay is no guarantee it will always work. The correct way to fix this is to "hack" into whatever ajax callback is being executed and add a Drupal.drimage.init(yourElement); at the end of it.

    However, that being said, we are also making heavy use of drimage within layoutbuilder and don't have any such issues...
    So either I'm misunderstanding the issue and need more info or the issue you are experiencing is related to some custom code or contrib module.

    Feel free to reopen and info if this issue is not resolved for you.

  • First commit to issue fork.
  • 🇩🇪Germany Duwid

    Duwid changed the visibility of the branch 3254223-drimage-not-refreshing-images-inside-layout-builder to hidden.

Production build 0.71.5 2024