1

I try to add tinyMCE editor to dynamic added elements (Loaded by VUE component), using new API in WP 4.8. And it work but it only add 5 buttons, and no Media button. I tried to use wp.editor.inicialize, but it wont pass any options that I need. So I load Default settings and resoultat is same, but now I can pass more options (some extra)

 (...)
 let editorSettings = wp.editor.getDefaultSettings();

 console.log(editorSettings);
 editorSettings.tinymce.height = 350;
 tinymce.init(editorSettings.tinymce); 
 tinyMCE.execCommand('mceAddEditor', true, this.editorID);
 (...)

Remove using:

wp.editor.remove(this.editorID);  

But what I want is to add Standard Wordpress full tinyMCE editor + Media button with WP standard settings for tinyMCE. Any ideas :) ?

  • worth checking, did you call wp_enqueue_media() on the page? also can you add what the console logged as default settings to your question. – majick Jul 13 '17 at 14:32
  • Yes, without it you cant init Editor, I also tried, using calling wp_editro(...) by ajax and init on it but it still add only 5 buttons :( – Isu Jul 13 '17 at 20:06
  • ok on the first part then, I'd still recommend adding the default editor settings from the console log to your question as the answer may be found in changing one of those as you are doing for the height? – majick Jul 17 '17 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.