[wp-trac] [WordPress Trac] #35760: Provide API for TinyMCE editor to be dynamically instantiated via JS
WordPress Trac
noreply at wordpress.org
Thu Jan 5 04:53:35 UTC 2017
#35760: Provide API for TinyMCE editor to be dynamically instantiated via JS
-------------------------+-----------------------------
Reporter: westonruter | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: | Focuses: javascript
-------------------------+-----------------------------
Comment (by azaozz):
Yeah, it's a good idea to be able to (lazy) load and initialize the editor
from JS. The current `wp_editor()` is quite a few years old, and will need
to be rewritten to support that.
There are three main components for TinyMCE: the core or the concatenated
core + plugins, the translation, and the init / settings. The last two
will have to be generated from PHP so a "pure" JS solution is not
possible.
There is also the `wplink` modal (HTML) that will probably need
refactoring to make is easily loadable from JS.
> Create a Customizer control for a rich text editor.
I'm not sure it will be possible to use the current TinyMCE in the
customizer sidebar. There is simply not enough space in there. Also the
user experience will be quite bad, trying to "preview" something in the
sidebar? Thinking it will be much better after the customizer UI is
fixed/updated and (hopefully) moves away from the current layout.
There is also another option: to make a completely different function
/mini-API for loading the editor only for use in JS. The translated
strings will still need to be outputted from PHP, but the editor init
object can be filterable only from JS. This will not contain any settings
from existing plugins, but will be a better option for making editor
instances with different configuration, minimal UI, etc.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35760#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list