tinyMCE is a popular web-based WYSIWYG editor which WordPress uses for rich-text post editing. tinyMCE has a JavaScript interface which we will use to access common functions such as inserting the text directly to the editor.
Edit the
insights.js
file and add the functionality to insert the HTML directly into tinyMCE:// Insights for WordPress plugin // send html to the editor function send_wp_editor(html) { var win = window.dialogArguments || opener || parent || top; win.send_to_editor(html); // alternatively direct tinyMCE command for insert // tinyMCE.execCommand("mceInsertContent", false, html); } function insert_link(html_link) { if ((typeof tinyMCE != "undefined") && ( edt = tinyMCE. getInstanceById('content') ) && !edt.isHidden() ) { var sel = edt.selection.getSel(); if (sel) { var link = '<a href="' + html_link + '" >' + sel + '</a>'; send_wp_editor(link); } } } // setup everything...