silverstripe / silverstripe-asset-admin

Silverstripe assets gallery for asset management
BSD 3-Clause "New" or "Revised" License
19 stars 78 forks source link

TinyMCE: Right align the image without caption doesn't work #1370

Closed MelissaWu-SS closed 1 year ago

MelissaWu-SS commented 1 year ago

Step to reproduce

Screen Shot 2023-06-19 at 2 40 05 PM

Expected behaviour:

The image should be aligned right and there should be no text wrapping around the image.

Actual behaviour:

There is no way we can clear the text around the image, as we are not able to select the parent <p> element of the image in CSS. So the image is always wrapped with text.

Screen Shot 2023-06-19 at 2 33 09 PM

Screen Shot 2023-06-19 at 2 32 57 PM

Potential solution

The potential solution would be adding class names to the parent <p> element when an image is inserted. It could be done in the TinyMCE_ssmedia.js. It would be similar to the image with caption, where a <div> element is added to replace the <p> element and there are class names on the <div>, so we can select the <div> for clearing the text around the image.

Screen Shot 2023-06-19 at 2 49 50 PM

ACs

sabina-talipova commented 1 year ago

I tested the provided example and didn't find any problem. All elements are aligned according to the selected setting. If wrap is selected, the text wraps around the image according to the selected setting.

MelissaWu-SS commented 1 year ago

Hey @sabina-talipova, the problem is with RightAlone option. If RightAlone is selected as below, there should not be text wrapping about the image. Currently, the image is wrapped with text if the image is "RightAlone". We have this issue on a project that uses. silverstripe/recipe-cms: 5.0.0.

246712336-b9997dfd-2a35-4679-a620-2b8395e644d3

sabina-talipova commented 1 year ago

Issue was fixed. Close.