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

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3097338

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

MrPaulDriver created an issue. See original summary.

alison’s picture

👈 "someone else having exact same difficulty"
Yesssss thank you for writing it up and posting!!

From my own share on Slack -- *in addition to* what @MrPaulDriver explained above...


An aside: For some reason, when I enable the embed media button on my site, the "allowed html" tags don't get added to my text format thingy. I added them, but, I'm saying it anyway as a "clue" or whatever.
I was finally able to get the "edit media" button to appear (in a filtered_html text field, which is what we use instead of basic_html) if I go into "source" and manually add data-view-mode="media_library". If I use another view mode, such as "default" or one of our custom view modes, the button does not appear.

...When I have the "edit media" button (by doing what I described above) and I use it, and I choose a different view mode ("default", or a custom view mode), the view mode selection works (data-view-mode is updated in the source, and it "sticks" if I save and re-edit the page), but edit button goes away.


At one point, I think things may have been fixed altogether when I uninstalled and reinstalled the module, but I'm not positive -- and anyway, I know that isn't a "solution," I'm only sharing in case some one else had the same experience.

One other thought, inspired by the uninstall/reinstall thing:
Maybe something was borked bc the site was originally installed with 8.7.x (only a couple months ago -- it's a new site, still under development), then I updated to an 8.8.x-dev version back in early October, then alpha1 then beta1 -- that's when I realized the UI I had wasn't the complete UI (the issue didn't start with beta1, I just didn't know I was missing anything til then) -- and then I updated to rc1 earlier this week.
(I really don't know if this progression of versions has anything to do with anything, I'm just thinking "out loud.")

joseph.olstad’s picture

Status: Active » Postponed (maintainer needs more info)

please clarify, you're in the 'media' queue for 'contrib' it's not the same as core 'media'

Are you using the media module included with 'core' or did you actually download the media module (not recommended) from contrib?

Please clarify and I will triage this appropriately.

mrpauldriver’s picture

Sorry my mistake and yes this is a core media issue. Are you able to move the post?

If it helps, I too have been using media_gallery (successfully) since it first appeared as an experimental module.

joseph.olstad’s picture

Project: D7 Media » Drupal core
Version: 8.x-1.x-dev » 8.8.x-dev
Component: Code » media system
Status: Postponed (maintainer needs more info) » Active

Moving to drupal core queue , media subsystem.

phenaproxima’s picture

@MrPaulDriver, what browser/OS is this? I wonder if it is a browser-specific thing we wouldn't have caught, since Drupal CI's automated tests run against Chrome.

mrpauldriver’s picture

macOS Catalina, Chrome and Firefox. I haven't tried Safari.

alison’s picture

I've experienced this issue in Firefox (70something) and Chrome (I don't remember the version, it's managed by my office, it's usually the latest version or close), on Windows 10.

I've also experienced this issue in Firefox and Chromium on Ubuntu 19.04.

mrpauldriver’s picture

Title: 8.8.0-rc1 - Unable to edit embedded media items with basic_html text format. JS error also seen in console. » Unable to edit embedded media items with basic_html text format. JS error also seen in console.

Revising title as others are now reporting this (on Slack) with the 8.8.0 release

catapipper’s picture

If it helps I'm also getting a deprecation message on Safari prior to the same error above:

