Dispatch per-instance tinyMceEditorInit and batch tinyMceAllEditorsInit events#500
Dispatch per-instance tinyMceEditorInit and batch tinyMceAllEditorsInit events#500claudep merged 4 commits intojazzband:masterfrom
tinyMceEditorInit and batch tinyMceAllEditorsInit events#500Conversation
Introduced a new function to dispatch a custom event when the TinyMCE editor initializes, enhancing integration capabilities.
|
I think this can be considered related to #452 |
claudep
left a comment
There was a problem hiding this comment.
Thanks for the patch. It seems the JS world currently privileges using async with awaits instead of Promises. Would you be able to rewrite your code with async syntax instead?
Please add also an entry in CHANGELOG.rst (under an Unreleased chapter).
At some point, it would also be nice to have the various callbacks documented. But that could be a separate follow-up ticket.
…instead of Promise.then()
|
Thanks for the feedback! I've updated the pull request according to your suggestions:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #500 +/- ##
=======================================
Coverage 86.45% 86.45%
=======================================
Files 6 6
Lines 251 251
Branches 40 40
=======================================
Hits 217 217
Misses 17 17
Partials 17 17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks for your contribution! |
Description
CustomEventnamedtinyMceEditorInitondocumentvia TinyMCE'sinit_instance_callback. The event’sdetailis a singleeditorinstance.init_instance_callbackby wrapping it (user callback is invoked first).initTinyMCEreturn a Promise andinitializeTinyMCEaggregate withPromise.all, dispatching a batchtinyMceAllEditorsInitwith all editors initialized in that batch asdetail.File:
tinymce/static/django_tinymce/init_tinymce.js.Rationale
Allows external scripts to reliably react to editor readiness without forking or patching the package. This enables clean integration points for plugins, hotkeys, and state sync both on initial load and when admin inlines are added.
Usage
Per-instance event:
Batch event (all editors initialized within a batch):
Backwards Compatibility
Changelog
Added: Dispatch per-instance
tinyMceEditorInitand batchtinyMceAllEditorsInitafter TinyMCE initialization.