Problem/Motivation

After updating to the release Paragraphs Features 8.x-1.10
https://www.drupal.org/project/paragraphs_features/releases/8.x-1.10
Bug #3157216: JS very theme specific

Steps to reproduce

Given that the paragraphs_features module was updated to 8.x-1.10 by the composer
When we try to edit any content or block content with a text format which are using the CKEditor
Then the CKEditor will not load mostly when we Edit the content
And the console log will have

Uncaught TypeError: Cannot read property 'split_text' of undefined
    at isValidParagraphsField (plugin.js?t=qgn2hv:225)
    at Object.init (plugin.js?t=qgn2hv:243)
    at Object.<anonymous> (ckeditor.js?v=4.14.1:272)
    at d (ckeditor.js?v=4.14.1:252)
    at Array.n (ckeditor.js?v=4.14.1:253)
    at y (ckeditor.js?v=4.14.1:253)
    at ckeditor.js?v=4.14.1:254

kCreate Basic page

Add Basic block custom bloc

Proposed resolution

Change the logic in

    // Paragraphs split text should work only on widgets where that option is enabled.
    var paragraphWrapperId = $subForm.closest('.paragraphs-tabs-wrapper').attr('id');
    if (typeof drupalSettings.paragraphs_features.split_text === 'undefined' || !drupalSettings.paragraphs_features.split_text[paragraphWrapperId]) {
      return false;
    }

To

    if (typeof drupalSettings.paragraphs_features !== 'undefined') {
      if (typeof drupalSettings.paragraphs_features.split_text === 'undefined') {
        return false;      
      }
      else {
        // Paragraphs split text should work only on widgets where that option is enabled.
        var paragraphWrapperId = $subForm.closest('.paragraphs-tabs-wrapper').attr('id');
        if (!drupalSettings.paragraphs_features.split_text[paragraphWrapperId]) {
          return false;
        }
      }
    }
    else {
      return false;
    }

Remaining tasks

Release

User interface changes

not to load with CKEditor without being configured in the text format
A filter or a button should be configured first. then the split text should be allowed to split by button or by filter
But not auto for all text formats which are using CKEditor.

Test Create Basic page

Test Add Basic block

API changes

N/A

Data model changes

N/A

Comments

RajabNatshah created an issue. See original summary.

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

StatusFileSize
new1.2 KB

Changed the logic to

    if (typeof drupalSettings.paragraphs_features !== 'undefined') {
      if (typeof drupalSettings.paragraphs_features.split_text === 'undefined') {
        return false;      
      }
      else {
        // Paragraphs split text should work only on widgets where that option is enabled.
        var paragraphWrapperId = $subForm.closest('.paragraphs-tabs-wrapper').attr('id');
        if (!drupalSettings.paragraphs_features.split_text[paragraphWrapperId]) {
          return false;
        }
      }
    }
    else {
      return false;
    }

Checked Drupal Standard and Drupal Practice

rajab@vardot-dev:/var/www/html/modules/paragraphs_features$ phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,scss,less,css,info,txt,yml /var/www/html/modules/paragraphs_features/

rajab@vardot-dev:/var/www/html/modules/paragraphs_features$ phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,scss,less,css,info,txt,yml /var/www/html/modules/paragraphs_features/
rajab natshah’s picture

Status: Active » Needs review
rajab natshah’s picture

Issue summary: View changes
volkerk’s picture

Hi,
thank you for finding this issue.
I already created a pull request here: https://github.com/thunder/paragraphs_features/pull/32

seppe beelprez’s picture

Patch in #3 is working. Thx!

utcwebdev’s picture

Nothing to add, other than confirmation of this bug on a project that uses Thunder along with Layout Builder when testing composer update to Drupal 8.9.5 and Thunder 3.5.4... CKEditor is not visible to any user role when editing layout builder blocks.

utcwebdev’s picture

Patch in #3 works for me.

proweb.ua’s picture

#3 works

volker23’s picture

Patch in #3 works. Thank you!

nicholass’s picture

patch #3 works

vladimiraus’s picture

Status: Needs review » Reviewed & tested by the community

Tested on 2 websites: Drupal 8.9 and Drupal 9.0.

indigoxela’s picture

I can confirm that the patch fixes the problem.

  • Drupal core 8.9.6
  • Paragraphs Features 8.x-1.10

  • volkerk authored bb3ef50 on 8.x-1.x
    Issue #3170771 by RajabNatshah, utcwebdev, Seppe Beelprez, volkerk,...
vladimiraus’s picture

Thanks everyone for contributing.

volkerk’s picture

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

Thank you Vladimir, Volker,

Tested the committed fix, better logic.
I confirm that the issue was fixed.
Waiting for a release.

rajab natshah’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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