[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

I do not however get either error on a fresh install of Drupal via a tarball from Drupal.org so maybe I'm missing something or another module is affecting it adversely.

catapipper’s picture

I narrowed down the issue. If you have Convert line breaks into HTML (i.e. <br> and <p>) enabled for the text format then it throws the error. If it is not enabled the edit button shows up and works just fine. As to why this is conflicting with that particular setting, I couldn't tell you. Although I have checked this with multiple different text formats and several of our platforms and this seemed to be what the issue was for us.

phenaproxima’s picture

Issue summary: View changes

Nice sleuthing, @catapipper! Updating the issue summary with your findings.

mrpauldriver’s picture

Category: Support request » Bug report

Yep. Confirm this. Good catch @catapipper!

Unchecking 'Convert line breaks into HTML' provides a workaround.

Changing to bug report as this should not be necessary.

phenaproxima’s picture

Priority: Normal » Major

Yup, this is unambiguously a bug. I'm going to escalate it to Major, since this conflict means that a common filter configuration can render the media embedding system unusable.

alison’s picture

(also caught up in the Slack thread -- thank you everyone!) (but/and...)

........ugh I haaaaaate posting this, but, I don't have "convert line breaks into HTML" enabled, never have :(

But I'll poke at it a bit and see what I can see.

alison’s picture

I feel like I'm awfully close to a reliable set of steps to reproduce, but I'm not quite there...

My "breakthrough" this afternoon was actually reproducing the problem on a Simplytest site -- feel free to poke around and tweak stuff if you'd like to try to figure it out!
https://stm5dead1ae49b8d-idmgreju1b10khuhb7ifj1tmknm2z8bn.tugboat.qa

For the most part, I've been toggling the "filter_autop" filter, moving the "filter_autop" filter around in the processing order, and tweaking the "media_embed" filter settings (which media types and view modes are enabled, which view mode is selected by default).

And, I grabbed the "allowed HTML" value from my own site (but removed the "entity_embed" filter stuff), along with one image style and image view mode, just like, to see what would happen.

............
As the simplytest.me site sits right now:

  • (⚠️) filter_autop is enabled -- it's right before media_embed in the filter processing order.
  • When I edit my one test page, I get the error and no edit button.
  • If I switch to source and manually add a value for data-caption or data-view-mode and then switch back from source, the edit button is there (and no error).

But/And...

  • (iirc...) If filter_autop is at the bottom of filter processing order and save (basic_html)...
  • When I edit my test page, the edit button is there (and no error) -- but if I toggle "Source" mode (and back), the edit button is gone (and the error is there).

I went through a ton of other variations, but I can't remember all the details right now.

............
About me

Firefox 70.0.1
Ubuntu 19.04
Drupal 8.8.0

mrpauldriver’s picture

Good to see this in quarantine.

How long does a simplytest.me instance stay alive? Could you reproduce this again if necessary?

alison’s picture

I don't remember how long, I feeeel like it's a certain amount of time after it goes idle, and I just refreshed it now, but good point -- I'll do a config export today just in case.

alison’s picture

Mkay, I missed and lost it yesterday -- new environment:
https://stm5ded72e8535b8-0eudlkjyzgxfw9y0w6lqdeduk2qel3gh.tugboat.qa/node/1

Comparable situation:

  • filter_autop enabled, it's second in filter processing order.
  • If you edit the node, there's the error and there's no edit button -- if you switch to Source and add data-caption="hello caption" and then switch back out of Source, no more error and the edit button is there.

Aaaand attached is a full config export!

phenaproxima’s picture

Adding credit for the work to reproduce this bug put in by @MrPaulDriver and @alisonjo315.

oknate’s picture

This is easy to recreate in Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest

Add 'filter_autop' => ['status' => TRUE], in the setUp() function.

And you'll get a failure:

1) Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::testEditableCaption
Failed asserting that a NULL is not empty.

/Users/nathanandersen/dev/d8test/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:117
/Users/nathanandersen/dev/d8test/vendor/phpunit/phpunit/src/Framework/Constraint/LogicalNot.php:123
/Users/nathanandersen/dev/d8test/vendor/phpunit/phpunit/src/Framework/Assert.php:2116
/Users/nathanandersen/dev/d8test/vendor/phpunit/phpunit/src/Framework/Assert.php:659
/Users/nathanandersen/dev/d8test/core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php:1357
/Users/nathanandersen/dev/d8test/core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php:369
/Users/nathanandersen/dev/d8test/vendor/phpunit/phpunit/src/Framework/TestCase.php:1071
/Users/nathanandersen/dev/d8test/vendor/phpunit/phpunit/src/Framework/TestCase.php:939
/Users/nathanandersen/dev/d8test/vendor/phpunit/phpunit/src/Framework/TestResult.php:698
/Users/nathanandersen/dev/d8test/vendor/phpunit/phpunit/src/Framework/TestCase.php:894

Same js error in the console.

plugin.js?t=q29cio:243 Uncaught TypeError: Cannot read property 'insertBeforeMe' of null
    at h._setUpEditButton (plugin.js?t=q29cio:243)
    at plugin.js?t=q29cio:174
    at Object.success (plugin.js?t=q29cio:321)
    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)
oknate’s picture

StatusFileSize
new112.72 KB
new103.16 KB

You can see here how the filter_autop is not playing nice with the embedded media, and is corrupting the output.
Check out the childNodes, where they are getting p tags inserted inside.

oknate’s picture

StatusFileSize
new660 bytes
new1.42 KB

This seems to fix it (at least in the context of the test).

Let'e see if anything else fails. I don't like that var embeddedMedia = embeddedMediaContainer.getFirst(isElementNode); can return a p tag. So I'm leaving it as needs work, for now.

