[wp-trac] [WordPress Trac] #35760: Provide API for TinyMCE editor to be dynamically instantiated via JS

WordPress Trac noreply at wordpress.org
Tue May 2 21:51:49 UTC 2017


#35760: Provide API for TinyMCE editor to be dynamically instantiated via JS
-------------------------+-------------------------
 Reporter:  westonruter  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  4.8
Component:  Editor       |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  javascript
-------------------------+-------------------------

Comment (by azaozz):

 Replying to [comment:23 westonruter]:
 > ...seems to not enable `contenteditable` in the editor `iframe` when the
 `textarea` is not fully visible (such as while/before `slideDown`).
 >
 > Is this a defect with `wp.editor.initialize()` or with TinyMCE? Or is it
 a known limitation that just needs to be worked around?

 It is a limitation. Ideally `wp.editor.initialize()` should run after all
 animations are done. There are couple of things at play:
 - Iframes cannot be moved in the DOM, or rather they are reloaded after
 they are moved. This is a browser security related limitation that breaks
 TinyMCE.
 - When initializing, TinyMCE gets the dimensions and position of the
 textarea to be able to replace it seamlessly. This doesn't work if the
 textarea is hidden. (There may be a workaround for that, will look
 further).

 In the "main" editor the textarea is shown initially but any text in it is
 set to `color: white;` to prevent the initial "flash" of the unstyled
 content. Can probably look at doing something similar.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35760#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list