Problem/Motivation
After encrypting the proc_entity_reference_field file and AJAX refreshed the CKEditor powered field has lost UI and previously entered formatted input as a raw html.
Steps to reproduce
- Add and format some content in the CKEditor powered field.
- Upload a file and encrypt it.
- Observe the issue.
The module constructs an element ID like #edit-field-my-field-0-metadata to replace its html though the Drupal generated IDs can have uniqueness suffixes so this mismatch triggers detaching behaviors from the form, hence lost CKEditor UI & formatted input.
Proposed resolution
Use a custom Drupal\Core\Ajax\HtmlCommand and data-proc-metadata selector for the field to reliably select all the proc field instances for AJAX refreshing.
Remaining tasks
No.
User interface changes
No.
API changes
No.
Data model changes
No.
Issue fork proc-3636694
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
drugan commentedComment #4
shank115 commentedTested MR !3 on Drupal 11.4.8 with an article that has a CKEditor body and a proc field.
Steps:
Before the MR: the CKEditor toolbar disappears and the body shows raw HTML.
After the MR: the editor and formatting stay, and the encryption date shows under the right item.
Minor: the '
// Replace _ by - in field name:' comment inProcEncryptForm::setMetadataMessage()is now stale.RTBC from my side.
Comment #5
drugan commented@shank115
Thanks for the review.
I removed the leftover comment in the last commit.
Comment #7
rodrigo panchiniak fernandes commentedMerged. Thanks @drugan and shank115! This will be included in the next release.