Skip to content

The ImageResize plugin crashes if HtmlEmbed plugin has enabled showPreviews option #8433

Closed
@psmyrek

Description

📝 Provide detailed reproduction steps (if any)

The following code is sufficient to crash the editor:

import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import HtmlEmbed from '@ckeditor/ckeditor5-html-embed/src/htmlembed';
import Image from '@ckeditor/ckeditor5-image/src/image';
import ImageResize from '@ckeditor/ckeditor5-image/src/imageresize';

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        plugins: [
            HtmlEmbed, Image, ImageResize
        ],
        htmlEmbed: {
            showPreviews: true
        }
    } )
    .then( editor => {
        window.editor = editor;
    } )
    .catch( err => {
        console.error( err.stack );
    } );
<div id="editor">
    <div class="raw-html-embed">
        <img src="sample.jpg">
    </div>
</div>

✔️ Expected result

Editor should not crash.

❌ Actual result

There is an Uncaught TypeError:

Uncaught TypeError: Cannot read property 'is' of null
    at Function._createAt (position.js:349)
    at DowncastWriter.createPositionAt (downcastwriter.js:1015)
    at resizer.js:138
    at View.change (view.js:477)
    at Resizer.attach (resizer.js:117)
    at WidgetResize.attachTo (widgetresize.js:129)
    at Document.<anonymous> (imageresizehandles.js:76)
    at Document.fire (emittermixin.js:209)
    at ImageLoadObserver._fireEvents (imageloadobserver.js:52)
    at ProxyEmitter.listenTo.useCapture (imageloadobserver.js:35)

📃 Other details

  • Browser: Firefox 82, Chrome 86
  • OS: Windows 10 x64
  • CKEditor version: 23.1.0
  • Installed CKEditor plugins:
    • HtmlEmbed
    • Image
    • ImageResize

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

Metadata

Assignees

Labels

package:imagesquad:coreIssue to be handled by the Core team.type:bugThis issue reports a buggy (incorrect) behavior.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions