X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/dc1231b7312fbdca99e9e887cc2bb35a28f85cdc..b22765f41bf0b2021b9beb9120ee0ac91fa89292:/wp-admin/js/customize-controls.js diff --git a/wp-admin/js/customize-controls.js b/wp-admin/js/customize-controls.js index c0ac1774..8fa7bb09 100644 --- a/wp-admin/js/customize-controls.js +++ b/wp-admin/js/customize-controls.js @@ -3,13 +3,22 @@ var Container, focus, api = wp.customize; /** + * A Customizer Setting. + * + * A setting is WordPress data (theme mod, option, menu, etc.) that the user can + * draft changes to in the Customizer. + * + * @see PHP class WP_Customize_Setting. + * * @class * @augments wp.customize.Value * @augments wp.customize.Class * - * @param options - * - previewer - The Previewer instance to sync with. - * - transport - The transport to use for previewing. Supports 'refresh' and 'postMessage'. + * @param {object} id The Setting ID. + * @param {object} value The initial value of the setting. + * @param {object} options.previewer The Previewer instance to sync with. + * @param {object} options.transport The transport to use for previewing. Supports 'refresh' and 'postMessage'. + * @param {object} options.dirty */ api.Setting = api.Value.extend({ initialize: function( id, value, options ) { @@ -18,9 +27,15 @@ this.id = id; this.transport = this.transport || 'refresh'; this._dirty = options.dirty || false; + this.notifications = new api.Values({ defaultConstructor: api.Notification }); + // Whenever the setting's value changes, refresh the preview. this.bind( this.preview ); }, + + /** + * Refresh the preview, respective of the setting's refresh policy. + */ preview: function() { switch ( this.transport ) { case 'refresh': @@ -28,6 +43,24 @@ case 'postMessage': return this.previewer.send( 'setting', [ this.id, this() ] ); } + }, + + /** + * Find controls associated with this setting. + * + * @since 4.6.0 + * @returns {wp.customize.Control[]} Controls associated with setting. + */ + findControls: function() { + var setting = this, controls = []; + api.control.each( function( control ) { + _.each( control.settings, function( controlSetting ) { + if ( controlSetting.id === setting.id ) { + controls.push( control ); + } + } ); + } ); + return controls; } }); @@ -60,10 +93,10 @@ * @since 4.1.0 * * @param {Object} [params] - * @param {Callback} [params.completeCallback] + * @param {Function} [params.completeCallback] */ focus = function ( params ) { - var construct, completeCallback, focus; + var construct, completeCallback, focus, focusElement; construct = this; params = params || {}; focus = function () { @@ -76,8 +109,12 @@ focusContainer = construct.container; } - // Note that we can't use :focusable due to a jQuery UI issue. See: https://github.com/jquery/jquery-ui/pull/1583 - focusContainer.find( 'input, select, textarea, button, object, a[href], [tabindex]' ).filter( ':visible' ).first().focus(); + focusElement = focusContainer.find( '.control-focus:first' ); + if ( 0 === focusElement.length ) { + // Note that we can't use :focusable due to a jQuery UI issue. See: https://github.com/jquery/jquery-ui/pull/1583 + focusElement = focusContainer.find( 'input, select, textarea, button, object, a[href], [tabindex]' ).filter( ':visible' ).first(); + } + focusElement.focus(); }; if ( params.completeCallback ) { completeCallback = params.completeCallback; @@ -272,10 +309,9 @@ }, /** - * Handle changes to the active state. + * Active state change handler. * - * This does not change the active state, it merely handles the behavior - * for when it does change. + * Shows the container if it is active, hides it if not. * * To override by subclass, update the container's UI to reflect the provided active state. * @@ -287,7 +323,7 @@ * @param {Object} args.completeCallback */ onChangeActive: function( active, args ) { - var duration, construct = this; + var duration, construct = this, expandedOtherPanel; if ( args.unchanged ) { if ( args.completeCallback ) { args.completeCallback(); @@ -296,6 +332,24 @@ } duration = ( 'resolved' === api.previewer.deferred.active.state() ? args.duration : 0 ); + + if ( construct.extended( api.Panel ) ) { + // If this is a panel is not currently expanded but another panel is expanded, do not animate. + api.panel.each(function ( panel ) { + if ( panel !== construct && panel.expanded() ) { + expandedOtherPanel = panel; + duration = 0; + } + }); + + // Collapse any expanded sections inside of this panel first before deactivating. + if ( ! active ) { + _.each( construct.sections(), function( section ) { + section.collapse( { duration: 0 } ); + } ); + } + } + if ( ! $.contains( document, construct.container[0] ) ) { // jQuery.fn.slideUp is not hiding an element if it is not in the DOM construct.container.toggle( active ); @@ -316,6 +370,11 @@ construct.container.stop( true, true ).slideUp( duration, args.completeCallback ); } } + + // Recalculate the margin-top immediately, not waiting for debounced reflow, to prevent momentary (100ms) vertical jiggle. + if ( expandedOtherPanel ) { + expandedOtherPanel._recalculateTopMargin(); + } }, /** @@ -365,39 +424,48 @@ }, /** - * @param {Boolean} expanded - * @param {Object} [params] - * @returns {Boolean} false if state already applied + * Handle the toggle logic for expand/collapse. + * + * @param {Boolean} expanded - The new state to apply. + * @param {Object} [params] - Object containing options for expand/collapse. + * @param {Function} [params.completeCallback] - Function to call when expansion/collapse is complete. + * @returns {Boolean} false if state already applied or active state is false */ - _toggleExpanded: function ( expanded, params ) { - var self = this; + _toggleExpanded: function( expanded, params ) { + var instance = this, previousCompleteCallback; params = params || {}; - var section = this, previousCompleteCallback = params.completeCallback; - params.completeCallback = function () { + previousCompleteCallback = params.completeCallback; + + // Short-circuit expand() if the instance is not active. + if ( expanded && ! instance.active() ) { + return false; + } + + params.completeCallback = function() { if ( previousCompleteCallback ) { - previousCompleteCallback.apply( section, arguments ); + previousCompleteCallback.apply( instance, arguments ); } if ( expanded ) { - section.container.trigger( 'expanded' ); + instance.container.trigger( 'expanded' ); } else { - section.container.trigger( 'collapsed' ); + instance.container.trigger( 'collapsed' ); } }; - if ( ( expanded && this.expanded.get() ) || ( ! expanded && ! this.expanded.get() ) ) { + if ( ( expanded && instance.expanded.get() ) || ( ! expanded && ! instance.expanded.get() ) ) { params.unchanged = true; - self.onChangeExpanded( self.expanded.get(), params ); + instance.onChangeExpanded( instance.expanded.get(), params ); return false; } else { params.unchanged = false; - this.expandedArgumentsQueue.push( params ); - this.expanded.set( expanded ); + instance.expandedArgumentsQueue.push( params ); + instance.expanded.set( expanded ); return true; } }, /** * @param {Object} [params] - * @returns {Boolean} false if already expanded + * @returns {Boolean} false if already expanded or if inactive. */ expand: function ( params ) { return this._toggleExpanded( true, params ); @@ -405,7 +473,7 @@ /** * @param {Object} [params] - * @returns {Boolean} false if already collapsed + * @returns {Boolean} false if already collapsed. */ collapse: function ( params ) { return this._toggleExpanded( false, params ); @@ -526,6 +594,13 @@ }; section.panel.bind( inject ); inject( section.panel.get() ); // Since a section may never get a panel, assume that it won't ever get one + + section.deferred.embedded.done(function() { + // Fix the top margin after reflow. + api.bind( 'pane-contents-reflowed', _.debounce( function() { + section._recalculateTopMargin(); + }, 100 ) ); + }); }, /** @@ -633,13 +708,7 @@ // Fix the height after browser resize. $( window ).on( 'resize.customizer-section', _.debounce( resizeContentHeight, 100 ) ); - // Fix the top margin after reflow. - api.bind( 'pane-contents-reflowed', _.debounce( function() { - var offset = ( content.offset().top - headerActionsHeight ); - if ( 0 < offset ) { - content.css( 'margin-top', ( parseInt( content.css( 'margin-top' ), 10 ) - offset ) ); - } - }, 100 ) ); + setTimeout( _.bind( section._recalculateTopMargin, section ), 0 ); }; } @@ -680,6 +749,25 @@ args.completeCallback(); } } + }, + + /** + * Recalculate the top margin. + * + * @since 4.4.0 + * @private + */ + _recalculateTopMargin: function() { + var section = this, content, offset, headerActionsHeight; + content = section.container.find( '.accordion-section-content' ); + if ( 0 === content.length ) { + return; + } + headerActionsHeight = $( '#customize-header-actions' ).height(); + offset = ( content.offset().top - headerActionsHeight ); + if ( 0 < offset ) { + content.css( 'margin-top', ( parseInt( content.css( 'margin-top' ), 10 ) - offset ) ); + } } }); @@ -910,6 +998,16 @@ } }, + /** + * Recalculate the top margin. + * + * @since 4.4.0 + * @private + */ + _recalculateTopMargin: function() { + api.Panel.prototype._recalculateTopMargin.call( this ); + }, + /** * Render control's screenshot if the control comes into view. * @@ -1142,6 +1240,11 @@ parentContainer.append( panel.container ); panel.renderContent(); } + + api.bind( 'pane-contents-reflowed', _.debounce( function() { + panel._recalculateTopMargin(); + }, 100 ) ); + panel.deferred.embedded.resolve(); }, @@ -1240,7 +1343,7 @@ * @param {Boolean} expanded * @param {Object} args * @param {Boolean} args.unchanged - * @param {Callback} args.completeCallback + * @param {Function} args.completeCallback */ onChangeExpanded: function ( expanded, args ) { @@ -1255,14 +1358,14 @@ // Note: there is a second argument 'args' passed var position, scroll, panel = this, - section = panel.container.closest( '.accordion-section' ), // This is actually the panel. - overlay = section.closest( '.wp-full-overlay' ), - container = section.closest( '.wp-full-overlay-sidebar-content' ), + accordionSection = panel.container.closest( '.accordion-section' ), + overlay = accordionSection.closest( '.wp-full-overlay' ), + container = accordionSection.closest( '.wp-full-overlay-sidebar-content' ), siblings = container.find( '.open' ), topPanel = overlay.find( '#customize-theme-controls > ul > .accordion-section > .accordion-section-title' ), - backBtn = section.find( '.customize-panel-back' ), - panelTitle = section.find( '.accordion-section-title' ).first(), - content = section.find( '.control-panel-content' ), + backBtn = accordionSection.find( '.customize-panel-back' ), + panelTitle = accordionSection.find( '.accordion-section-title' ).first(), + content = accordionSection.find( '.control-panel-content' ), headerActionsHeight = $( '#customize-header-actions' ).height(); if ( expanded ) { @@ -1284,7 +1387,7 @@ position = content.offset().top; scroll = container.scrollTop(); content.css( 'margin-top', ( headerActionsHeight - position - scroll ) ); - section.addClass( 'current-panel' ); + accordionSection.addClass( 'current-panel' ); overlay.addClass( 'in-sub-panel' ); container.scrollTop( 0 ); if ( args.completeCallback ) { @@ -1294,14 +1397,10 @@ topPanel.attr( 'tabindex', '-1' ); backBtn.attr( 'tabindex', '0' ); backBtn.focus(); - - // Fix the top margin after reflow. - api.bind( 'pane-contents-reflowed', _.debounce( function() { - content.css( 'margin-top', ( parseInt( content.css( 'margin-top' ), 10 ) - ( content.offset().top - headerActionsHeight ) ) ); - }, 100 ) ); + panel._recalculateTopMargin(); } else { siblings.removeClass( 'open' ); - section.removeClass( 'current-panel' ); + accordionSection.removeClass( 'current-panel' ); overlay.removeClass( 'in-sub-panel' ); content.delay( 180 ).hide( 0, function() { content.css( 'margin-top', 'inherit' ); // Reset @@ -1316,6 +1415,20 @@ } }, + /** + * Recalculate the top margin. + * + * @since 4.4.0 + * @private + */ + _recalculateTopMargin: function() { + var panel = this, headerActionsHeight, content, accordionSection; + headerActionsHeight = $( '#customize-header-actions' ).height(); + accordionSection = panel.container.closest( '.accordion-section' ); + content = accordionSection.find( '.control-panel-content' ); + content.css( 'margin-top', ( parseInt( content.css( 'margin-top' ), 10 ) - ( content.offset().top - headerActionsHeight ) ) ); + }, + /** * Render the panel from its JS template, if it exists. * @@ -1349,14 +1462,16 @@ * @class * @augments wp.customize.Class * - * @param {string} id Unique identifier for the control instance. - * @param {object} options Options hash for the control instance. + * @param {string} id Unique identifier for the control instance. + * @param {object} options Options hash for the control instance. * @param {object} options.params - * @param {object} options.params.type Type of control (e.g. text, radio, dropdown-pages, etc.) - * @param {string} options.params.content The HTML content for the control. - * @param {string} options.params.priority Order of priority to show the control within the section. + * @param {object} options.params.type Type of control (e.g. text, radio, dropdown-pages, etc.) + * @param {string} options.params.content The HTML content for the control. + * @param {string} options.params.priority Order of priority to show the control within the section. * @param {string} options.params.active - * @param {string} options.params.section + * @param {string} options.params.section The ID of the section the control belongs to. + * @param {string} options.params.settings.default The ID of the setting the control relates to. + * @param {string} options.params.settings.data * @param {string} options.params.label * @param {string} options.params.description * @param {string} options.params.instanceNumber Order in which this instance was created in relation to other instances. @@ -1382,6 +1497,7 @@ control.priority = new api.Value(); control.active = new api.Value(); control.activeArgumentsQueue = []; + control.notifications = new api.Values({ defaultConstructor: api.Notification }); control.elements = []; @@ -1422,24 +1538,70 @@ api.utils.bubbleChildValueChanges( control, [ 'section', 'priority', 'active' ] ); - // Associate this control with its settings when they are created + /* + * After all settings related to the control are available, + * make them available on the control and embed the control into the page. + */ settings = $.map( control.params.settings, function( value ) { return value; }); - api.apply( api, settings.concat( function () { - var key; + if ( 0 === settings.length ) { + control.setting = null; control.settings = {}; - for ( key in control.params.settings ) { - control.settings[ key ] = api( control.params.settings[ key ] ); - } + control.embed(); + } else { + api.apply( api, settings.concat( function() { + var key; - control.setting = control.settings['default'] || null; + control.settings = {}; + for ( key in control.params.settings ) { + control.settings[ key ] = api( control.params.settings[ key ] ); + } - control.embed(); - }) ); + control.setting = control.settings['default'] || null; + + // Add setting notifications to the control notification. + _.each( control.settings, function( setting ) { + setting.notifications.bind( 'add', function( settingNotification ) { + var controlNotification, code, params; + code = setting.id + ':' + settingNotification.code; + params = _.extend( + {}, + settingNotification, + { + setting: setting.id + } + ); + controlNotification = new api.Notification( code, params ); + control.notifications.add( controlNotification.code, controlNotification ); + } ); + setting.notifications.bind( 'remove', function( settingNotification ) { + control.notifications.remove( setting.id + ':' + settingNotification.code ); + } ); + } ); + + control.embed(); + }) ); + } + // After the control is embedded on the page, invoke the "ready" method. control.deferred.embedded.done( function () { + /* + * Note that this debounced/deferred rendering is needed for two reasons: + * 1) The 'remove' event is triggered just _before_ the notification is actually removed. + * 2) Improve performance when adding/removing multiple notifications at a time. + */ + var debouncedRenderNotifications = _.debounce( function renderNotifications() { + control.renderNotifications(); + } ); + control.notifications.bind( 'add', function( notification ) { + wp.a11y.speak( notification.message, 'assertive' ); + debouncedRenderNotifications(); + } ); + control.notifications.bind( 'remove', debouncedRenderNotifications ); + control.renderNotifications(); + control.ready(); }); }, @@ -1454,7 +1616,7 @@ // Watch for changes to the section state inject = function ( sectionId ) { var parentContainer; - if ( ! sectionId ) { // @todo allow a control to be embedded without a section, for instance a control embedded in the frontend + if ( ! sectionId ) { // @todo allow a control to be embedded without a section, for instance a control embedded in the front end. return; } // Wait for the section to be registered @@ -1481,6 +1643,85 @@ */ ready: function() {}, + /** + * Get the element inside of a control's container that contains the validation error message. + * + * Control subclasses may override this to return the proper container to render notifications into. + * Injects the notification container for existing controls that lack the necessary container, + * including special handling for nav menu items and widgets. + * + * @since 4.6.0 + * @returns {jQuery} Setting validation message element. + * @this {wp.customize.Control} + */ + getNotificationsContainerElement: function() { + var control = this, controlTitle, notificationsContainer; + + notificationsContainer = control.container.find( '.customize-control-notifications-container:first' ); + if ( notificationsContainer.length ) { + return notificationsContainer; + } + + notificationsContainer = $( '
' ); + + if ( control.container.hasClass( 'customize-control-nav_menu_item' ) ) { + control.container.find( '.menu-item-settings:first' ).prepend( notificationsContainer ); + } else if ( control.container.hasClass( 'customize-control-widget_form' ) ) { + control.container.find( '.widget-inside:first' ).prepend( notificationsContainer ); + } else { + controlTitle = control.container.find( '.customize-control-title' ); + if ( controlTitle.length ) { + controlTitle.after( notificationsContainer ); + } else { + control.container.prepend( notificationsContainer ); + } + } + return notificationsContainer; + }, + + /** + * Render notifications. + * + * Renders the `control.notifications` into the control's container. + * Control subclasses may override this method to do their own handling + * of rendering notifications. + * + * @since 4.6.0 + * @this {wp.customize.Control} + */ + renderNotifications: function() { + var control = this, container, notifications, hasError = false; + container = control.getNotificationsContainerElement(); + if ( ! container || ! container.length ) { + return; + } + notifications = []; + control.notifications.each( function( notification ) { + notifications.push( notification ); + if ( 'error' === notification.type ) { + hasError = true; + } + } ); + + if ( 0 === notifications.length ) { + container.stop().slideUp( 'fast' ); + } else { + container.stop().slideDown( 'fast', null, function() { + $( this ).css( 'height', 'auto' ); + } ); + } + + if ( ! control.notificationsTemplate ) { + control.notificationsTemplate = wp.template( 'customize-control-notifications' ); + } + + control.container.toggleClass( 'has-notifications', 0 !== notifications.length ); + control.container.toggleClass( 'has-error', hasError ); + container.empty().append( $.trim( + control.notificationsTemplate( { notifications: notifications, altNotice: Boolean( control.altNotice ) } ) + ) ); + }, + /** * Normal controls do not expand, so just expand its parent * @@ -1516,7 +1757,7 @@ return; } - if ( ! $.contains( document, this.container ) ) { + if ( ! $.contains( document, this.container[0] ) ) { // jQuery.fn.slideUp is not hiding an element if it is not in the DOM this.container.toggle( active ); if ( args.completeCallback ) { @@ -1638,7 +1879,7 @@ control.setting.set( picker.wpColorPicker('color') ); }, clear: function() { - control.setting.set( false ); + control.setting.set( '' ); } }); @@ -1687,8 +1928,54 @@ control.pausePlayer(); }); - // Re-render whenever the control's setting changes. - control.setting.bind( function () { control.renderContent(); } ); + /** + * Set attachment data and render content. + * + * Note that BackgroundImage.prototype.ready applies this ready method + * to itself. Since BackgroundImage is an UploadControl, the value + * is the attachment URL instead of the attachment ID. In this case + * we skip fetching the attachment data because we have no ID available, + * and it is the responsibility of the UploadControl to set the control's + * attachmentData before calling the renderContent method. + * + * @param {number|string} value Attachment + */ + function setAttachmentDataAndRenderContent( value ) { + var hasAttachmentData = $.Deferred(); + + if ( control.extended( api.UploadControl ) ) { + hasAttachmentData.resolve(); + } else { + value = parseInt( value, 10 ); + if ( _.isNaN( value ) || value <= 0 ) { + delete control.params.attachment; + hasAttachmentData.resolve(); + } else if ( control.params.attachment && control.params.attachment.id === value ) { + hasAttachmentData.resolve(); + } + } + + // Fetch the attachment data. + if ( 'pending' === hasAttachmentData.state() ) { + wp.media.attachment( value ).fetch().done( function() { + control.params.attachment = this.attributes; + hasAttachmentData.resolve(); + + // Send attachment information to the preview for possible use in `postMessage` transport. + wp.customize.previewer.send( control.setting.id + '-attachment-data', this.attributes ); + } ); + } + + hasAttachmentData.done( function() { + control.renderContent(); + } ); + } + + // Ensure attachment data is initially set (for dynamically-instantiated controls). + setAttachmentDataAndRenderContent( control.setting() ); + + // Update the attachment data and re-render the control when the setting changes. + control.setting.bind( setAttachmentDataAndRenderContent ); }, pausePlayer: function () { @@ -1982,22 +2269,22 @@ xInit = parseInt( control.params.width, 10 ), yInit = parseInt( control.params.height, 10 ), ratio = xInit / yInit, - xImg = realWidth, - yImg = realHeight, + xImg = xInit, + yImg = yInit, x1, y1, imgSelectOptions; controller.set( 'canSkipCrop', ! control.mustBeCropped( flexWidth, flexHeight, xInit, yInit, realWidth, realHeight ) ); - if ( xImg / yImg > ratio ) { - yInit = yImg; + if ( realWidth / realHeight > ratio ) { + yInit = realHeight; xInit = yInit * ratio; } else { - xInit = xImg; + xInit = realWidth; yInit = xInit / ratio; } - x1 = ( xImg - xInit ) / 2; - y1 = ( yImg - yInit ) / 2; + x1 = ( realWidth - xInit ) / 2; + y1 = ( realHeight - yInit ) / 2; imgSelectOptions = { handles: true, @@ -2006,6 +2293,8 @@ persistent: true, imageWidth: realWidth, imageHeight: realHeight, + minWidth: xImg > xInit ? xInit : xImg, + minHeight: yImg > yInit ? yInit : yImg, x1: x1, y1: y1, x2: xInit + x1, @@ -2015,11 +2304,15 @@ if ( flexHeight === false && flexWidth === false ) { imgSelectOptions.aspectRatio = xInit + ':' + yInit; } - if ( flexHeight === false ) { - imgSelectOptions.maxHeight = yInit; + + if ( true === flexHeight ) { + delete imgSelectOptions.minHeight; + imgSelectOptions.maxWidth = realWidth; } - if ( flexWidth === false ) { - imgSelectOptions.maxWidth = xInit; + + if ( true === flexWidth ) { + delete imgSelectOptions.minWidth; + imgSelectOptions.maxHeight = realHeight; } return imgSelectOptions; @@ -2150,7 +2443,7 @@ controller.setImageFromAttachment( croppedImage ); controller.frame.close(); } ).fail( function() { - controller.trigger('content:error:crop'); + controller.frame.trigger('content:error:crop'); } ); } else { this.frame.setState( 'cropper' ); @@ -2235,6 +2528,10 @@ api.HeaderTool.UploadsList, api.HeaderTool.DefaultsList ]); + + // Ensure custom-header-crop Ajax requests bootstrap the Customizer to activate the previewed theme. + wp.media.controller.Cropper.prototype.defaults.doCropArgs.wp_customize = 'on'; + wp.media.controller.Cropper.prototype.defaults.doCropArgs.theme = api.settings.theme.stylesheet; }, /** @@ -2394,7 +2691,7 @@ * @param {object} croppedImage Cropped attachment data. */ onCropped: function(croppedImage) { - var url = croppedImage.post_content, + var url = croppedImage.url, attachmentId = croppedImage.attachment_id, w = croppedImage.width, h = croppedImage.height; @@ -2581,6 +2878,9 @@ api.panel = new api.Values({ defaultConstructor: api.Panel }); /** + * An object that fetches a preview in the background of the document, which + * allows for seamless replacement of an existing preview. + * * @class * @augments wp.customize.Messenger * @augments wp.customize.Class @@ -2589,10 +2889,22 @@ api.PreviewFrame = api.Messenger.extend({ sensitivity: 2000, + /** + * Initialize the PreviewFrame. + * + * @param {object} params.container + * @param {object} params.signature + * @param {object} params.previewUrl + * @param {object} params.query + * @param {object} options + */ initialize: function( params, options ) { var deferred = $.Deferred(); - // This is the promise object. + /* + * Make the instance of the PreviewFrame the promise object + * so other objects can easily interact with it. + */ deferred.promise( this ); this.container = params.container; @@ -2609,6 +2921,12 @@ this.run( deferred ); }, + /** + * Run the preview request. + * + * @param {object} deferred jQuery Deferred object to be resolved with + * the request. + */ run: function( deferred ) { var self = this, loaded = false, @@ -2656,6 +2974,13 @@ } } ); } ); + + if ( data.settingValidities ) { + api._handleSettingValidities( { + settingValidities: data.settingValidities, + focusInvalidControl: false + } ); + } } ); this.request = $.ajax( this.previewUrl(), { @@ -2753,7 +3078,7 @@ iframe = $( '