use ckeditor5 for single line fields with all inline markup and no paragraph tags

Strip paragraph tags filter |

Strip paragraph tags filter

An issue called “Image caption titles show up at consistent size” forced us to cry about CKEditor5’s foibles again— and

All right, so what happened here is although CKEDitor5 does not let a person enter attributes (direction, title, class etc) on paragraph tags, if content from elsewhere that has such attributes is pasted in, those inexplicably stay:

<p dir="ltr" data-popupalt-original-title="null" title="null">Urban <abbr title="dumbness">Design</abbr> &amp; Planning</p>

Our simple filtering of <p> tags did not account for that, and so the wrapping stayed and made the size inconsistent because different styles applied.

The module we created to remove paragraph tags from single-line fields such as title and caption, Strip paragraph tags filter, has now been updated to deal with this, in what should be a highly robust way.

Turned out to be easier without xpath

Key answer in php - How to Keep HTML Formatting Intact When Parsing with DOM - (No Tag Stripping) - Stack Overflow:w

We are not alone in this request.