joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[4.2] [Draft] Wrap all images in figure

Open chmst opened this issue 3 years ago • 9 comments

Pull Request for Issue #37380 part1 .

Summary of Changes

Images are always wrapped in a figure tag.

Testing Instructions

see #37380 part 1.

Open an article and add images from media. Add mage class, caption, caption class in all variants.

Actual result BEFORE applying this Pull Request

see #37380 part 1.

Expected result AFTER applying this Pull Request

very image has is wrapped i a figure. All classes are set, Caption is only set when a caption is entered

Documentation Changes Required

chmst avatar May 06 '22 10:05 chmst

@chmst I would change the conditional to:

      if (figClasses) {
         imageElement = `<figure${figClasses}><img src="${Joomla.selectedMediaFile.url}"${classes}${isLazy}${alt} data-path="${Joomla.selectedMediaFile.path}"/>${figCaption ? `<figcaption>${figCaption}</figcaption>` : ''}</figure>`;
       } else {
         imageElement = `<img src="${Joomla.selectedMediaFile.url}"${classes}${isLazy}${alt} data-path="${Joomla.selectedMediaFile.path}"/>`;
       }

In this case a user will get:

  • an image if no figure classes defined
  • a figure around the image if the figure class is defined
    • a fig caption inside the figure if the caption text is defined

Basically it's more flexible than dictating one specific output like you did

You can add one more check box for figure to allow the case that a user wants a figure element without defining any classes (the code is similar to the lazy load checkbox)

dgrammatiko avatar May 06 '22 10:05 dgrammatiko

Thanks @dgrammatiko I made this PR so we can discuss.

I am just am working on a site where editors add content. Some images have captions, others don't. I am struggling with the styling, if images are different.

chmst avatar May 06 '22 10:05 chmst

The problem is the different options (and results) between using com_media and com_content intro/full images

brianteeman avatar May 06 '22 10:05 brianteeman

The problem is the different options (and results) between using com_media and com_content intro/full images

FWIW I think you should first fix the com_content intro/full inputs (as you cannot change the existing inputs, you can only add more) fix the layout to have conditional output of image/figure (that's a mild B/C break) and then port the UI to this selector so things are consistent across the board.

dgrammatiko avatar May 06 '22 11:05 dgrammatiko

Sounds like a plan.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37753.

chmst avatar May 06 '22 11:05 chmst

This pull requests has been automatically converted to the PSR-12 coding standard.

joomla-bot avatar Jun 27 '22 20:06 joomla-bot

This pull request has been automatically rebased to 5.0-dev.

HLeithner avatar May 02 '23 16:05 HLeithner

This pull request has been automatically rebased to 5.1-dev.

HLeithner avatar Sep 30 '23 22:09 HLeithner

I have tested this item :red_circle: unsuccessfully on ed76ce150103f5857b9cae8d845d0e97efa31d2e

[Apply Patch] results in error message «There are no files to patch from this pull request. This may mean that the files in the pull request are not present in your installation.»


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37753.

crimle avatar Feb 24 '24 13:02 crimle

@crimle This PR is a DRAFT and not ready for a test.

chmst avatar Apr 05 '24 19:04 chmst

Ok, but it's not always easy to find out what to test. I have a feeling, that the filters of the Joomla! Patch Tester are not always working as they are expected to.

crimle avatar Apr 06 '24 13:04 crimle

This pull request has been automatically rebased to 5.2-dev.

HLeithner avatar Apr 24 '24 09:04 HLeithner