Migrate to CKEditor 5 for Drupal 9.4+ / Drupal 10

Created on 18 November 2022, over 1 year ago
Updated 20 October 2023, 8 months ago
πŸ“Œ Task
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States carsoncho

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 States carsoncho
  • @hershyk opened merge request.
  • Issue was unassigned.
  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States hershy.k

    I've merged in the latest code changes from 8.x-2.x branch and committed my draft work. I have the plugin toolbar item appearing and the general file structure for the ckeditor5 plugin equivalent.

    I haven't made much progress with the functionality of loading the paragraph embed form within the dialog was running into a 403 access denied with the custom route. I suspect this possibly might be related to CSRF token although haven't had much time to look further into it. I'm un-assigning as I won't be able to continue much more work on this project at this time. Hopefully someone else will be able to continue from where I've left off.

  • First commit to issue fork.
  • @pavlosdan opened merge request.
  • Status changed to Needs review over 1 year ago
  • πŸ‡¨πŸ‡¦Canada pavlosdan

    Built on @hershy.k's work to hopefully get this through the finish line or nearer to it.

    Made adjustments to support multiple buttons since multiple paragraph embed buttons can be added.

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

    Hi, thank you for your work on this. I have tried the ckeditor5-fixes branch out and discovered that I needed to also use this updated version of Embed πŸ“Œ Add CKEditor 5 compatibility and keep supporting CKEditor 4 RTBC and this version of Entity Embed ✨ Drupal 10 & CKEditor 5 readiness Fixed to get it working, but it's looking good!

    I noticed a potential bug where some old embedded paragraphs don't have a paragraph_revision_id in my site. When you click to edit the embedded paragraph you get "Uncaught TypeError: Cannot read properties of undefined (reading 'length')".

    You could try using optional chaining (?.) in the JavaScript in paragraphsembedui.js line 109, so if it's undefined it returns undefined instead of an error.

    if (paragraph_revision_id?.length) {
          libraryURL = libraryURL + '/' + paragraph_revision_id;
    }
    
  • Assigned to pavlosdan
  • Status changed to Needs work over 1 year ago
  • πŸ‡¨πŸ‡¦Canada pavlosdan

    Thanks for taking it for a spin and the feedback @chrisrhymes! Setting it back to needs work to address findings in #13.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • πŸ‡¨πŸ‡¦Canada pavlosdan

    Updated merge request to address #13

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    I would like embed and entity_embed to be updated first before fully testing.

  • πŸ‡ΊπŸ‡ΈUnited States sker101 NYC

    I'm not seeing the paragraph embed button being added to the toolbar on the front-end and I'm getting this error in the browser console.

    toolbarview-item-unavailable {item: 'ParagraphsEmbed'}

    Am I missing something? I'm on the latest commit of the feature branch.

    Also, I think we should minify the build file.

  • @sker101 opened merge request.
  • πŸ‡ΊπŸ‡ΈUnited States sker101 NYC

    I created a new branch named "3322523-ckeditor5-fixes-adjustment" which includes the following changes:

    1. Added dynamic support for adding the entity embed buttons of paragraphs to the toolbar items, which addresses the issue mentioned in #18 πŸ“Œ Migrate to CKEditor 5 for Drupal 9.4+ / Drupal 10 Fixed .
    2. Added support for opening the paragraph entity embed dialog when selecting an embedded paragraph, matching the editing behavior of CKEditor 4.
    3. Created an upgrade path so that the toolbar item does not need to be re-added after switching to Ckeditor5 in the editor settings.
    4. Minified the build file.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Just fyi this is essentially postponed until entity_embed and embed are resolved.

    Don’t want to merge anything since it builds on those.

  • Status changed to Needs work about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    FYI MR 13 does not apply because of the DS_Store file that was checked in. That needs to be removed.

    Also the icon wasn't appearing on the text format screen.

  • πŸ‡¨πŸ‡΄Colombia carma03

    Upload temporarily patch file.

  • πŸ‡¨πŸ‡΄Colombia carma03

    Upload temporarily patch file without /js/build/.DS_Store file.

  • if i run patch #23 or #24 i get the following error:

    In drupal 9.5.10 with paragraphs_entity_embed 8.x-2.0-alpha2 and PHP 8.1

    Checking patch .gitignore...
    Checking patch css/paragraphs_entity_embed.dialog.css...
    Checking patch icons/paragraph.svg...
    Checking patch js/build/.DS_Store...
    error: missing binary patch data for 'js/build/.DS_Store'
    error: binary patch does not apply to 'js/build/.DS_Store'
    error: js/build/.DS_Store: patch does not apply
    Checking patch js/build/README.txt...
    Checking patch js/build/embeddedParagraph.js...
    Checking patch js/ckeditor5_plugins/embeddedParagraph/src/command.js...
    Checking patch js/ckeditor5_plugins/embeddedParagraph/src/index.js...
    Checking patch js/ckeditor5_plugins/embeddedParagraph/src/paragraphsembed.js...
    Checking patch js/ckeditor5_plugins/embeddedParagraph/src/paragraphsembedediting.js...
    Checking patch js/ckeditor5_plugins/embeddedParagraph/src/paragraphsembedui.js...
    Checking patch package.json...
    Checking patch paragraphs_entity_embed.ckeditor5.yml...
    Checking patch paragraphs_entity_embed.info.yml...
    error: while searching for:

    # Required modules
    dependencies:
    - paragraphs:paragraphs
    - embed:embed
    - entity_embed:entity_embed

    error: patch failed: paragraphs_entity_embed.info.yml:6
    error: paragraphs_entity_embed.info.yml: patch does not apply
    Checking patch paragraphs_entity_embed.libraries.yml...
    Checking patch paragraphs_entity_embed.module...
    Checking patch src/Plugin/CKEditor4To5Upgrade/EmbeddedParagraphs.php...
    Checking patch src/Plugin/CKEditor5Plugin/DrupalParagraph.php...
    Checking patch src/Plugin/EmbedType/Paragraph.php...
    error: while searching for:
    * {@inheritdoc}
    */
    public function getDefaultIconUrl() {
    return \Drupal::service('file_url_generator')->generateAbsoluteString(\Drupal::service('extension.list.module')->getPath('paragraphs_entity_embed') . '/js/plugins/drupalparagraph/paragraph.png');
    }

    /**

    error: patch failed: src/Plugin/EmbedType/Paragraph.php:40
    error: src/Plugin/EmbedType/Paragraph.php: patch does not apply
    Checking patch webpack.config.js...
    Checking patch yarn.lock...

  • πŸ‡ΊπŸ‡ΈUnited States dobe

    @Nelo_Drup you will likely need to apply patch with 2.x.dev not the alpha.

    I did notice after applying the patch and run 2.x.dev I no longer had the icon for the paragraphs.

  • πŸ‡ΊπŸ‡ΈUnited States dobe

    When I try to use it though in ckeditor 5 I get this error message and no way to embed a paragraph also the entity embed also doesn't have a button in ckeditor:

    Symfony\Component\HttpKernel\Exception\HttpException: Currently, only CKEditor is supported. in Drupal\embed\Access\EmbedButtonEditorAccessCheck->checkButtonEditorAccess() (line 82 of /var/www/html/web/modules/contrib/embed/src/Access/EmbedButtonEditorAccessCheck.php).

  • πŸ‡ΊπŸ‡ΈUnited States dobe

    I had to use the following to allow for this all to work.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Seems entity and entity_embed both got their this week. Should retest this one and see if anything needs to be adjusted.

  • Status changed to Fixed 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    May have got a little confused but MR 13 worked for me. Just needed to tweak some image paths.

    Going to try and get a release out today. I'm fully expecting some tickets to roll in so will be keeping an eye out.

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

Production build 0.69.0 2024