Problem/Motivation

After the 10.3 update, which upgraded CKEditor from 41.2.0 to 41.3.1, the iFrame button is breaking the editor. The text becomes empty. If I switch between text formats the editor is duplicated (see screenshot). There's a console error:

Uncaught CKEditorError: e.getFirstPosition() is null
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-e.getFirstPosition() is null
    getRelatedElement http://mysite.docker.localhost:8000/modules/contrib/ckeditor_iframe/js/build/iframeembed.js?sfn2ht:1
    getRelatedElement http://mysite.docker.localhost:8000/modules/contrib/ckeditor_iframe/js/build/iframeembed.js?sfn2ht:1
    _updateToolbarsVisibility http://mysite.docker.localhost:8000/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=41.3.1:5
... etc... let me know if more of this would be helpful

I can't replicate this on a clean install of Drupal 10. I can replicate it on another older site that would have been upgraded from CKEditor 4.

This is happening with the 2.x and 3.x versions of this module.

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

megan_m created an issue. See original summary.

megan_m’s picture

Issue summary: View changes
megan_m’s picture

Issue summary: View changes
ckhalilo’s picture

StatusFileSize
new26.81 KB

I got the same error when i migrate to Drupal 10.3
Image duplicate body

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

marieascomedia’s picture

Works for me.
Thank you.

ded’s picture

We are having this issue also with 3.0.0-beta1. Our console error is slightly different:

TypeError: Cannot destructure property 'parent' of 'selection.getFirstPosition(...)' as it is null.
    at getClosestSelectedIframeEmbedWidget (iframeEmbedUtils.js:78:11)
    at Object.getRelatedElement (iframeEmbedToolbar.js:78:102)
    at q._updateToolbarsVisibility (ckeditor5-dll.js?v=41.3.1:5:718206)
    at r.<anonymous> (ckeditor5-dll.js?v=41.3.1:5:717231)
    at r.fire (ckeditor5-dll.js?v=41.3.1:5:663135)
    at r.update (ckeditor5-dll.js?v=41.3.1:5:602960)
    at Object.fire (ckeditor5-dll.js?v=41.3.1:5:663135)
    at de (ckeditor5-dll.js?v=41.3.1:5:201940)
    at pe.fire (ckeditor5-dll.js?v=41.3.1:5:201331)
    at St.<anonymous> (ckeditor5-dll.js?v=41.3.1:5:255790)
lazzyvn’s picture

I have same error with drupal 10.3

earthday47’s picture

Status: Active » Reviewed & tested by the community

I can also confirm that the merge request resolves the issue!

This seems to be a common issue with plugins, such as https://www.drupal.org/project/ckeditor_bs_grid/issues/3389827, and checking for the existence of the object is the resolution.

joelpittet’s picture

Priority: Normal » Major

The input field is empty when this error is happening, Major if not critical so bumping the Priority.

aporie’s picture

+1 RTBC

shani maurya’s picture

I can also confirm that the merge request resolves the issue for D10.3

donpas’s picture

StatusFileSize
new57.75 KB

Made a patch for those still facing this issue with version 3.0.x.

donpas’s picture

Status: Reviewed & tested by the community » Needs review
aporie’s picture

Status: Needs review » Reviewed & tested by the community

Hi Donpas,

There is a MR available. You can find the patch by clicking on "plain diff".

carlosmonroy’s picture

hello,
We encountered the same problem when updating core 10.3.
we had ckeditor_iframe in alpha1

By updating ckeditor_iframe and using the patch in comment #18, ckeditor works again.

caspervoogt’s picture

Patch from #18 works for me.. RTBC IMHO

vanessa.fayard’s picture

I've applied the MR!9 as patch and it applied successfully with no errors.

Tested on Drupal 10.3.2 with drupal/ckeditor_iframe: ^3.0@beta

Thanks

ccarnnia’s picture

++ #23
applied the patch to D10.3.5 successfuly.

bkosborne’s picture

Sorry all, I'll get a new release out today for this.

bkosborne’s picture

  • bkosborne committed a31e2fec on 3.0.x authored by angheloko
    Issue #3457032 by angheloko: CKEditorError: selection.getFirstPosition...
bkosborne’s picture

Status: Reviewed & tested by the community » Fixed
bkosborne’s picture

Included in 3.0.0-beta2

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.