CKEditor 5 plugin doesn't default to the selected view when editing

Created on 27 April 2023, about 1 year ago
Updated 2 May 2023, about 1 year ago

Problem/Motivation

When editing an already inserted view element in CKEditor 5, the "View to insert" selectbox in the plugin's dialog window does not default to the selected view.

Steps to reproduce

- insert a new view element with the "Insert view" CKEditor 5 plugin
- select this view element in CKEditor
- click the "Insert view" toolbar button to edit the selected view element

Proposed resolution

Pass the selected view as a parameter to the dialog form. Unfortunately, Drupal.ckeditor5.openDialog (in contrary to CKEditor 4) does not support the existingValues parameter, see https://www.drupal.org/project/drupal/issues/3303191 🐛 Drupal.ckeditor5.openDialog missing existingValues param Needs work . So the patch for drupal/core is necessary. Attaching the core patches below:
For d10 - https://www.drupal.org/project/drupal/issues/3303191#comment-15027372 🐛 Drupal.ckeditor5.openDialog missing existingValues param Needs work
For d9 - https://www.drupal.org/project/drupal/issues/3303191#comment-15027375 🐛 Drupal.ckeditor5.openDialog missing existingValues param Needs work

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇨🇦Canada klimp Montréal, QC

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

Comments & Activities

  • Issue created by @klimp
  • 🇨🇦Canada klimp Montréal, QC
  • 🇩🇪Germany a.dmitriiev

    Thank you! I was also wondering why in CKEditor5 there is no way to change the selected values. Now I see that this is core bug in first place.

  • 🇮🇳India keshav.k

    keshav.k made their first commit to this issue’s fork.

  • @keshavk opened merge request.
  • Status changed to RTBC about 1 year ago
  • 🇮🇳India keshav.k

    I have tested the patch and Created the MR. Confirmed that it solves the problem.

  • 🇨🇦Canada klimp Montréal, QC

    I don't think it makes sense to merge this change as is. We need to make sure that the drupal/core patch has been applied. Maybe we need to check if Drupal.ckeditor5.openDialog receives the 4th 'existingValues' parameter in the module's code

  • Status changed to Needs work about 1 year ago
  • 🇩🇪Germany a.dmitriiev

    There is also views arguments missing in the patch, so it still needs some work. I see the view name and view display is passed, but there is also 1 more parameter to it - views arguments, that are also part of the dialog form and the plugin itself. So, marking this as "Needs work". But there is a good start already.

Production build 0.69.0 2024