Provide API for TinyMCE editor to be dynamically instantiated via JS
|Reported by:||westonruter||Owned by:|
There is apparently no easy way currently to bootstrap the TinyMCE content editor dynamically via JS, that is to initialize one or more editors after page load. There is a PHP API to embed an editor into a page statically via wp_editor( $content, $editor_id, $settings ) but this does not work with JS (see #26295).
It would be great if there was a proper JS API for spinning up new TinyMCE editors with all of the WordPress extensions and plugins. For example: var editor = new wp.Editor( container, settings );
Ideally the required assets for the editor could be lazy-loaded instead of being loaded all up-front with the initial request.
With an API for initializing an editor with JS, it would then be greatly simplified to do things like:
- Create a Customizer control for a rich text editor.
- Add rich text editing to a Text widget (#35243)
- General content in the Customizer (#34923)
- General frontend editing.
For more background, see conversation: https://wordpress.slack.com/archives/core/p1454615457001581