conflict with CKEditor5 Show Block

Created on 26 September 2023, about 1 year ago
Updated 29 January 2024, 10 months ago

Hello
with CKEditor5 Show Block active there is a critical error

ckeditor5.js?s1l6o8:472 TypeError: Cannot destructure property 'parent' of 't.getFirstPosition(...)' as it is null.
at i (bootstrapGrid.js?s1l6o8:1:1169)
at Object.getRelatedElement (bootstrapGrid.js?s1l6o8:1:9523)
at q._updateToolbarsVisibility (ckeditor5-dll.js?v=39.0.1:5:621007)
at n. (ckeditor5-dll.js?v=39.0.1:5:620032)
at n.fire (ckeditor5-dll.js?v=39.0.1:5:569193)
at n.update (ckeditor5-dll.js?v=39.0.1:5:534777)
at Object.fire (ckeditor5-dll.js?v=39.0.1:5:569193)
at $e (ckeditor5-dll.js?v=39.0.1:5:160601)
at Ue.fire (ckeditor5-dll.js?v=39.0.1:5:159992)
at jo. (ckeditor5-dll.js?v=39.0.1:5:217215)

Maybe there must be a missing "return" in the t.getFirstPosition() relational function calls

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France jjancel

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

Merge Requests

Comments & Activities

  • Issue created by @jjancel
  • πŸ‡«πŸ‡·France jjancel

    with version Drupal-10.1.5 the error disappeared, surprisingly! No ?
    following the next update

  • No @jjancel, this problem is not fixed with Drupal 10.1 and 10.2. It happens again without the need for showblock and it’s a serious issue if your editors depend on templates.

    I managed to find the solution to this problem and there are 3 things I need to clarify.

    1. I think that compressing and minimizing the script of a contributed module should not occur because if something fails it's complicated to resolve.
    2. The problem has nothing to do with Show Blocks, the problem is with the code of this module located in the js/build. ShowBlocks is just a victim (I checked it by blocking the functionality from the core).
    3. The problem was due to a lack of verification:
    Here's the solution 😊
    let firstPosition = t.getFirstPosition();
    if (firstPosition !== null) {
    let {parent: o} = firstPosition;
    for (; o; ) {
    if (o.is("element") && s(o))
    return o;
    o = o.parent
    }
    return null
    } else {
    console.log('Error: getFirstPosition() returned null.');
    }
    In this way, when trying to use the filter that contains the tab of this module, it's not lost.

    I'll try to upload the patch here, I’m not very good at submitting patches to the community, I mostly use them locally.

    Happy 2024!!!!!!!

    Gino Nassi.
    Lima-PerΓΊ

  • πŸ‡«πŸ‡·France jjancel

    Hello and good year
    which line should be corrected in js/build/bootstrapGrid.js
    THANKS

  • πŸ‡¨πŸ‡¦Canada b_sharpe

    Can you provide details on how to reproduce this? I installed a fresh d10.2 and enable grid and show blocks both with aggregation on and off and can't get any error.

  • πŸ‡¨πŸ‡¦Canada b_sharpe

    b_sharpe β†’ changed the visibility of the branch 2.0.x to hidden.

  • Status changed to Needs review 11 months ago
  • πŸ‡¨πŸ‡¦Canada b_sharpe

    I can't reproduce, but logically it makes sense to check if null, so see the Merge Request. Marking as needs review.

  • πŸ‡«πŸ‡·France jjancel

    Hello
    on a new installation I am blocked by this message
    what do I must understand
    "The Bootstrap Grid plugin requires another plugin in order to add

    tags and their
    attributes. Enable a plugin that supports adding this tag. If none exists, you You can configure the Edit Source plugin to support these tags."
    thank you
  • πŸ‡¨πŸ‡¦Canada b_sharpe

    @jjancel that was fixed in πŸ› Div not allowed by default. Fixed which currently is only on dev. I'm merging this as its none destructive and will create a new release

  • Status changed to Fixed 10 months ago
  • πŸ‡«πŸ‡·France jjancel

    Nice work @b_sharpe works perfectly
    THANKS

  • πŸ‡«πŸ‡·France jjancel

    Nice work @b_sharpe
    Works perfectly
    THANKS

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

Production build 0.71.5 2024