[4.2] [Draft] Wrap all images in figure
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 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)
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.
The problem is the different options (and results) between using com_media and com_content intro/full images
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.
Sounds like a plan.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37753.
This pull requests has been automatically converted to the PSR-12 coding standard.
This pull request has been automatically rebased to 5.0-dev.
This pull request has been automatically rebased to 5.1-dev.
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 This PR is a DRAFT and not ready for a test.
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.
This pull request has been automatically rebased to 5.2-dev.