Embed Block CKEditor Enhancement

Created on 29 July 2021, over 3 years ago
Updated 8 August 2024, 3 months ago

Problem/Motivation

For non-technical content updaters it can be difficult to remember and/or manually apply the correct block syntax. It can also be difficult / cumbersome for an average user to locate the correct block definition id.

Proposed resolution

Integrate the filter with it's own custom CKEditor plugin that can pull in blocks with a select dropdown. We can then generate the element with data-attributes attached to store the block id. The user should be able to right click to edit and modify the block that is attached.

✨ Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States j-barnes

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.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    ckeditor5 is a thing now, unfortunately I've tried all available patches in this issue queue however I no longer see the "Embed Block" widget icon available for ckeditor 5, it is no longer available in ckeditor5, however it still works in ckeditor4.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    see message after switching from ckeditor4 to ckeditor5

    Warning message

    The CKEditor 4 button EmbedBlock does not have a known upgrade path. If it allowed editing markup, then you can do so now through the Source Editing functionality.

    β†’

    ✨ Add support for Ckeditor 5 Needs work

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    2 pass
  • @josepholstad opened merge request.
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.5 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    2 pass
  • Status changed to RTBC over 1 year ago
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    For the love of god, it's ready.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Once this is merged, a new branch should be created for ckeditor5 compatibility.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.0.5 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    run-tests.sh fatal error
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & pgsql-13.5
    last update over 1 year ago
    run-tests.sh fatal error
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Composer changed the way it handles patching, we can no longer patch and get the icon.png using composer.

    I'm going to wait one more week, if there's no commit to dev then I'll fork this project with merge request 6 included

  • Assigned to joseph.olstad
  • Status changed to Active over 1 year ago
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Ok for those using composer to patch, you should use the patch from the MR not the diff.

    https://git.drupalcode.org/project/embed_block/-/merge_requests/6.patch

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    The patch from the MR still won't work for composer.

    It would be just so much easier if this was committed into dev.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    I've never been this frustrated before with a project. Before I go into a diatribe I'll just solve the problem, here's the working patch for composer builds.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    2 pass
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update over 1 year ago
    2 pass
  • Status changed to RTBC over 1 year ago
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    For the love of god, please commit.

  • Status changed to Active over 1 year ago
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    - Applying patches for drupal/embed_block
    https://www.drupal.org/files/issues/2023-07-12/This_patch_creates_icon_b... β†’ (3225938 - Added CKEDITOR plugin functionality)
    Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2023-07-12/This_patch_creates_icon_b... β†’

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    So here's the issue that started 2 months ago and I just realized now there was still a problem, if you want to run this on D10 with ckeditor4, the latest head of dev is needed, and the previous patches didn't work. It's a pita to get the binary to apply, the merge requests were started before the latest commits.

    There has been an enormous amount of great work done here however the barriers to entry are very high because the diffs are so huge and the merge request is so gigantic it's burdensome to work with.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    For those still using Drupal 9 and want to apply a working version of the above, this works:

    composer require drupal/embed_block:'dev-1.x#612f6b401fa'
    this patch:

    "drupal/embed_block": {
          "3225938 - Added CKEDITOR plugin functionality":
          "https://www.drupal.org/files/issues/2022-02-05/3225938_include_binary_icon-18.patch"
    },
    

    For those using Drupal 10, I don't yet have a patch that works with composer.

    see comment #51

  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    MR 6 is good, just need a patch file that includes the icon.png and works with Drupal 10 and composer.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    For Drupal 10 with ckeditor 4 using composer, this will probably work for you:

    composer require drupal/embed_block:'dev-1.x#b7d31c2'

    "drupal/embed_block": {
          "3225938 - Added CKEDITOR plugin functionality":
          "https://www.drupal.org/files/issues/2022-02-05/3225938_include_binary_icon-18.patch",
          "3225938 - MR 5":
          "https://git.drupalcode.org/project/embed_block/-/merge_requests/5.patch"
    
    },
  • Assigned to joseph.olstad
  • Status changed to Active over 1 year ago
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Ok so sometime soon, I hope to make the recommended changes but into MR 6, as MR2 is conflicting.

    I resolved the merge conflicts in MR6 so I'd like to continue the work in MR 6.

    With that said, it might be easier to commit MR6 as-is and fix the remaining issues in a followup issue or set of issues.

    However, I will give it a shot try to resolve all or most of the October 4th 2022 requests by Claudio.

    Hopefully I can get to this in the next few weeks.

    We have much to do, after this we need ckeditor 5 compatibility in a new 2.0.x branch however I highly recommend solving this issue first.

  • Issue was unassigned.
  • Status changed to Needs work about 1 year ago
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Claudiu has a shopping list of requested improvements and changes listed between comment #34 and #35, I just don't have the time at this moment to take this on.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    I realize that others above made this configurable in a more elegant way, just haven't spent enough time on this yet to figure out the latest merge request.

    Also, we're still using ckeditor4 (ck4) even on the latest Drupal core.

    I needed a rerolled diff, something changed somewhere and my diff 10 removed all the items, this is just to limit the selected blocks to "Content block"

    see screenshot:

    Blocks of type "Content block" β†’

    New diff patch, this patch depends on patch 18

    using embed_block 1.x-dev and these two patches, the diff patch limits the selection (not recommended for everyone, but some organizations might like to limit the options).

         "drupal/embed_block": {
                    "3225938 - Added CKEDITOR plugin functionality":
                    "https://www.drupal.org/files/issues/2022-02-05/3225938_include_binary_icon-18.patch",
                    "3225938 - Custom":
                    "https://www.drupal.org/files/issues/2021-12-15/3225938-custom_only_diff-10.patch"
                },
    
    
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    I accidentally put this for testing, it's a fail obviously, it's a part two of patch 18.

    Stick with the latest MR with that said, I'm merely trying to avoid the icon binary issue that occurs with certain patch methods and environments. For whatever reason the widget icon patches better with patch 18, that's the only reason why we're still using it and for lack of time to review / handle the latest MR change requests.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Ah, had to include Lists (Views) also, too polyvalent not to. Need to wet some appetites.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Composer instructions from comment #55 is still working with ckeditor 4.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    ✨ Access Unpublished Linked Blocks Active

    I've extended embed_block functionality to allow draft blocks to load in the context of using access_unpublished where an auHash token is provided, added another patch for embed_block, it's in another issue, rides on top of the patches I'm using. See 3465119.

    In fact, I also wrote a module called access_unpublished_linked_nodes which enhances the utility of access_unpublished.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    I took a closer look between the MR 6 diff and the MR 6 patch.

    The .diff is missing the binary data for the icon

    However, the .patch has the binary data for the icon.

    https://git.drupalcode.org/project/embed_block/-/merge_requests/6.patch

    With that said, I have a small change to push up for the MR 6. In some edge cases the parameter 2 on str_replace can be null which throws an error.

Production build 0.71.5 2024