Problem/Motivation
The "Edit Media" button disappears when the "Convert line breaks into HTML" filter is enabled.
There's a javascript error.
Uncaught TypeError: Cannot read property 'insertBeforeMe' of null
at h._setUpEditButton (plugin.js?t=q1mipb:242)
at plugin.js?t=q1mipb:174
at Object.success (plugin.js?t=q1mipb:320)
at c (jquery.min.js?v=3.4.1:2)
at Object.fireWith [as resolveWith] (jquery.min.js?v=3.4.1:2)
at l (jquery.min.js?v=3.4.1:2)
at XMLHttpRequest.<anonymous> (jquery.min.js?v=3.4.1:2)
The issue is that "Convert line breaks into HTML" is wrapping the drupalmedia tag in a `p` tag. The drupalmedia plugin.js assumes that the first element within the widget is the embed and that it has children (so you can call getFirst() on it). Since the `p` tag is empty, calling getFirst() fails returns null, (this is the null which has no insertBeforeMe property).
Proposed resolution
Modify the client-side JavaScript for the media embed filter so that it is able to anticipate the P tag added by filter_autop.
Remaining tasks
- Decide whether to ditch or postpone this work in favor of #3100066: "Convert line breaks into HTML" filter should exclude <drupal-media> tag (see #51-54 for some more info).
- Review and commit