CKEditor5 plugin to open edit media modal
1 unresolved thread
1 unresolved thread
The CKeditor5 model for drupalMedia includes the UUID and not the media id, so we need to be able to redirect to the edit form via UUID. This was take from how the entity_embed module provides the edit link in their plugin.
Closes #3352274
Merge request reports
Activity
42 _createButton() { 43 const editor = this.editor; 44 45 editor.ui.componentFactory.add('editMediaButton', (locale) => { 46 const view = new ButtonView(locale); 47 48 view.set({ 49 label: Drupal.t('Edit media'), 50 icon: icons.pencil, 51 tooltip: true, 52 }); 53 54 this.listenTo(view, 'execute', (eventInfo) => { 55 const element = this.editor.model.document.selection.getSelectedElement(); 56 const uuid = element.getAttribute('drupalMediaEntityUuid'); 57 const editUrl = Drupal.url(`edit-media-modal/edit/${uuid}`) At this point the
element
has the type and uuid but not the media id.We want to open the modal for the media id - I was hoping to get the ajax callback to work with following redirect but could not see how - so we probably want to alter the
edit-media-modal/edit/${uuid}
to be something like get id.At the moment the fetch command follows the redirect, then the ajax command requests it again - which is an expensive double up.
changed this line in version 2 of the diff
- Resolved by Eric Smith
- Resolved by Eric Smith
added 1 commit
- 846fef5d - Change endpoint to return edit path - just Drupal.ckeditor.openDialog for opening modal
Please register or sign in to reply