Stumbled upon this while working on #2061377: [drupalImage] Optionally apply image style to images uploaded in CKEditor 5.

When an image is uploaded in the image dialog of ckeditor, I get the following js error: Uncaught TypeError: Cannot read property 'length' of undefined.

Traced it back to /core/modules/file/file.js line 106 where this.value is undefined.

The reason being that the event is bound to an id, but when you select an image, new markup is inserted (adding the 'Upload' button), and a wrapper with the same id as the file input is added around the input, causing the error (a div wrapper does not have a value).

Also, now we have two HTML elements on the page with the same div, which of course is not valid.

Comments

Wim Leers’s picture

Component: editor.module » file system
Status: Active » Closed (duplicate)
Related issues: +#2235977: JS Client-side file validation is broken (because ajaxPageState is broken?)

This is a duplicate of #2235977: JS Client-side file validation is broken (because ajaxPageState is broken?).

Moving this IS into a comment on that issue.