Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 1 addition & 34 deletions js-tests/build/specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1118,43 +1118,10 @@ var shortcodeViewConstructor = {
delayedFetch: function() {
return fetcher.queueToFetch({
post_id: $( '#post_ID' ).val(),
shortcode: this.shortcodeModel.formatShortcode(),
nonce: shortcodeUIData.nonces.preview,
shortcode: this.shortcodeModel.formatShortcode()
});
},

/**
* Fetch a preview of a single shortcode.
*
* Async. Sets this.content and calls this.render.
*
* @return undefined
*/
fetch: function() {
var self = this;

if ( ! this.fetching ) {
this.fetching = true;

wp.ajax.post( 'do_shortcode', {
post_id: $( '#post_ID' ).val(),
shortcode: this.shortcodeModel.formatShortcode(),
nonce: shortcodeUIData.nonces.preview,
}).done( function( response ) {
if ( '' === response ) {
self.content = '<span class="shortcake-notice shortcake-empty">' + self.shortcodeModel.formatShortcode() + '</span>';
} else {
self.content = response;
}
}).fail( function() {
self.content = '<span class="shortcake-error">' + shortcodeUIData.strings.mce_view_error + '</span>';
} ).always( function() {
delete self.fetching;
self.render( null, true );
} );
}
},

/**
* Get the shortcode model and open modal UI for editing.
*
Expand Down
37 changes: 3 additions & 34 deletions js/build/shortcode-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,43 +625,10 @@ var shortcodeViewConstructor = {
delayedFetch: function() {
return fetcher.queueToFetch({
post_id: $( '#post_ID' ).val(),
shortcode: this.shortcodeModel.formatShortcode(),
nonce: shortcodeUIData.nonces.preview,
shortcode: this.shortcodeModel.formatShortcode()
});
},

/**
* Fetch a preview of a single shortcode.
*
* Async. Sets this.content and calls this.render.
*
* @return undefined
*/
fetch: function() {
var self = this;

if ( ! this.fetching ) {
this.fetching = true;

wp.ajax.post( 'do_shortcode', {
post_id: $( '#post_ID' ).val(),
shortcode: this.shortcodeModel.formatShortcode(),
nonce: shortcodeUIData.nonces.preview,
}).done( function( response ) {
if ( '' === response ) {
self.content = '<span class="shortcake-notice shortcake-empty">' + self.shortcodeModel.formatShortcode() + '</span>';
} else {
self.content = response;
}
}).fail( function() {
self.content = '<span class="shortcake-error">' + shortcodeUIData.strings.mce_view_error + '</span>';
} ).always( function() {
delete self.fetching;
self.render( null, true );
} );
}
},

/**
* Get the shortcode model and open modal UI for editing.
*
Expand Down Expand Up @@ -890,6 +857,8 @@ var editAttributeFieldAttachment = sui.views.editAttributeField.extend( {

this._renderAll();

this.triggerCallbacks();

},

_renderAll: function() {
Expand Down
35 changes: 1 addition & 34 deletions js/src/utils/shortcode-view-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,43 +118,10 @@ var shortcodeViewConstructor = {
delayedFetch: function() {
return fetcher.queueToFetch({
post_id: $( '#post_ID' ).val(),
shortcode: this.shortcodeModel.formatShortcode(),
nonce: shortcodeUIData.nonces.preview,
shortcode: this.shortcodeModel.formatShortcode()
});
},

/**
* Fetch a preview of a single shortcode.
*
* Async. Sets this.content and calls this.render.
*
* @return undefined
*/
fetch: function() {
var self = this;

if ( ! this.fetching ) {
this.fetching = true;

wp.ajax.post( 'do_shortcode', {
post_id: $( '#post_ID' ).val(),
shortcode: this.shortcodeModel.formatShortcode(),
nonce: shortcodeUIData.nonces.preview,
}).done( function( response ) {
if ( '' === response ) {
self.content = '<span class="shortcake-notice shortcake-empty">' + self.shortcodeModel.formatShortcode() + '</span>';
} else {
self.content = response;
}
}).fail( function() {
self.content = '<span class="shortcake-error">' + shortcodeUIData.strings.mce_view_error + '</span>';
} ).always( function() {
delete self.fetching;
self.render( null, true );
} );
}
},

/**
* Get the shortcode model and open modal UI for editing.
*
Expand Down