Steps to reproduce

  1. Follow the steps here https://www.drupal.org/docs/8/core/modules/media-library-module/embeddin... to enable embedding media library images in CKEditor.
  2. Create or edit a page, and in CKEditor open the Media Library and select/upload an image.
  3. Once the image is embedded, select it - it should have border with a grab handle (crosshairs) top left.
  4. Click the grab handle and drag to another location in your content - nothing happens.
  5. A JS error is generated:
     Cannot read property 'endContainer' of undefined

Note that:

  • If you embed more images, you can drag and drop these using the drag handle.
  • If you cut the first image, and paste it back in again, then you can drag and drop it using the drag handle.

This appears to be a known bug in CKEditor 4.14.0 - see https://github.com/ckeditor/ckeditor4/issues/3926. I was using a recent version of Chrome (version 81.0.4044.138) on a Mac (macOS Catalina 10.15.4).

Temporary workaround

It may be possible to patch as suggested here - https://github.com/NogaMan/ckeditor4/commit/d4375ba140d8964361014153884e... - but this would need to be applied to an un-minified build of Drupal's core ckeditor.

Just as a quick verification, I attempted to do this on the optimised/minified version (in core/assets/vendor/ckeditor/ckeditor.js). Obviously I wouldn't recommend anyone actually doing this. I replaced if(!c&&!d){var f=this.editor.editable(); with if(!c&&!d&&d!==0){var f=this.editor.editable(); and replaced (!f&&0<b.widgets.selected.length) with
(!f&&f!==0&&0<b.widgets.selected.length), did a cache rebuild and it seemed to work.

Comments

Glugmeister created an issue. See original summary.

glugmeister’s picture

Issue summary: View changes
johan.gant’s picture

Tested this on simplytest.me with the latest Umami install profile + demo site and it occurs there. I'm not sure at the moment how best to incorporate any upstream CKEditor project patches alongside Drupal core. Could definitely use some community input from someone who has a detailed understanding of this component of Drupal.

Version: 8.8.5 » 8.8.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

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.

maacl’s picture

I created an Issue and a patch to update CKeditor to version 4.14.1: #3155110: [backport] Update CKEditor to version 4.14.1

wim leers’s picture

Issue tags: +Media Initiative
maacl’s picture

Status: Active » Closed (outdated)

Ckeditor has been updadet in Drupal Core, this includes a Bugfix for this issue.