silverstripe / cwp

Common Web Platform (CWP) features module. We strongly recommend using it for all new CWP projects. Future features will be delivered here.
https://www.cwp.govt.nz
BSD 3-Clause "New" or "Revised" License
10 stars 26 forks source link

FIX Correctly set img tag attributes for WYSIWYG #340

Closed GuySartorelli closed 1 month ago

GuySartorelli commented 1 month ago

Fixes https://github.com/silverstripe/recipe-kitchen-sink/actions/runs/10033713755/job/27727409397 and https://github.com/silverstripe/recipe-kitchen-sink/actions/runs/10033713755/job/27727409547 which are variations of

The string "<a href="[sitetree_link,id=3]#youranchor"><img src="file1.jpg" alt=""></a>" should be found in the HTML of the element matching name "Content". Actual content: "<p><a href="[sitetree_link,id=3]#youranchor"><img src="file1.jpg"></a></p>"

Note the missing alt attribute in the actual content. This is because the extended_valid_elements and valid_elements config both had img with different allowed attributes, which caused problems. I've moved that all to be in valid_elements now.

Issue