diff --git a/src/wp-includes/js/mce-view.js b/src/wp-includes/js/mce-view.js
index 05ff0453e3..7af5873f4a 100644
--- a/src/wp-includes/js/mce-view.js
+++ b/src/wp-includes/js/mce-view.js
@@ -26,7 +26,7 @@ window.wp = window.wp || {};
_.extend( wp.mce.View.prototype, {
initialize: function() {},
- html: function() {},
+ getHtml: function() {},
render: function() {
var html = this.getHtml();
// Search all tinymce editor instances and update the placeholders
@@ -267,27 +267,30 @@ window.wp = window.wp || {};
fetch: function() {
this.attachments = wp.media.gallery.attachments( this.shortcode, this.postID );
- this.attachments.more().done( _.bind( this.render, this ) );
+ this.dfd = this.attachments.more().done( _.bind( this.render, this ) );
},
getHtml: function() {
var attrs = this.shortcode.attrs.named,
- options,
- attachments;
+ attachments = false,
+ options;
- if ( ! this.attachments.length ) {
+ // Don't render errors while still fetching attachments
+ if ( this.dfd && 'pending' === this.dfd.state() && ! this.attachments.length ) {
return;
}
- attachments = this.attachments.toJSON();
+ if ( this.attachments.length ) {
+ attachments = this.attachments.toJSON();
- _.each( attachments, function( attachment ) {
- if ( attachment.sizes.thumbnail ) {
- attachment.thumbnail = attachment.sizes.thumbnail;
- } else {
- attachment.thumbnail = attachment.sizes.full;
- }
- } );
+ _.each( attachments, function( attachment ) {
+ if ( attachment.sizes.thumbnail ) {
+ attachment.thumbnail = attachment.sizes.thumbnail;
+ } else {
+ attachment.thumbnail = attachment.sizes.full;
+ }
+ } );
+ }
options = {
attachments: attachments,
diff --git a/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css b/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
index 6151554e5c..4b511dded3 100644
--- a/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
+++ b/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
@@ -328,6 +328,30 @@ audio {
overflow-x: hidden;
}
+.gallery-error {
+ border: 1px solid #dedede;
+ padding: 20px 0;
+ margin: 0;
+}
+
+.selected .gallery-error {
+ border-color: transparent;
+}
+
+.gallery-error .dashicons {
+ display: block;
+ margin: 0 auto;
+ width: 32px;
+ height: 32px;
+ font-size: 32px;
+}
+
+.gallery-error p {
+ margin: 0;
+ text-align: center;
+ font-family: 'Open Sans', sans-serif;
+}
+
.gallery .gallery-item {
float: left;
margin: 0;
diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php
index 1d7536880a..aa2e11f922 100644
--- a/src/wp-includes/media-template.php
+++ b/src/wp-includes/media-template.php
@@ -970,26 +970,32 @@ function wp_print_media_templates() {
+