- Issue created by @EJTH
- Status changed to Postponed: needs info
over 1 year ago 9:38am 21 September 2023 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Quoting code from
ckeditor5.js
:const editor = Drupal.CKEditor5Instances.get( element.getAttribute('data-ckeditor5-id'), );
Why is that not adequate?
- 🇩🇰Denmark EJTH
I mean sure its adequate, its also trivial to recreate the old map with a single line of code. I just personally don't see how generating unique ID's using Math.random() is a particular useful "improvement", was this map intended to aid in migration from CKE4? In that case I find this scheme of generating random IDs strange, if that was not the intend behind the map, then what was the intention?
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
No idea!
But you can find out the same way I can: through
git
archeology of the commit history at https://www.drupal.org/project/ckeditor5 → ! - 🇧🇷Brazil edmargomes
Example for work today:
let id = $('#edit-container-body-value').attr('data-ckeditor5-id'); Drupal.CKEditor5Instances.get(id).setData(email_content);
you can create a utils like this:
const ckeditorInstanceByElement = (elementId) => { let id = $(elementId).attr('data-ckeditor5-id'); return Drupal.CKEditor5Instances.get(id); };
- Status changed to Active
10 months ago 5:52pm 3 March 2024 - 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
#7: yep! That's similar to what I wrote at #3. How about this: let's add this explicitly to the
ckeditor5.api.php
documentation for improving discoverability of this.