ckeditor4 icon indicating copy to clipboard operation
ckeditor4 copied to clipboard

Some ranges throw error when calling `deleteContents(true)`

Open engineering-this opened this issue 6 years ago • 1 comments

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Open https://codepen.io/jacekbogdanski/pen/XWEygOX
  2. Open browser console.
  3. Press button below editor.

Expected result

Editor content is removed.

Actual result

Error thrown

pen.js:13 TypeError: Cannot read property 'insertBefore' of null
    at CKEDITOR.dom.element.insertAfter (ckeditor.js:76)
    at h (ckeditor.js:149)
    at d (ckeditor.js:151)
    at CKEDITOR.dom.range.deleteContents (ckeditor.js:155)
    at CKEDITOR.dom.element.<anonymous> (pen.js:11)
    at CKEDITOR.dom.element.p (ckeditor.js:10)
    at CKEDITOR.dom.element.fire (ckeditor.js:12)
    at HTMLButtonElement.<anonymous> (ckeditor.js:68)

Other details

This is reproducible, when below criteria are met:

  • There are at least two elements in editable
  • Range starts at offset 0 in editable
  • Range ends at last possible offset of last editable child
  • Browser: Any
  • OS: Any
  • CKEditor version: Found in 4.11.4
  • Installed CKEditor plugins: image2

engineering-this avatar Apr 09 '19 11:04 engineering-this

Extracted from https://github.com/ckeditor/ckeditor-dev/issues/2517#issuecomment-481192985

engineering-this avatar Apr 09 '19 11:04 engineering-this