wordpress-mce-view-and-shortcode-editor
wordpress-mce-view-and-shortcode-editor copied to clipboard
GetContent fired twice
Hi, i've noticed a stange behavior
when puttin a console.log on the 'getContent' this event is fired twice or more time...
I'm looking for a way to have thie event fired only one time...any idea ?
public function admin_print_footer_scripts() {
if ( ! isset( get_current_screen()->id ) || get_current_screen()->base != 'post' )
return;
?>
<script type="text/javascript">
(function($){
var media = wp.media, shortcode_string = 'boutique_banner';
wp.mce = wp.mce || {};
wp.mce.boutique_banner = {
shortcode_data: {},
template: media.template( 'editor-boutique-banner' ),
getContent: function() {
console.log('getContent')
var options = this.shortcode.attrs.named;
options['innercontent'] = this.shortcode.content;
return this.template(options);
},
View: {
// before WP 4.2:
template: media.template( 'editor-boutique-banner' ),
...