admin管理员组文章数量:1387399
I'm struggling for two days and started here with success: Why Can't wp_editor Be Used in a Custom Widget?
I managed to have multiple TMCE on one page (displayed by a widget); all save data correctly. When i assign (as required) different IDs to each textfield, i get an upon clicking on the "visual" button (activating tmce):
'Uncaught TypeError: Cannot read property 'onpageload' of undefined'
When I assign a static ID to each textfield, the error is gone, but only the first textfield will get transformed to a tmce; the others remain regular textareas, no error.
I understand why the latter happens. I don't understand the error in first place, this is the resulting code, with a single tmce:
<textarea class="wp-editor-area" rows="30" autocomplete="off" cols="40" name="widgets[c29][wp_editor]" id="widget-bo_widget_rte-c29-wp_editor">this is text</textarea>
Im pretty sure this works in WP <4.8, since it uses TinyMCE <4 (??), but I can not find a solution for > 4.8
I'm struggling for two days and started here with success: Why Can't wp_editor Be Used in a Custom Widget?
I managed to have multiple TMCE on one page (displayed by a widget); all save data correctly. When i assign (as required) different IDs to each textfield, i get an upon clicking on the "visual" button (activating tmce):
'Uncaught TypeError: Cannot read property 'onpageload' of undefined'
When I assign a static ID to each textfield, the error is gone, but only the first textfield will get transformed to a tmce; the others remain regular textareas, no error.
I understand why the latter happens. I don't understand the error in first place, this is the resulting code, with a single tmce:
<textarea class="wp-editor-area" rows="30" autocomplete="off" cols="40" name="widgets[c29][wp_editor]" id="widget-bo_widget_rte-c29-wp_editor">this is text</textarea>
Im pretty sure this works in WP <4.8, since it uses TinyMCE <4 (??), but I can not find a solution for > 4.8
Share Improve this question edited Oct 23, 2018 at 8:15 Krzysiek Dróżdż 25.6k9 gold badges53 silver badges74 bronze badges asked Oct 23, 2018 at 8:07 jansassjansass 213 bronze badges1 Answer
Reset to default 1After three days i found a solution, many others are seeking (dozends of unanswered threads here and there) wp_editor() does not work in WP >4.8
Instead, use wp.editor Javascript-API: https://codex.wordpress/Javascript_Reference/wp.editor
本文标签: customizationMultiple Tinymcewpeditor in WordPress gt48
版权声明:本文标题:customization - Multiple Tinymcewp_editor in WordPress >4.8 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744515724a2610147.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论