Wordpress - add custom tinymce shortcode in another text editor and not only classic editor -
here problem: have different text area (isn't wordpress classic editor, many wysiwyg editor visual composer plugin). theme include in tinymce shortcodes. when want insert shortcode in specific textarea, shortcode appears in classic editor everytime. try in code "put code in text box on want insert shortcode , not in traditional publisher". here code think solution :
addwithpopup: function(ed, title, id) { ed.add({ title: title, onclick: function() { tinymce.activeeditor.execcommand('freshshortcodespopup', false, { title: title, identifier: id }); } }); },
hope can me... regards. math.
don't use tinymce.activeeditor
address editor. tinymce.activeeditor
won't change unless user explicitly clicks editor. trap tinymce.activeeditor
not initialized unless editor clicked @ all. better address editor instance using id:
tinymce.get('your_editor_id').execcommand(...
update: about
onclick: function(ed) { console.log('ed:',ed); ed.execcommand('freshshortcodespopup', false, { title: title, identifier: id }); }
Comments
Post a Comment