Ideally, these extra p tags wouldn't get added by the other filter.

But we shouldn't call something embeddedMedia if it's the p tag in front of the embedded media, even if it works.

phenaproxima’s picture

Status: Active » Needs work

Looks like tests failed, but thanks for testing this @oknate!

oknate’s picture

Yeah, not what I was expecting. It passed locally. Let me see if I messed up the patch.

oknate’s picture

StatusFileSize
new660 bytes
new2.45 KB

Good news. The failure in #23 was a copy and paste error. I forgot to delete the first line here:

embeddedMedia.getFirst().insertBeforeMe(editButton);
+          if (embeddedMedia.getFirst()) {
+            embeddedMedia.getFirst().insertBeforeMe(editButton);
+          }
+          else {
+            embeddedMedia.insertBeforeMe(editButton);
+          }
oknate’s picture

Assigned: Unassigned » oknate
Status: Needs work » Needs review
StatusFileSize
new1.26 KB

I like this approach better. We just ignore the media embeds in filter_autop. There's already a precedent for this with comments. See
_filter_autop():

$comment = (substr($chunk, 0, 4) == '<!--');
      if ($comment) {
        // Nothing to do, this is a comment.
        $output .= $chunk;
        continue;
      }

We can do the same thing for media embeds. I think it's inappropriate to be auto breaking lines. Especially where it's doing it. Where you have a tag like <drupal-media> and it's adding an empty p before the tag. That's not good.

oknate’s picture

StatusFileSize
new2.14 KB

Adding test coverage to FilterKernelTest::testLineBreakFilter().

oknate’s picture

StatusFileSize
new1.52 KB
new1.52 KB

Same as the last one, but providing a FAIL patch to show the test result in FilterKernelTest changes based on the fix.

oknate’s picture

Issue summary: View changes
oknate’s picture

Issue summary: View changes
oknate’s picture

Issue summary: View changes
oknate’s picture

Title: Unable to edit embedded media items with basic_html text format. JS error also seen in console. » "Convert line breaks into HTML" filter breaks drupalmedia code that adds edit button
oknate’s picture

Issue summary: View changes
oknate’s picture

Issue summary: View changes

The last submitted patch, 29: 3097338-29--FAIL.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 29: 3097338-29.patch, failed testing. View results

oknate’s picture

StatusFileSize
new2.14 KB

Sorry, the patch in 29 was the same as the fail patch inadvertently. I just need to re-upload 28 again.

This patch has the fix and the test coverage. This is the patch to review.

oknate’s picture

Status: Needs work » Needs review
alison’s picture

Woah, so exciting, thank you @oknate! I'll plan on trying it tomorrow, unless someone beats me to it.

oknate’s picture

Issue summary: View changes
oknate’s picture

Issue summary: View changes
mrpauldriver’s picture

Patch 28 works for me

How about you @alisonjo315?

Your comment at #15 suggested your setup was different to mine.

catch’s picture

I think we should probably do the js change here, there might be other filters that do auto-paragraphs with a similar issue to filter_autop around.

phenaproxima’s picture

Issue summary: View changes

Thanks, @catch. Let's proceed with the approach from #26.

phenaproxima’s picture

+++ b/core/modules/media/js/plugins/drupalmedia/plugin.es6.js
@@ -337,7 +337,13 @@
+          if (embeddedMedia.getFirst(isElementNode)) {
+            embeddedMedia.getFirst(isElementNode).insertBeforeMe(editButton);
+          }
+          else {
+            embeddedMedia.insertBeforeMe(editButton);
+          }

This is a bit repetitive, and it could use a comment explaining what we're doing here. How about something like this:

// Add a comment here explaining this logic
const firstElement = embeddedMedia.getFirst(isElementNode);
if (firstElement) {
  firstElement.insertBeforeMe(editButton);
}
else {
  embeddedMedia.insertBeforeMe(editButton);
}
oknate’s picture

StatusFileSize
new1.95 KB

I realize now that there's no real reason we put the edit button inside first element within the embedded media wrapper. It seems more robust to just put it within the wrapper. Then whether the first element is a `p` tag or the `article` element doesn't matter. I also tested this with #3092795: [regression] Restore styling for embedded media edit button in Seven theme and made sure the styles still work, when that patch is applied with this one.

I created a follow-up issue for the drupal-media tag and the filter: #3100066: "Convert line breaks into HTML" filter should exclude <drupal-media> tag. I agree that it would be more robust to handle it both within the plugin.js and in the "Convert line breaks into HTML" filter.

