Hi,

I've created a form with text_format field which have #format value set to CkEditor:

  $form['text'] = array(
    '#type' => 'text_format',
    '#title' => t('HTML'),
    '#default_value' => $text,
    '#attributes' => array('class' => array('input-settings')),
    '#format' => 'ckeditor',
  );

Almost everything works fine, but some of features in the CKEditor just freezing if I click on them and return this JavaScript error:

Uncaught TypeError: Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node'.

For example if I click on the hyperlink for the first time then it works correctly, but for the second time it return the error and freeze: http://prntscr.com/ils3he

Thanks for the help.

Comments

NikaDevs created an issue. See original summary.

wim leers’s picture

Category: Bug report » Support request
Status: Active » Fixed

ckeditor is the machine name of a Text Editor, but #format requires you to specify a Text Format (or, as it's known internally, a FilterFormat config entity ID).

So for example

  '#format' => 'basic_html',
NikaDevs’s picture

Status: Fixed » Active

Hi,

In my case the "ckeditor" is also a name of the Text Format, which was created by the CkEditor module. So the question is still opened.

Thanks.

wim leers’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

Can you post the stack trace for that JS error?

Also: right now, this is not providing sufficient information to reproduce this problem. Could you provide those steps? Thanks!

NikaDevs’s picture

Hi,
This is the stack trace of the JS error: https://monosnap.com/file/BdrbQrmS4ZEThRht7ZkTarvQpcMwmG

Uncaught TypeError: Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node'.
    at ajax.js?v=8.5.6:118
    at Array.filter (<anonymous>)
    at Function.Drupal.ajax.expired (ajax.js?v=8.5.6:117)
    at Drupal.AjaxCommands.settings (ajax.js?v=8.5.6:553)
    at ajax.js?v=8.5.6:413
    at Array.forEach (<anonymous>)
    at Drupal.Ajax.success (ajax.js?v=8.5.6:411)
    at Object.success (ajax.js?v=8.5.6:226)
    at i (jquery.min.js?v=3.2.1:2)
    at Object.fireWith [as resolveWith] (jquery.min.js?v=3.2.1:2)

Thanks.

cilefen’s picture

Title: CkEditor works not correctly then it used on the form » CkEditor works incorrectly when used on a form
Status: Postponed (maintainer needs more info) » Active
wim leers’s picture

Title: CkEditor works incorrectly when used on a form » CKEditor works incorrectly when used on a form
Status: Active » Postponed (maintainer needs more info)

Please upload screenshots to d.o issues directly; those external image hosting services usually cease to exist.

Thanks for providing that screenshot of the JS error, but it doesn't allow me to reproduce this problem. I need the actual steps to reproduce this on a fresh Drupal site. Otherwise I can't help you. Hope you understand.

wim leers’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)