Layout Paragraphs breaks CKEditor dialog, possibly Input Filter aspects of Footnotes

Created on 29 August 2022, about 2 years ago
Updated 5 January 2024, 11 months ago

Problem/Motivation

With D9.4.5 + Layout Paragraphs 2.0.1 + Paragraphs 8x-1.15 + Footnotes 3.0.1, breakage of many aspects of Footnotes is observed.

- Footnotes input dialog generated by the CKEditor plugin does not allow entry into either field
- Manual edits to text field HTML source that involve setting the footnote tag value field are not retained on node save

It is possible the latter issue could be solved by a configuration I have not tried / stumbled upon. If so, documenting the correct configuration (of the Input filter?) is needed for easier user onboarding into the Footnotes ecosystem.

Steps to reproduce

- Install Drupal, Paragraphs, Layout Paragraphs, Footnotes from composer and enable modules as as normal
- Configure the input filter type to include CKEditor,
- Configure a content type with a paragraphs field, and use the Layout Paragraphs widget
- Configure at least one layout section paragraph type, and one paragraph type with a text field
- Add new content, one or more layout sections, one or more text paragraph instances
- Edit a text paragraph instance and press the CKEditor Footnote button
- Note that the dialog box comes up with fields that cannot accept any entry.

Proposed resolution

Adjust javascript for CKEditor Footnote module, and/or text input filter system to support Layout Paragraphs

Remaining tasks

Unknown

User interface changes

Unknown

API changes

Unknown

Data model changes

Unknown

πŸ› Bug report
Status

Postponed

Version

3.0

Component

Footnotes

Created by

πŸ‡ΊπŸ‡ΈUnited States higherform

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    I am hopeful that sorting https://www.drupal.org/project/footnotes/issues/3405986 ✨ Switch to Modal window to allow more editor control Fixed will also sort this issue and hope to provide an upgrade path. Going to postpone this one for now.

  • πŸ‡¬πŸ‡§United Kingdom scott_euser
  • Status changed to Postponed: needs info 9 months ago
  • πŸ‡¬πŸ‡§United Kingdom scott_euser
  • Status changed to Closed: outdated 9 months ago
  • πŸ‡¨πŸ‡¦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

    I can confirm that (at least with Claro/Gin theme) ✨ Switch to Modal window to allow more editor control Fixed fixed this issue.

  • πŸ‡¬πŸ‡§United Kingdom alanoakden

    I just want to add a comment in here for anyone still dealing with CKeditor 4 and seeing this issue that may need a fix sooner than moving to CKeditor 5 and applying the patch outlined in this issue πŸ› CKEditor 5 balloons invisible when CKEditor 5 is used inside a modal Needs work (nevertheless, you should really be using CKeditor 5 and indeed I will look to get the project I'm working on to move to this)

    It appears CKeditor 4 doesn't have the ui-dialog class at all, this seems pretty essential to make things work (nevermind if you then see the issues mentioned above)

    In my case, i found simply adding `ui-dialog` as a class to the div that also has `cke_reset_all cke_dialog_container` classes already, made all functionality click into gear and work as expected.

    I have a custom admin subtheme theme added to the project, i did a pre-process hook in the .theme file to add a library on the relevant content type node-edit pages

    function MY_THEME_form_alter(&$form, &$form_state, $form_id) {
      if($form_id == 'node_layout_page_edit_form'){
           $form['#attached']['library'][] = 'MY_THEME/ckEditorInteractivity';
        }
      }

    And then wrote JS similar to this (couldn't see a way to add the class via patch or similar).

    /**
     * @file
     * MY THEME behaviors.
     */
    (function (Drupal) {
    
      'use strict';
    
      Drupal.behaviors.myTheme = {
        attach (context, settings) {
          /** TEMPORARY JS (until CKEditor5 is implemented) that only runs on layout page nodes.
           * This ensures that ckEditor modals are clickable and can be interacted with on layout page nodes.
           * This will observe the DOM and add a class to the CKEditor dialog window once the editor window
           * itself is added to the DOM. */
          const observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                if (mutation.addedNodes && mutation.addedNodes.length > 0) {
                    // element added to DOM
                    let hasClass = [].some.call(mutation.addedNodes, function(el) {
                        return el.classList.contains('cke_dialog_container');
                    });
                    if (hasClass) {
                      let ckEditorDialogueWindows = document.getElementsByClassName("cke_dialog_container");
                      for (const window of ckEditorDialogueWindows) {
                        window.classList.add('ui-dialog');
                      };
    
                    }
                }
            });
        });
    
        var config = {
            attributes: true,
            childList: true,
            characterData: true
        };
    
        observer.observe(document.body, config);
        }
      };
    
    } (Drupal));
    

    This JS observes the page and once CKeditor inserts its dialog divs, it adds the 'ui-dialog' class

    Of course, don't forget to add the JS file reference in your subtheme libraries file

    ckEditorInteractivity:
      js:
        js/ckEditorAddDialogClass.js: {}
    
Production build 0.71.5 2024