alison’s picture

Assigned: oknate » Unassigned
Status: Needs review » Active

#47 seems to work for me on 8.8.0, with or without filter_autop.

Notes:

  • FWIW, I didn't try the patches before #47.
  • FWIW, I have media_library.settings:advanced_ui set "true."
  • I didn't test with embedded video, only an embedded image.
  • data-align is getting automatically set to "center" when I embed the image, which seems weird to me -- but probably not related to this issue, only mentioning "just in case."

Thank you, @oknate!

alison’s picture

Status: Active » Needs review

Crap, I'm sorry, the issue metadata field values were "out of date" in my open browser tab, I hate when I forget to do a fresh tab before posting a comment...

(Changing status back to "needs review," but it won't let me change the assignment back to oknate.)

oknate’s picture

Assigned: Unassigned » oknate

Assigning back to myself, if any further changes are needed. Thanks for the review, @alisonjo315!

wim leers’s picture

Modify the client-side JavaScript for the media embed filter so that it is able to anticipate the P tag added by filter_autop.

-1

We should fix filter_autop.

If other filters wrap tags in <p> tags, then those filters need to be fixed too. Core JS shouldn't defend against arbitrary crazy things filters could do. The same problem would arise if it were getting wrapped in <div> or <custom> tags. We wouldn't be defending against those either.

Besides, most Drupal 8 sites use CKEditor, and hence don't use filter_autop.

In fact, using a text format that has filter_autop enabled and uses CKEditor will result in weird behavior. That's why Drupal 8's basic_html text format does not use filter_autop, unlike its predecessor (the filtered_html text format in Drupal 7/6/5).

oknate’s picture

Thanks for the feedback, Wim. Now that #3100066: "Convert line breaks into HTML" filter should exclude <drupal-media> tag is RTBC, we may not need this issue, at least to fix this particular issue, i.e. p tags wrapping the drupal-media tag.

Although, the current patch's solution will handle your counterexample too, so it provides additional stability:

The same problem would arise if it were getting wrapped in

or tags

.

The solution puts the edit button directly inside the widget, rather than as a child of the first grandchild of the widget, which is kind of brittle. We were looking for the first element's first element, and it broke because the first element is empty. So this solution will make the edit button placement less brittle. So I think, even if 3100066 is committed, this issue's current patch should still be considered.

alison’s picture

Are you saying the patch here would end up not being used, in favor of #3100066: "Convert line breaks into HTML" filter should exclude <drupal-media> tag, so we should test the other patch for fixing the edit button issue...? (It doesn't feel to me like the other issue would fix the edit button issue, but)

oknate’s picture

Yes, I think we should use that other patch to fix the issue. Then we can leave this one open, if we decide it's possible another filter does the same thing, i.e. wraps the drupal-media tag in markup.

alison’s picture

Iiiiiinteresting, ok........ Adding a note to the issue summary. I'll be following closely :) Thanks!

oknate’s picture

Now that the other issue has landed, this is less urgent (#3100066: "Convert line breaks into HTML" filter should exclude <drupal-media> tag).

I can see some value in fixing this if something else breaks the markup, but perhaps we should wait to see if anyone else has the issue.

I think the JavaScript change would make the plugin more robust, but if we commit it now, we're fixing a problem that no longer exists. So let's leave this open for now, and see if anyone encounters it from an interaction with a different filter plugin.

oknate’s picture

Title: "Convert line breaks into HTML" filter breaks drupalmedia code that adds edit button » If a filter wraps the drupal-media tag in a paragraph, the edit button breaks

Changing the title to de-emphase filter_autop.

sebastix’s picture

Drupal 8.8.2
The filter_autop filter (Convert line breaks into HTML) is disabled for the editor profile

Still having the js error when adding a media entity into the editor (and no edit media button appears)

Uncaught TypeError: Cannot read property 'insertBeforeMe' of null
    at h._setUpEditButton (plugin.js?t=q5n7m0:242)
    at plugin.js?t=q5n7m0:174
    at Object.success (plugin.js?t=q5n7m0: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)
alphex’s picture

I'm seeing this issue, strangely enough though -- on my DEV/TEST environment.

But it works as expected on my localhost.

localhost is a lando environment

DEV/TEST (and eventually PROD) are on Pantheon.


Uncaught TypeError: Cannot read property 'insertBeforeMe' of null
    at h._setUpEditButton (plugin.js?t=q5viq0:242)
    at plugin.js?t=q5viq0:174
    at Object.success (plugin.js?t=q5viq0:320)
    at c (js_bB3-IMAzWNovMKR3MvXVSqQbdMS3KDuJ11jrLJb-efs.js:2)
    at Object.fireWith [as resolveWith] (js_bB3-IMAzWNovMKR3MvXVSqQbdMS3KDuJ11jrLJb-efs.js:2)
    at l (js_bB3-IMAzWNovMKR3MvXVSqQbdMS3KDuJ11jrLJb-efs.js:2)
    at XMLHttpRequest.<anonymous> (js_bB3-IMAzWNovMKR3MvXVSqQbdMS3KDuJ11jrLJb-efs.js:2)

jdleonard’s picture

For me this Javascript error is present (and the "Edit media" button is missing) when the filter "Limit allowed HTML tags and correct faulty HTML" is configured to be AFTER the "Embed media" filter.

jftzsmns’s picture

I came across this issue and it turns out, if you remove the <div> or other element surrounding {{ content }} in your media.html.twig file, you will get this error/issue. Adding a div back into the template around {{ content }} solved it for me.

tfranz’s picture

#61 fixed it for me – thank you!

oknate’s picture

Assigned: oknate » Unassigned

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

sergiur’s picture

#61 does indeed fix the issue. If the media item isn't wrapped in another element (article, div, etc.), the edit button doesn't show. As soon as it's wrapped, it shows. The core 'Stable' theme wraps media in an article element.

I applied the patch at #47 anyway, as changing my templates late into a project broke things. The patch applied correctly on 8.9.1, though only worked with the Convert line breaks into HTML (i.e. <br> and <p>) option enabled.

bdanin’s picture

#61 also fixed it for me. This is annoying as I prefer to strip empty wrapping div's. Luckily, I already use Role Theme Switcher to provide a child-theme of the main theme to anonymous users. For the anonymous theme, I added my custom template that removes empty div's while the authenticated main theme added this empty div back to the media.html.twig file.

This is really not ideal that an empty div is required for embedded inline media in CKeditor to be editable, and it is not documented outside this issue from what I've found.

phenaproxima’s picture

We need to figure out how to proceed here; at a quick glance, it looks like this issue stalled due to disagreement about implementation. Let's figure out what to do, and fix it, because this degrades the authoring experience.

prudloff’s picture

StatusFileSize
new1.34 KB

Here is a reroll of #47 for Drupal 9.1.
Drupal assumes the media is wrapped in something but this is not the case in our theme.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
chamilsanjeewa’s picture

StatusFileSize
new3.02 MB

I applied the #68 patch, which created some UI issues.
image

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andrea.cividini’s picture

+1 for patch #68

JuanMitriatti made their first commit to this issue’s fork.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

gaëlg’s picture

StatusFileSize
new1.4 KB

Reroll of #68 for D9.5

choneyse’s picture

Can confirm that #76 worked for me to bring back the edit button in Drupal 9.5.2. Most likely unrelated to the patch however is now my selection of alignment / style only works on the initial save. When trying to edit the item a second time and change values the changes are not being saved.

azinck’s picture

VladimirAus made their first commit to this issue’s fork.

vladimiraus’s picture

Pushing to MR, hiding files.
Thanks everyone for commits 🍻

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs tests

From what I can tell the MR 3297 is just the patch from #76 no?

As a bug this will need a test case

prexa’s picture

I was having a same issue and it worked by following the comment https://www.drupal.org/project/drupal/issues/3097338#comment-13371176

Still it's work around as it may impact the frontend on our project as vide mode needs to be updated.

Applying the patch #76 would at least provide the Edit Media button without affecting view mode. Also, not getting any issue with saving the alignment, alt text and caption. The only issue is with the edit media button styling. Sometime appears on left, sometimes at the bottom, sometimes at top while editing the media

afayland’s picture

Re-rolled the patch from https://www.drupal.org/project/drupal/issues/3097338#comment-13385746 into the ckeditor module here: https://www.drupal.org/project/ckeditor/issues/3342759#comment-15176900

Since this patch was from 2019, it no longer worked with the updated drupalmedia directory location.

gaëlg’s picture

Can this bug be reproduced on a clean Drupal 10 install, i.e. with CKEditor 5? I don't think so. At least on my test instance I'm able to change the alt and alignment of the embedded media thanks to the new CKE5 UI.

As CKEditor 4 is now contrib and unsupported, I guess this issue should be in CK4 contrib and not in core?

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.