Update WP and plugins

This commit is contained in:
Oliver Davies 2019-04-16 20:56:22 +01:00
parent 10a4713229
commit 1fb77fc4ff
864 changed files with 101724 additions and 78262 deletions

View file

@ -1,6 +1,15 @@
/**
* @output wp-admin/js/widgets/custom-html-widgets.js
*/
/* global wp */
/* eslint consistent-this: [ "error", "control" ] */
/* eslint no-magic-numbers: ["error", { "ignore": [0,1,-1] }] */
/**
* @namespace wp.customHtmlWidget
* @memberOf wp
*/
wp.customHtmlWidgets = ( function( $ ) {
'use strict';
@ -15,14 +24,7 @@ wp.customHtmlWidgets = ( function( $ ) {
}
};
/**
* Text widget control.
*
* @class CustomHtmlWidgetControl
* @constructor
* @abstract
*/
component.CustomHtmlWidgetControl = Backbone.View.extend({
component.CustomHtmlWidgetControl = Backbone.View.extend(/** @lends wp.customHtmlWidgets.CustomHtmlWidgetControl.prototype */{
/**
* View events.
@ -32,11 +34,16 @@ wp.customHtmlWidgets = ( function( $ ) {
events: {},
/**
* Initialize.
* Text widget control.
*
* @constructs wp.customHtmlWidgets.CustomHtmlWidgetControl
* @augments Backbone.View
* @abstract
*
* @param {Object} options - Options.
* @param {jQuery} options.el - Control field container element.
* @param {jQuery} options.syncContainer - Container element where fields are synced for the server.
*
* @returns {void}
*/
initialize: function initialize( options ) {
@ -105,10 +112,10 @@ wp.customHtmlWidgets = ( function( $ ) {
* to prevent the editor's contents from getting sanitized as soon as a user removes focus from
* the editor. This is particularly important for users who cannot unfiltered_html.
*/
control.contentUpdateBypassed = control.fields.content.is( document.activeElement ) || control.editor && control.editor.codemirror.state.focused || 0 !== control.currentErrorAnnotations;
control.contentUpdateBypassed = control.fields.content.is( document.activeElement ) || control.editor && control.editor.codemirror.state.focused || 0 !== control.currentErrorAnnotations.length;
if ( ! control.contentUpdateBypassed ) {
syncInput = control.syncContainer.find( '.sync-input.content' );
control.fields.content.val( syncInput.val() ).trigger( 'change' );
control.fields.content.val( syncInput.val() );
}
},
@ -171,6 +178,8 @@ wp.customHtmlWidgets = ( function( $ ) {
/**
* Handle tabbing to the field before the editor.
*
* @ignore
*
* @returns {void}
*/
onTabPrevious: function onTabPrevious() {
@ -180,6 +189,8 @@ wp.customHtmlWidgets = ( function( $ ) {
/**
* Handle tabbing to the field after the editor.
*
* @ignore
*
* @returns {void}
*/
onTabNext: function onTabNext() {
@ -190,6 +201,8 @@ wp.customHtmlWidgets = ( function( $ ) {
/**
* Disable save button and store linting errors for use in updateFields.
*
* @ignore
*
* @param {Array} errorAnnotations - Error notifications.
* @returns {void}
*/
@ -200,6 +213,8 @@ wp.customHtmlWidgets = ( function( $ ) {
/**
* Update error notice.
*
* @ignore
*
* @param {Array} errorAnnotations - Error annotations.
* @returns {void}
*/
@ -259,6 +274,8 @@ wp.customHtmlWidgets = ( function( $ ) {
/**
* Mapping of widget ID to instances of CustomHtmlWidgetControl subclasses.
*
* @alias wp.customHtmlWidgets.widgetControls
*
* @type {Object.<string, wp.textWidgets.CustomHtmlWidgetControl>}
*/
component.widgetControls = {};
@ -266,8 +283,11 @@ wp.customHtmlWidgets = ( function( $ ) {
/**
* Handle widget being added or initialized for the first time at the widget-added event.
*
* @alias wp.customHtmlWidgets.handleWidgetAdded
*
* @param {jQuery.Event} event - Event.
* @param {jQuery} widgetContainer - Widget container element.
*
* @returns {void}
*/
component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
@ -325,6 +345,8 @@ wp.customHtmlWidgets = ( function( $ ) {
/**
* Setup widget in accessibility mode.
*
* @alias wp.customHtmlWidgets.setupAccessibleMode
*
* @returns {void}
*/
component.setupAccessibleMode = function setupAccessibleMode() {
@ -358,6 +380,8 @@ wp.customHtmlWidgets = ( function( $ ) {
* the widgets admin screen and also via the 'widget-synced' event when making
* a change to a widget in the customizer.
*
* @alias wp.customHtmlWidgets.handleWidgetUpdated
*
* @param {jQuery.Event} event - Event.
* @param {jQuery} widgetContainer - Widget container element.
* @returns {void}
@ -387,7 +411,10 @@ wp.customHtmlWidgets = ( function( $ ) {
* When WordPress enqueues this script, it should have an inline script
* attached which calls wp.textWidgets.init().
*
* @alias wp.customHtmlWidgets.init
*
* @param {object} settings - Options for code editor, exported from PHP.
*
* @returns {void}
*/
component.init = function init( settings ) {

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/media-audio-widget.js
*/
/* eslint consistent-this: [ "error", "control" ] */
(function( component ) {
'use strict';
@ -7,10 +11,10 @@
/**
* Custom audio details frame that removes the replace-audio state.
*
* @class AudioDetailsMediaFrame
* @constructor
* @class wp.mediaWidgets.controlConstructors~AudioDetailsMediaFrame
* @augments wp.media.view.MediaFrame.AudioDetails
*/
AudioDetailsMediaFrame = wp.media.view.MediaFrame.AudioDetails.extend({
AudioDetailsMediaFrame = wp.media.view.MediaFrame.AudioDetails.extend(/** @lends wp.mediaWidgets.controlConstructors~AudioDetailsMediaFrame.prototype */{
/**
* Create the default states.
@ -40,8 +44,8 @@
*
* See WP_Widget_Audio::enqueue_admin_scripts() for amending prototype from PHP exports.
*
* @class AudioWidgetModel
* @constructor
* @class wp.mediaWidgets.modelConstructors.media_audio
* @augments wp.mediaWidgets.MediaWidgetModel
*/
AudioWidgetModel = component.MediaWidgetModel.extend({});
@ -50,10 +54,10 @@
*
* See WP_Widget_Audio::enqueue_admin_scripts() for amending prototype from PHP exports.
*
* @class AudioWidgetModel
* @constructor
* @class wp.mediaWidgets.controlConstructors.media_audio
* @augments wp.mediaWidgets.MediaWidgetControl
*/
AudioWidgetControl = component.MediaWidgetControl.extend({
AudioWidgetControl = component.MediaWidgetControl.extend(/** @lends wp.mediaWidgets.controlConstructors.media_audio.prototype */{
/**
* Show display settings.

View file

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/media-gallery-widget.js
*/
/* eslint consistent-this: [ "error", "control" ] */
(function( component ) {
'use strict';
@ -8,10 +12,10 @@
* Custom gallery details frame.
*
* @since 4.9.0
* @class GalleryDetailsMediaFrame
* @constructor
* @class wp.mediaWidgets~GalleryDetailsMediaFrame
* @augments wp.media.view.MediaFrame.Post
*/
GalleryDetailsMediaFrame = wp.media.view.MediaFrame.Post.extend( {
GalleryDetailsMediaFrame = wp.media.view.MediaFrame.Post.extend(/** @lends wp.mediaWidgets~GalleryDetailsMediaFrame.prototype */{
/**
* Create the default states.
@ -53,21 +57,13 @@
* See WP_Widget_Gallery::enqueue_admin_scripts() for amending prototype from PHP exports.
*
* @since 4.9.0
* @class GalleryWidgetModel
* @constructor
*
* @class wp.mediaWidgets.modelConstructors.media_gallery
* @augments wp.mediaWidgets.MediaWidgetModel
*/
GalleryWidgetModel = component.MediaWidgetModel.extend( {} );
GalleryWidgetModel = component.MediaWidgetModel.extend(/** @lends wp.mediaWidgets.modelConstructors.media_gallery.prototype */{} );
/**
* Gallery widget control.
*
* See WP_Widget_Gallery::enqueue_admin_scripts() for amending prototype from PHP exports.
*
* @since 4.9.0
* @class GalleryWidgetControl
* @constructor
*/
GalleryWidgetControl = component.MediaWidgetControl.extend( {
GalleryWidgetControl = component.MediaWidgetControl.extend(/** @lends wp.mediaWidgets.controlConstructors.media_gallery.prototype */{
/**
* View events.
@ -80,7 +76,12 @@
} ),
/**
* Initialize.
* Gallery widget control.
*
* See WP_Widget_Gallery::enqueue_admin_scripts() for amending prototype from PHP exports.
*
* @constructs wp.mediaWidgets.controlConstructors.media_gallery
* @augments wp.mediaWidgets.MediaWidgetControl
*
* @since 4.9.0
* @param {Object} options - Options.

View file

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/media-image-widget.js
*/
/* eslint consistent-this: [ "error", "control" ] */
(function( component, $ ) {
'use strict';
@ -9,8 +13,8 @@
*
* See WP_Widget_Media_Image::enqueue_admin_scripts() for amending prototype from PHP exports.
*
* @class ImageWidgetModel
* @constructor
* @class wp.mediaWidgets.modelConstructors.media_image
* @augments wp.mediaWidgets.MediaWidgetModel
*/
ImageWidgetModel = component.MediaWidgetModel.extend({});
@ -19,10 +23,10 @@
*
* See WP_Widget_Media_Image::enqueue_admin_scripts() for amending prototype from PHP exports.
*
* @class ImageWidgetModel
* @constructor
* @class wp.mediaWidgets.controlConstructors.media_audio
* @augments wp.mediaWidgets.MediaWidgetControl
*/
ImageWidgetControl = component.MediaWidgetControl.extend({
ImageWidgetControl = component.MediaWidgetControl.extend(/** @lends wp.mediaWidgets.controlConstructors.media_image.prototype */{
/**
* View events.

View file

@ -1,3 +1,7 @@
/**
* @output wp-admin/js/widgets/media-video-widget.js
*/
/* eslint consistent-this: [ "error", "control" ] */
(function( component ) {
'use strict';
@ -7,10 +11,12 @@
/**
* Custom video details frame that removes the replace-video state.
*
* @class VideoDetailsMediaFrame
* @constructor
* @class wp.mediaWidgets.controlConstructors~VideoDetailsMediaFrame
* @augments wp.media.view.MediaFrame.VideoDetails
*
* @private
*/
VideoDetailsMediaFrame = wp.media.view.MediaFrame.VideoDetails.extend({
VideoDetailsMediaFrame = wp.media.view.MediaFrame.VideoDetails.extend(/** @lends wp.mediaWidgets.controlConstructors~VideoDetailsMediaFrame.prototype */{
/**
* Create the default states.
@ -49,8 +55,8 @@
*
* See WP_Widget_Video::enqueue_admin_scripts() for amending prototype from PHP exports.
*
* @class VideoWidgetModel
* @constructor
* @class wp.mediaWidgets.modelConstructors.media_video
* @augments wp.mediaWidgets.MediaWidgetModel
*/
VideoWidgetModel = component.MediaWidgetModel.extend({});
@ -59,10 +65,10 @@
*
* See WP_Widget_Video::enqueue_admin_scripts() for amending prototype from PHP exports.
*
* @class VideoWidgetControl
* @constructor
* @class wp.mediaWidgets.controlConstructors.media_video
* @augments wp.mediaWidgets.MediaWidgetControl
*/
VideoWidgetControl = component.MediaWidgetControl.extend({
VideoWidgetControl = component.MediaWidgetControl.extend(/** @lends wp.mediaWidgets.controlConstructors.media_video.prototype */{
/**
* Show display settings.

View file

@ -1,4 +1,13 @@
/**
* @output wp-admin/js/widgets/media-widgets.js
*/
/* eslint consistent-this: [ "error", "control" ] */
/**
* @namespace wp.mediaWidgets
* @memberOf wp
*/
wp.mediaWidgets = ( function( $ ) {
'use strict';
@ -9,6 +18,8 @@ wp.mediaWidgets = ( function( $ ) {
*
* Media widgets register themselves by assigning subclasses of MediaWidgetControl onto this object by widget ID base.
*
* @memberOf wp.mediaWidgets
*
* @type {Object.<string, wp.mediaWidgets.MediaWidgetModel>}
*/
component.controlConstructors = {};
@ -18,22 +29,22 @@ wp.mediaWidgets = ( function( $ ) {
*
* Media widgets register themselves by assigning subclasses of MediaWidgetControl onto this object by widget ID base.
*
* @memberOf wp.mediaWidgets
*
* @type {Object.<string, wp.mediaWidgets.MediaWidgetModel>}
*/
component.modelConstructors = {};
/**
* Library which persists the customized display settings across selections.
*
* @class PersistentDisplaySettingsLibrary
* @constructor
*/
component.PersistentDisplaySettingsLibrary = wp.media.controller.Library.extend({
component.PersistentDisplaySettingsLibrary = wp.media.controller.Library.extend(/** @lends wp.mediaWidgets.PersistentDisplaySettingsLibrary.prototype */{
/**
* Initialize.
* Library which persists the customized display settings across selections.
*
* @constructs wp.mediaWidgets.PersistentDisplaySettingsLibrary
* @augments wp.media.controller.Library
*
* @param {Object} options - Options.
*
* @returns {void}
*/
initialize: function initialize( options ) {
@ -79,10 +90,10 @@ wp.mediaWidgets = ( function( $ ) {
/**
* Extended view for managing the embed UI.
*
* @class MediaEmbedView
* @constructor
* @class wp.mediaWidgets.MediaEmbedView
* @augments wp.media.view.Embed
*/
component.MediaEmbedView = wp.media.view.Embed.extend({
component.MediaEmbedView = wp.media.view.Embed.extend(/** @lends wp.mediaWidgets.MediaEmbedView.prototype */{
/**
* Initialize.
@ -109,6 +120,9 @@ wp.mediaWidgets = ( function( $ ) {
* @returns {void}
*/
refresh: function refresh() {
/**
* @class wp.mediaWidgets~Constructor
*/
var Constructor;
if ( 'image' === this.controller.options.mimeType ) {
@ -116,7 +130,7 @@ wp.mediaWidgets = ( function( $ ) {
} else {
// This should be eliminated once #40450 lands of when this is merged into core.
Constructor = wp.media.view.EmbedLink.extend({
Constructor = wp.media.view.EmbedLink.extend(/** @lends wp.mediaWidgets~Constructor.prototype */{
/**
* Set the disabled state on the Add to Widget button.
@ -284,10 +298,10 @@ wp.mediaWidgets = ( function( $ ) {
/**
* Custom media frame for selecting uploaded media or providing media by URL.
*
* @class MediaFrameSelect
* @constructor
* @class wp.mediaWidgets.MediaFrameSelect
* @augments wp.media.view.MediaFrame.Post
*/
component.MediaFrameSelect = wp.media.view.MediaFrame.Post.extend({
component.MediaFrameSelect = wp.media.view.MediaFrame.Post.extend(/** @lends wp.mediaWidgets.MediaFrameSelect.prototype */{
/**
* Create the default states.
@ -357,6 +371,8 @@ wp.mediaWidgets = ( function( $ ) {
/**
* Handle click.
*
* @ignore
*
* @fires wp.media.controller.State#insert()
* @returns {void}
*/
@ -408,14 +424,7 @@ wp.mediaWidgets = ( function( $ ) {
}
});
/**
* Media widget control.
*
* @class MediaWidgetControl
* @constructor
* @abstract
*/
component.MediaWidgetControl = Backbone.View.extend({
component.MediaWidgetControl = Backbone.View.extend(/** @lends wp.mediaWidgets.MediaWidgetControl.prototype */{
/**
* Translation strings.
@ -473,12 +482,17 @@ wp.mediaWidgets = ( function( $ ) {
showDisplaySettings: true,
/**
* Initialize.
* Media Widget Control.
*
* @constructs wp.mediaWidgets.MediaWidgetControl
* @augments Backbone.View
* @abstract
*
* @param {Object} options - Options.
* @param {Backbone.Model} options.model - Model.
* @param {jQuery} options.el - Control field container element.
* @param {jQuery} options.syncContainer - Container element where fields are synced for the server.
*
* @returns {void}
*/
initialize: function initialize( options ) {
@ -961,10 +975,10 @@ wp.mediaWidgets = ( function( $ ) {
/**
* Media widget model.
*
* @class MediaWidgetModel
* @constructor
* @class wp.mediaWidgets.MediaWidgetModel
* @augments Backbone.Model
*/
component.MediaWidgetModel = Backbone.Model.extend({
component.MediaWidgetModel = Backbone.Model.extend(/** @lends wp.mediaWidgets.MediaWidgetModel.prototype */{
/**
* Id attribute.
@ -1085,15 +1099,19 @@ wp.mediaWidgets = ( function( $ ) {
/**
* Collection of all widget model instances.
*
* @memberOf wp.mediaWidgets
*
* @type {Backbone.Collection}
*/
component.modelCollection = new ( Backbone.Collection.extend({
component.modelCollection = new ( Backbone.Collection.extend( {
model: component.MediaWidgetModel
}) )();
/**
* Mapping of widget ID to instances of MediaWidgetControl subclasses.
*
* @memberOf wp.mediaWidgets
*
* @type {Object.<string, wp.mediaWidgets.MediaWidgetControl>}
*/
component.widgetControls = {};
@ -1101,8 +1119,11 @@ wp.mediaWidgets = ( function( $ ) {
/**
* Handle widget being added or initialized for the first time at the widget-added event.
*
* @memberOf wp.mediaWidgets
*
* @param {jQuery.Event} event - Event.
* @param {jQuery} widgetContainer - Widget container element.
*
* @returns {void}
*/
component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
@ -1184,6 +1205,8 @@ wp.mediaWidgets = ( function( $ ) {
/**
* Setup widget in accessibility mode.
*
* @memberOf wp.mediaWidgets
*
* @returns {void}
*/
component.setupAccessibleMode = function setupAccessibleMode() {
@ -1233,8 +1256,11 @@ wp.mediaWidgets = ( function( $ ) {
* the widgets admin screen and also via the 'widget-synced' event when making
* a change to a widget in the customizer.
*
* @memberOf wp.mediaWidgets
*
* @param {jQuery.Event} event - Event.
* @param {jQuery} widgetContainer - Widget container element.
*
* @returns {void}
*/
component.handleWidgetUpdated = function handleWidgetUpdated( event, widgetContainer ) {
@ -1267,6 +1293,8 @@ wp.mediaWidgets = ( function( $ ) {
* When WordPress enqueues this script, it should have an inline script
* attached which calls wp.mediaWidgets.init().
*
* @memberOf wp.mediaWidgets
*
* @returns {void}
*/
component.init = function init() {

View file

@ -1,5 +1,13 @@
/**
* @output wp-admin/js/widgets/text-widgets.js
*/
/* global tinymce, switchEditors */
/* eslint consistent-this: [ "error", "control" ] */
/**
* @namespace wp.textWidgets
*/
wp.textWidgets = ( function( $ ) {
'use strict';
@ -8,14 +16,7 @@ wp.textWidgets = ( function( $ ) {
idBases: [ 'text' ]
};
/**
* Text widget control.
*
* @class TextWidgetControl
* @constructor
* @abstract
*/
component.TextWidgetControl = Backbone.View.extend({
component.TextWidgetControl = Backbone.View.extend(/** @lends wp.textWidgets.TextWidgetControl.prototype */{
/**
* View events.
@ -25,11 +26,16 @@ wp.textWidgets = ( function( $ ) {
events: {},
/**
* Initialize.
* Text widget control.
*
* @constructs wp.textWidgets.TextWidgetControl
* @augments Backbone.View
* @abstract
*
* @param {Object} options - Options.
* @param {jQuery} options.el - Control field container element.
* @param {jQuery} options.syncContainer - Container element where fields are synced for the server.
*
* @returns {void}
*/
initialize: function initialize( options ) {
@ -357,6 +363,8 @@ wp.textWidgets = ( function( $ ) {
/**
* Mapping of widget ID to instances of TextWidgetControl subclasses.
*
* @memberOf wp.textWidgets
*
* @type {Object.<string, wp.textWidgets.TextWidgetControl>}
*/
component.widgetControls = {};
@ -364,8 +372,11 @@ wp.textWidgets = ( function( $ ) {
/**
* Handle widget being added or initialized for the first time at the widget-added event.
*
* @memberOf wp.textWidgets
*
* @param {jQuery.Event} event - Event.
* @param {jQuery} widgetContainer - Widget container element.
*
* @returns {void}
*/
component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
@ -429,6 +440,8 @@ wp.textWidgets = ( function( $ ) {
/**
* Setup widget in accessibility mode.
*
* @memberOf wp.textWidgets
*
* @returns {void}
*/
component.setupAccessibleMode = function setupAccessibleMode() {
@ -467,6 +480,8 @@ wp.textWidgets = ( function( $ ) {
* the widgets admin screen and also via the 'widget-synced' event when making
* a change to a widget in the customizer.
*
* @memberOf wp.textWidgets
*
* @param {jQuery.Event} event - Event.
* @param {jQuery} widgetContainer - Widget container element.
* @returns {void}
@ -496,6 +511,8 @@ wp.textWidgets = ( function( $ ) {
* When WordPress enqueues this script, it should have an inline script
* attached which calls wp.textWidgets.init().
*
* @memberOf wp.textWidgets
*
* @returns {void}
*/
component.init = function init() {