Problem/Motivation
The dom_apply_styles plugin from #3042539: Apply styles configured for CKEditor can replace an HTML element with another, but it cannot remove an element entirely, leaving just the inner HTML.
For example, we might want to change this
<p>Old <font>markup</font> can have all sorts of <i></i> useless <font>tags</font>!</p>
to this:
<p>Old markup can have all sorts of useless tags!</p>
Proposed resolution
Either add a new DOM plugin for removing tags, based on an XPath expression, or add options to the dom_apply_styles plugin to achieve the same result.
Remaining tasks
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
benjifisherThe attached patch provides a new process plugin,
dom_remove. It does what the issue title says: it removes HTML elements (or the relatedDOMDocumentnodes). This is different from the example in the issue description, where just the tags are removed.I am providing the patch here for convenience. The active discussion is on the related DrupalSpoons issue.
Comment #3
heddnThis was fixed in https://gitlab.com/drupalspoons/migrate_plus/-/merge_requests/9.
Comment #5
leonardpg commentedWas a process plugin ever created to address the use case originally presented about removing just the tags and leaving the inner text? I'm asking here before I go ahead and roll my own. Thanks.
Comment #6
szeidlerFor stripping the tags there is no additional plugin needed. You can just use the callback plugin like this.