Problem/Motivation
It is not possible to use valid HTML tags such as em and strong in the captions, aka figcaption. They are rendered as is, as plain text, instead of being processed / stripped by the filters.
Proposed resolution
Let the text format process the caption with its FilterCaption filter by removing the ::escapeValues callback from the EntityEmbedDialog's caption field. FilterCaption performs a XSS filtering check, so we could already be safe on this side.
If the EntityEmbedDialog::escapeValues function is not called anymore, maybe deprecate it or make it more obvious it is a convenience static function for use in other classes.
Drupal 8.5.4.
Comments
Comment #2
dakwaminePutting a patch as a starting point for work.
By just removing this line, the FilterCaption filter will be able to process properly captions.
Comment #4
wim leersComment #5
wim leersIf we can make #2282957: Caption should work like the drupalimage plugin (editable in WYSIWYG, not in dialog) work, this wouldn't be necessary. And the usability would be far better. Still, this is probably worth doing in the short term, until that happens.
Comment #6
wim leersComment #7
wim leersComment #8
wim leersActually … I cannot reproduce this at all; it's already working fine. Perhaps this was caused by one of the other bugs we fixed in the past week.
I entered some HTML in Entity Embed's dialog's "Caption" field:
And it looked correct in CKEditor:
As well as on the front end after saving: