mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-12 11:21:13 +01:00
REST API: Prevent duplicate firing of rest(_after)?_insert_attachment
actions.
Props danielbachhuber, peterwilsoncc. Fixes #45269. See #42864. Built from https://develop.svn.wordpress.org/branches/5.0@43862 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
325cb107d1
commit
56842f36aa
175
wp-includes/js/dist/api-fetch.js
vendored
175
wp-includes/js/dist/api-fetch.js
vendored
@ -264,19 +264,17 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js");
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js");
|
||||||
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js");
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js");
|
||||||
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js");
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
||||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
/* harmony import */ var _middlewares_nonce__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./middlewares/nonce */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/nonce.js");
|
||||||
/* harmony import */ var _middlewares_nonce__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares/nonce */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/nonce.js");
|
/* harmony import */ var _middlewares_root_url__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./middlewares/root-url */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js");
|
||||||
/* harmony import */ var _middlewares_root_url__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./middlewares/root-url */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js");
|
/* harmony import */ var _middlewares_preloading__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./middlewares/preloading */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/preloading.js");
|
||||||
/* harmony import */ var _middlewares_preloading__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./middlewares/preloading */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/preloading.js");
|
/* harmony import */ var _middlewares_fetch_all_middleware__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./middlewares/fetch-all-middleware */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/fetch-all-middleware.js");
|
||||||
/* harmony import */ var _middlewares_fetch_all_middleware__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./middlewares/fetch-all-middleware */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/fetch-all-middleware.js");
|
/* harmony import */ var _middlewares_namespace_endpoint__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./middlewares/namespace-endpoint */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js");
|
||||||
/* harmony import */ var _middlewares_namespace_endpoint__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./middlewares/namespace-endpoint */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js");
|
/* harmony import */ var _middlewares_http_v1__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./middlewares/http-v1 */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/http-v1.js");
|
||||||
/* harmony import */ var _middlewares_http_v1__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./middlewares/http-v1 */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/http-v1.js");
|
/* harmony import */ var _middlewares_user_locale__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./middlewares/user-locale */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/user-locale.js");
|
||||||
/* harmony import */ var _middlewares_user_locale__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./middlewares/user-locale */ "./node_modules/@wordpress/api-fetch/build-module/middlewares/user-locale.js");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -295,39 +293,57 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default set of header values which should be sent with every request unless
|
||||||
|
* explicitly provided through apiFetch options.
|
||||||
|
*
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
|
||||||
|
var DEFAULT_HEADERS = {
|
||||||
|
// The backend uses the Accept header as a condition for considering an
|
||||||
|
// incoming request as a REST request.
|
||||||
|
//
|
||||||
|
// See: https://core.trac.wordpress.org/ticket/44534
|
||||||
|
Accept: 'application/json, */*;q=0.1'
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Default set of fetch option values which should be sent with every request
|
||||||
|
* unless explicitly provided through apiFetch options.
|
||||||
|
*
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
|
||||||
|
var DEFAULT_OPTIONS = {
|
||||||
|
credentials: 'include'
|
||||||
|
};
|
||||||
var middlewares = [];
|
var middlewares = [];
|
||||||
|
|
||||||
function registerMiddleware(middleware) {
|
function registerMiddleware(middleware) {
|
||||||
middlewares.push(middleware);
|
middlewares.push(middleware);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkCloudflareError(error) {
|
|
||||||
if (typeof error === 'string' && error.indexOf('Cloudflare Ray ID') >= 0) {
|
|
||||||
throw {
|
|
||||||
code: 'cloudflare_error'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function apiFetch(options) {
|
function apiFetch(options) {
|
||||||
var raw = function raw(nextOptions) {
|
var raw = function raw(nextOptions) {
|
||||||
var url = nextOptions.url,
|
var url = nextOptions.url,
|
||||||
path = nextOptions.path,
|
path = nextOptions.path,
|
||||||
body = nextOptions.body,
|
|
||||||
data = nextOptions.data,
|
data = nextOptions.data,
|
||||||
_nextOptions$parse = nextOptions.parse,
|
_nextOptions$parse = nextOptions.parse,
|
||||||
parse = _nextOptions$parse === void 0 ? true : _nextOptions$parse,
|
parse = _nextOptions$parse === void 0 ? true : _nextOptions$parse,
|
||||||
remainingOptions = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__["default"])(nextOptions, ["url", "path", "body", "data", "parse"]);
|
remainingOptions = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__["default"])(nextOptions, ["url", "path", "data", "parse"]);
|
||||||
|
|
||||||
var headers = remainingOptions.headers || {};
|
var body = nextOptions.body,
|
||||||
|
headers = nextOptions.headers; // Merge explicitly-provided headers with default values.
|
||||||
|
|
||||||
if (!headers['Content-Type'] && data) {
|
headers = Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, DEFAULT_HEADERS, headers); // The `data` property is a shorthand for sending a JSON body.
|
||||||
|
|
||||||
|
if (data) {
|
||||||
|
body = JSON.stringify(data);
|
||||||
headers['Content-Type'] = 'application/json';
|
headers['Content-Type'] = 'application/json';
|
||||||
}
|
}
|
||||||
|
|
||||||
var responsePromise = window.fetch(url || path, Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_1__["default"])({}, remainingOptions, {
|
var responsePromise = window.fetch(url || path, Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, DEFAULT_OPTIONS, remainingOptions, {
|
||||||
credentials: 'include',
|
body: body,
|
||||||
body: body || JSON.stringify(data),
|
|
||||||
headers: headers
|
headers: headers
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -358,57 +374,26 @@ function apiFetch(options) {
|
|||||||
|
|
||||||
var invalidJsonError = {
|
var invalidJsonError = {
|
||||||
code: 'invalid_json',
|
code: 'invalid_json',
|
||||||
message: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('The response is not a valid JSON response.')
|
message: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('The response is not a valid JSON response.')
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!response || !response.json) {
|
if (!response || !response.json) {
|
||||||
throw invalidJsonError;
|
throw invalidJsonError;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Response data is a stream, which will be consumed by the .json() call.
|
|
||||||
* If we need to re-use this data to send to the Cloudflare error handler,
|
|
||||||
* we need a clone of the original response, so the stream can be consumed
|
|
||||||
* in the .text() call, instead.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
return response.json().catch(function () {
|
||||||
var responseClone = response.clone();
|
|
||||||
return response.json().catch(
|
|
||||||
/*#__PURE__*/
|
|
||||||
Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__["default"])(
|
|
||||||
/*#__PURE__*/
|
|
||||||
regeneratorRuntime.mark(function _callee() {
|
|
||||||
var text;
|
|
||||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
||||||
while (1) {
|
|
||||||
switch (_context.prev = _context.next) {
|
|
||||||
case 0:
|
|
||||||
_context.next = 2;
|
|
||||||
return responseClone.text();
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
text = _context.sent;
|
|
||||||
checkCloudflareError(text);
|
|
||||||
throw invalidJsonError;
|
throw invalidJsonError;
|
||||||
|
}).then(function (error) {
|
||||||
case 5:
|
|
||||||
case "end":
|
|
||||||
return _context.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, _callee, this);
|
|
||||||
}))).then(function (error) {
|
|
||||||
var unknownError = {
|
var unknownError = {
|
||||||
code: 'unknown_error',
|
code: 'unknown_error',
|
||||||
message: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('An unknown error occurred.')
|
message: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('An unknown error occurred.')
|
||||||
};
|
};
|
||||||
checkCloudflareError(error);
|
|
||||||
throw error || unknownError;
|
throw error || unknownError;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var steps = [raw, _middlewares_fetch_all_middleware__WEBPACK_IMPORTED_MODULE_7__["default"], _middlewares_http_v1__WEBPACK_IMPORTED_MODULE_9__["default"], _middlewares_namespace_endpoint__WEBPACK_IMPORTED_MODULE_8__["default"], _middlewares_user_locale__WEBPACK_IMPORTED_MODULE_10__["default"]].concat(middlewares).reverse();
|
var steps = [raw, _middlewares_fetch_all_middleware__WEBPACK_IMPORTED_MODULE_6__["default"], _middlewares_http_v1__WEBPACK_IMPORTED_MODULE_8__["default"], _middlewares_namespace_endpoint__WEBPACK_IMPORTED_MODULE_7__["default"], _middlewares_user_locale__WEBPACK_IMPORTED_MODULE_9__["default"]].concat(middlewares).reverse();
|
||||||
|
|
||||||
var runMiddleware = function runMiddleware(index) {
|
var runMiddleware = function runMiddleware(index) {
|
||||||
return function (nextOptions) {
|
return function (nextOptions) {
|
||||||
@ -422,10 +407,10 @@ function apiFetch(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apiFetch.use = registerMiddleware;
|
apiFetch.use = registerMiddleware;
|
||||||
apiFetch.createNonceMiddleware = _middlewares_nonce__WEBPACK_IMPORTED_MODULE_4__["default"];
|
apiFetch.createNonceMiddleware = _middlewares_nonce__WEBPACK_IMPORTED_MODULE_3__["default"];
|
||||||
apiFetch.createPreloadingMiddleware = _middlewares_preloading__WEBPACK_IMPORTED_MODULE_6__["default"];
|
apiFetch.createPreloadingMiddleware = _middlewares_preloading__WEBPACK_IMPORTED_MODULE_5__["default"];
|
||||||
apiFetch.createRootURLMiddleware = _middlewares_root_url__WEBPACK_IMPORTED_MODULE_5__["default"];
|
apiFetch.createRootURLMiddleware = _middlewares_root_url__WEBPACK_IMPORTED_MODULE_4__["default"];
|
||||||
apiFetch.fetchAllMiddleware = _middlewares_fetch_all_middleware__WEBPACK_IMPORTED_MODULE_7__["default"];
|
apiFetch.fetchAllMiddleware = _middlewares_fetch_all_middleware__WEBPACK_IMPORTED_MODULE_6__["default"];
|
||||||
/* harmony default export */ __webpack_exports__["default"] = (apiFetch);
|
/* harmony default export */ __webpack_exports__["default"] = (apiFetch);
|
||||||
|
|
||||||
|
|
||||||
@ -621,22 +606,50 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js");
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set of HTTP methods which are eligible to be overridden.
|
||||||
|
*
|
||||||
|
* @type {Set}
|
||||||
|
*/
|
||||||
|
var OVERRIDE_METHODS = new Set(['PATCH', 'PUT', 'DELETE']);
|
||||||
|
/**
|
||||||
|
* Default request method.
|
||||||
|
*
|
||||||
|
* "A request has an associated method (a method). Unless stated otherwise it
|
||||||
|
* is `GET`."
|
||||||
|
*
|
||||||
|
* @see https://fetch.spec.whatwg.org/#requests
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
|
||||||
|
var DEFAULT_METHOD = 'GET';
|
||||||
|
/**
|
||||||
|
* API Fetch middleware which overrides the request method for HTTP v1
|
||||||
|
* compatibility leveraging the REST API X-HTTP-Method-Override header.
|
||||||
|
*
|
||||||
|
* @param {Object} options Fetch options.
|
||||||
|
* @param {Function} next [description]
|
||||||
|
*
|
||||||
|
* @return {*} The evaluated result of the remaining middleware chain.
|
||||||
|
*/
|
||||||
|
|
||||||
function httpV1Middleware(options, next) {
|
function httpV1Middleware(options, next) {
|
||||||
var newOptions = Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, options);
|
var _options = options,
|
||||||
|
_options$method = _options.method,
|
||||||
|
method = _options$method === void 0 ? DEFAULT_METHOD : _options$method;
|
||||||
|
|
||||||
if (newOptions.method) {
|
if (OVERRIDE_METHODS.has(method.toUpperCase())) {
|
||||||
if (['PATCH', 'PUT', 'DELETE'].indexOf(newOptions.method.toUpperCase()) >= 0) {
|
options = Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, options, {
|
||||||
if (!newOptions.headers) {
|
headers: Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, options.headers, {
|
||||||
newOptions.headers = {};
|
'X-HTTP-Method-Override': method,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}),
|
||||||
|
method: 'POST'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
newOptions.headers['X-HTTP-Method-Override'] = newOptions.method;
|
return next(options, next);
|
||||||
newOptions.headers['Content-Type'] = 'application/json';
|
|
||||||
newOptions.method = 'POST';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return next(newOptions, next);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* harmony default export */ __webpack_exports__["default"] = (httpV1Middleware);
|
/* harmony default export */ __webpack_exports__["default"] = (httpV1Middleware);
|
||||||
@ -703,7 +716,6 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
|
|
||||||
var createNonceMiddleware = function createNonceMiddleware(nonce) {
|
var createNonceMiddleware = function createNonceMiddleware(nonce) {
|
||||||
return function (options, next) {
|
|
||||||
var usedNonce = nonce;
|
var usedNonce = nonce;
|
||||||
/**
|
/**
|
||||||
* This is not ideal but it's fine for now.
|
* This is not ideal but it's fine for now.
|
||||||
@ -717,6 +729,7 @@ var createNonceMiddleware = function createNonceMiddleware(nonce) {
|
|||||||
usedNonce = response['rest-nonce'];
|
usedNonce = response['rest-nonce'];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return function (options, next) {
|
||||||
var headers = options.headers || {}; // If an 'X-WP-Nonce' header (or any case-insensitive variation
|
var headers = options.headers || {}; // If an 'X-WP-Nonce' header (or any case-insensitive variation
|
||||||
// thereof) was specified, no need to add a nonce header.
|
// thereof) was specified, no need to add a nonce header.
|
||||||
|
|
||||||
|
2
wp-includes/js/dist/api-fetch.js.map
vendored
2
wp-includes/js/dist/api-fetch.js.map
vendored
File diff suppressed because one or more lines are too long
868
wp-includes/js/dist/block-library.js
vendored
868
wp-includes/js/dist/block-library.js
vendored
File diff suppressed because it is too large
Load Diff
2
wp-includes/js/dist/block-library.js.map
vendored
2
wp-includes/js/dist/block-library.js.map
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
50
wp-includes/js/dist/blocks.js
vendored
50
wp-includes/js/dist/blocks.js
vendored
@ -5514,8 +5514,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
*/
|
*/
|
||||||
function getPath(object, path) {
|
function getPath(object, path) {
|
||||||
var segments = path.split('.');
|
var segments = path.split('.');
|
||||||
|
var segment;
|
||||||
|
|
||||||
var segment = void 0;
|
|
||||||
while (segment = segments.shift()) {
|
while (segment = segments.shift()) {
|
||||||
if (!(segment in object)) {
|
if (!(segment in object)) {
|
||||||
return;
|
return;
|
||||||
@ -5549,7 +5549,23 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function returning a DOM document created by `createHTMLDocument`. The same
|
||||||
|
* document is returned between invocations.
|
||||||
|
*
|
||||||
|
* @return {Document} DOM document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var getDocument = function () {
|
||||||
|
var doc;
|
||||||
|
return function () {
|
||||||
|
if (!doc) {
|
||||||
|
doc = document.implementation.createHTMLDocument('');
|
||||||
|
}
|
||||||
|
|
||||||
|
return doc;
|
||||||
|
};
|
||||||
|
}();
|
||||||
/**
|
/**
|
||||||
* Given a markup string or DOM element, creates an object aligning with the
|
* Given a markup string or DOM element, creates an object aligning with the
|
||||||
* shape of the matchers object, or the value returned by the matcher.
|
* shape of the matchers object, or the value returned by the matcher.
|
||||||
@ -5558,35 +5574,36 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
* @param {(Object|Function)} matchers Matcher function or object of matchers
|
* @param {(Object|Function)} matchers Matcher function or object of matchers
|
||||||
* @return {(Object|*)} Matched value(s), shaped by object
|
* @return {(Object|*)} Matched value(s), shaped by object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function parse(source, matchers) {
|
function parse(source, matchers) {
|
||||||
if (!matchers) {
|
if (!matchers) {
|
||||||
return;
|
return;
|
||||||
}
|
} // Coerce to element
|
||||||
|
|
||||||
|
|
||||||
// Coerce to element
|
|
||||||
if ('string' === typeof source) {
|
if ('string' === typeof source) {
|
||||||
var doc = document.implementation.createHTMLDocument('');
|
var doc = getDocument();
|
||||||
doc.body.innerHTML = source;
|
doc.body.innerHTML = source;
|
||||||
source = doc.body;
|
source = doc.body;
|
||||||
}
|
} // Return singular value
|
||||||
|
|
||||||
|
|
||||||
// Return singular value
|
|
||||||
if ('function' === typeof matchers) {
|
if ('function' === typeof matchers) {
|
||||||
return matchers(source);
|
return matchers(source);
|
||||||
}
|
} // Bail if we can't handle matchers
|
||||||
|
|
||||||
|
|
||||||
// Bail if we can't handle matchers
|
|
||||||
if (Object !== matchers.constructor) {
|
if (Object !== matchers.constructor) {
|
||||||
return;
|
return;
|
||||||
}
|
} // Shape result by matcher object
|
||||||
|
|
||||||
|
|
||||||
// Shape result by matcher object
|
|
||||||
return Object.keys(matchers).reduce(function (memo, key) {
|
return Object.keys(matchers).reduce(function (memo, key) {
|
||||||
memo[key] = parse(source, matchers[key]);
|
memo[key] = parse(source, matchers[key]);
|
||||||
return memo;
|
return memo;
|
||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a function which matches node of type selector, returning an
|
* Generates a function which matches node of type selector, returning an
|
||||||
* attribute by property if the attribute exists. If no selector is passed,
|
* attribute by property if the attribute exists. If no selector is passed,
|
||||||
@ -5596,6 +5613,7 @@ function parse(source, matchers) {
|
|||||||
* @param {string} name Property name
|
* @param {string} name Property name
|
||||||
* @return {*} Property value
|
* @return {*} Property value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prop(selector, name) {
|
function prop(selector, name) {
|
||||||
if (1 === arguments.length) {
|
if (1 === arguments.length) {
|
||||||
name = selector;
|
name = selector;
|
||||||
@ -5604,6 +5622,7 @@ function prop(selector, name) {
|
|||||||
|
|
||||||
return function (node) {
|
return function (node) {
|
||||||
var match = node;
|
var match = node;
|
||||||
|
|
||||||
if (selector) {
|
if (selector) {
|
||||||
match = node.querySelector(selector);
|
match = node.querySelector(selector);
|
||||||
}
|
}
|
||||||
@ -5613,7 +5632,6 @@ function prop(selector, name) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a function which matches node of type selector, returning an
|
* Generates a function which matches node of type selector, returning an
|
||||||
* attribute by name if the attribute exists. If no selector is passed,
|
* attribute by name if the attribute exists. If no selector is passed,
|
||||||
@ -5623,6 +5641,7 @@ function prop(selector, name) {
|
|||||||
* @param {string} name Attribute name
|
* @param {string} name Attribute name
|
||||||
* @return {?string} Attribute value
|
* @return {?string} Attribute value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function attr(selector, name) {
|
function attr(selector, name) {
|
||||||
if (1 === arguments.length) {
|
if (1 === arguments.length) {
|
||||||
name = selector;
|
name = selector;
|
||||||
@ -5631,12 +5650,12 @@ function attr(selector, name) {
|
|||||||
|
|
||||||
return function (node) {
|
return function (node) {
|
||||||
var attributes = prop(selector, 'attributes')(node);
|
var attributes = prop(selector, 'attributes')(node);
|
||||||
|
|
||||||
if (attributes && attributes.hasOwnProperty(name)) {
|
if (attributes && attributes.hasOwnProperty(name)) {
|
||||||
return attributes[name].value;
|
return attributes[name].value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience for `prop( selector, 'innerHTML' )`.
|
* Convenience for `prop( selector, 'innerHTML' )`.
|
||||||
*
|
*
|
||||||
@ -5645,10 +5664,10 @@ function attr(selector, name) {
|
|||||||
* @param {?string} selector Optional selector
|
* @param {?string} selector Optional selector
|
||||||
* @return {string} Inner HTML
|
* @return {string} Inner HTML
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function html(selector) {
|
function html(selector) {
|
||||||
return prop(selector, 'innerHTML');
|
return prop(selector, 'innerHTML');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience for `prop( selector, 'textContent' )`.
|
* Convenience for `prop( selector, 'textContent' )`.
|
||||||
*
|
*
|
||||||
@ -5657,10 +5676,10 @@ function html(selector) {
|
|||||||
* @param {?string} selector Optional selector
|
* @param {?string} selector Optional selector
|
||||||
* @return {string} Text content
|
* @return {string} Text content
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function text(selector) {
|
function text(selector) {
|
||||||
return prop(selector, 'textContent');
|
return prop(selector, 'textContent');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new matching context by first finding elements matching selector
|
* Creates a new matching context by first finding elements matching selector
|
||||||
* using querySelectorAll before then running another `parse` on `matchers`
|
* using querySelectorAll before then running another `parse` on `matchers`
|
||||||
@ -5672,6 +5691,7 @@ function text(selector) {
|
|||||||
* @param {(Object|Function)} matchers Matcher function or object of matchers
|
* @param {(Object|Function)} matchers Matcher function or object of matchers
|
||||||
* @return {Array.<*,Object>} Array of matched value(s)
|
* @return {Array.<*,Object>} Array of matched value(s)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function query(selector, matchers) {
|
function query(selector, matchers) {
|
||||||
return function (node) {
|
return function (node) {
|
||||||
var matches = node.querySelectorAll(selector);
|
var matches = node.querySelectorAll(selector);
|
||||||
|
2
wp-includes/js/dist/blocks.js.map
vendored
2
wp-includes/js/dist/blocks.js.map
vendored
File diff suppressed because one or more lines are too long
845
wp-includes/js/dist/components.js
vendored
845
wp-includes/js/dist/components.js
vendored
File diff suppressed because it is too large
Load Diff
2
wp-includes/js/dist/components.js.map
vendored
2
wp-includes/js/dist/components.js.map
vendored
File diff suppressed because one or more lines are too long
2
wp-includes/js/dist/core-data.js.map
vendored
2
wp-includes/js/dist/core-data.js.map
vendored
File diff suppressed because one or more lines are too long
851
wp-includes/js/dist/data.js
vendored
851
wp-includes/js/dist/data.js
vendored
@ -973,7 +973,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/*!************************************************************!*\
|
/*!************************************************************!*\
|
||||||
!*** ./node_modules/@wordpress/data/build-module/index.js ***!
|
!*** ./node_modules/@wordpress/data/build-module/index.js ***!
|
||||||
\************************************************************/
|
\************************************************************/
|
||||||
/*! exports provided: withSelect, withDispatch, RegistryProvider, RegistryConsumer, createRegistry, plugins, combineReducers, select, dispatch, subscribe, registerStore, registerReducer, registerActions, registerSelectors, registerResolvers, use */
|
/*! exports provided: withSelect, withDispatch, RegistryProvider, RegistryConsumer, createRegistry, plugins, combineReducers, select, dispatch, subscribe, registerGenericStore, registerStore, registerReducer, registerActions, registerSelectors, registerResolvers, use */
|
||||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -981,6 +981,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return select; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return select; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dispatch", function() { return dispatch; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dispatch", function() { return dispatch; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribe", function() { return subscribe; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribe", function() { return subscribe; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerGenericStore", function() { return registerGenericStore; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerStore", function() { return registerStore; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerStore", function() { return registerStore; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerReducer", function() { return registerReducer; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerReducer", function() { return registerReducer; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerActions", function() { return registerActions; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerActions", function() { return registerActions; });
|
||||||
@ -1037,6 +1038,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
var select = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].select;
|
var select = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].select;
|
||||||
var dispatch = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].dispatch;
|
var dispatch = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].dispatch;
|
||||||
var subscribe = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].subscribe;
|
var subscribe = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].subscribe;
|
||||||
|
var registerGenericStore = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].registerGenericStore;
|
||||||
var registerStore = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].registerStore;
|
var registerStore = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].registerStore;
|
||||||
var registerReducer = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].registerReducer;
|
var registerReducer = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].registerReducer;
|
||||||
var registerActions = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].registerActions;
|
var registerActions = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].registerActions;
|
||||||
@ -1045,6 +1047,394 @@ var registerResolvers = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"
|
|||||||
var use = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].use;
|
var use = _default_registry__WEBPACK_IMPORTED_MODULE_1__["default"].use;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./node_modules/@wordpress/data/build-module/namespace-store.js":
|
||||||
|
/*!**********************************************************************!*\
|
||||||
|
!*** ./node_modules/@wordpress/data/build-module/namespace-store.js ***!
|
||||||
|
\**********************************************************************/
|
||||||
|
/*! exports provided: default */
|
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return createNamespace; });
|
||||||
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js");
|
||||||
|
/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js");
|
||||||
|
/* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js");
|
||||||
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! lodash */ "lodash");
|
||||||
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var _promise_middleware__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./promise-middleware */ "./node_modules/@wordpress/data/build-module/promise-middleware.js");
|
||||||
|
/* harmony import */ var _resolvers_cache_middleware__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./resolvers-cache-middleware */ "./node_modules/@wordpress/data/build-module/resolvers-cache-middleware.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a namespace object with a store derived from the reducer given.
|
||||||
|
*
|
||||||
|
* @param {string} key Identifying string used for namespace and redex dev tools.
|
||||||
|
* @param {Object} options Contains reducer, actions, selectors, and resolvers.
|
||||||
|
* @param {Object} registry Temporary registry reference, required for namespace updates.
|
||||||
|
*
|
||||||
|
* @return {Object} Store Object.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createNamespace(key, options, registry) {
|
||||||
|
// TODO: After register[Reducer|Actions|Selectors|Resolvers] are deprecated and removed,
|
||||||
|
// this function can be greatly simplified because it should no longer be called to modify
|
||||||
|
// a namespace, but only to create one, and only once for each namespace.
|
||||||
|
// TODO: After removing `registry.namespaces`and making stores immutable after create,
|
||||||
|
// reducer, store, actinos, selectors, and resolvers can all be removed from here.
|
||||||
|
var _ref = registry.namespaces[key] || {},
|
||||||
|
reducer = _ref.reducer,
|
||||||
|
store = _ref.store,
|
||||||
|
actions = _ref.actions,
|
||||||
|
selectors = _ref.selectors,
|
||||||
|
resolvers = _ref.resolvers;
|
||||||
|
|
||||||
|
if (options.reducer) {
|
||||||
|
reducer = options.reducer;
|
||||||
|
store = createReduxStore(reducer, key, registry);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.actions) {
|
||||||
|
if (!store) {
|
||||||
|
throw new TypeError('Cannot specify actions when no reducer is present');
|
||||||
|
}
|
||||||
|
|
||||||
|
actions = mapActions(options.actions, store);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.selectors) {
|
||||||
|
if (!store) {
|
||||||
|
throw new TypeError('Cannot specify selectors when no reducer is present');
|
||||||
|
}
|
||||||
|
|
||||||
|
selectors = mapSelectors(options.selectors, store);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.resolvers) {
|
||||||
|
var fulfillment = getCoreDataFulfillment(registry, key);
|
||||||
|
var result = mapResolvers(options.resolvers, selectors, fulfillment, store);
|
||||||
|
resolvers = result.resolvers;
|
||||||
|
selectors = result.selectors;
|
||||||
|
}
|
||||||
|
|
||||||
|
var getSelectors = function getSelectors() {
|
||||||
|
return selectors;
|
||||||
|
};
|
||||||
|
|
||||||
|
var getActions = function getActions() {
|
||||||
|
return actions;
|
||||||
|
}; // Customize subscribe behavior to call listeners only on effective change,
|
||||||
|
// not on every dispatch.
|
||||||
|
|
||||||
|
|
||||||
|
var subscribe = store && function (listener) {
|
||||||
|
var lastState = store.getState();
|
||||||
|
store.subscribe(function () {
|
||||||
|
var state = store.getState();
|
||||||
|
var hasChanged = state !== lastState;
|
||||||
|
lastState = state;
|
||||||
|
|
||||||
|
if (hasChanged) {
|
||||||
|
listener();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
reducer: reducer,
|
||||||
|
store: store,
|
||||||
|
actions: actions,
|
||||||
|
selectors: selectors,
|
||||||
|
resolvers: resolvers,
|
||||||
|
getSelectors: getSelectors,
|
||||||
|
getActions: getActions,
|
||||||
|
subscribe: subscribe
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Creates a redux store for a namespace.
|
||||||
|
*
|
||||||
|
* @param {Function} reducer Root reducer for redux store.
|
||||||
|
* @param {string} key Part of the state shape to register the
|
||||||
|
* selectors for.
|
||||||
|
* @param {Object} registry Registry reference, for resolver enhancer support.
|
||||||
|
* @return {Object} Newly created redux store.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function createReduxStore(reducer, key, registry) {
|
||||||
|
var enhancers = [Object(redux__WEBPACK_IMPORTED_MODULE_2__["applyMiddleware"])(Object(_resolvers_cache_middleware__WEBPACK_IMPORTED_MODULE_5__["default"])(registry, key), _promise_middleware__WEBPACK_IMPORTED_MODULE_4__["default"])];
|
||||||
|
|
||||||
|
if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
|
||||||
|
enhancers.push(window.__REDUX_DEVTOOLS_EXTENSION__({
|
||||||
|
name: key,
|
||||||
|
instanceId: key
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object(redux__WEBPACK_IMPORTED_MODULE_2__["createStore"])(reducer, Object(lodash__WEBPACK_IMPORTED_MODULE_3__["flowRight"])(enhancers));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Maps selectors to a redux store.
|
||||||
|
*
|
||||||
|
* @param {Object} selectors Selectors to register. Keys will be used as the
|
||||||
|
* public facing API. Selectors will get passed the
|
||||||
|
* state as first argument.
|
||||||
|
* @param {Object} store The redux store to which the selectors should be mapped.
|
||||||
|
* @return {Object} Selectors mapped to the redux store provided.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function mapSelectors(selectors, store) {
|
||||||
|
var createStateSelector = function createStateSelector(selector) {
|
||||||
|
return function () {
|
||||||
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||||
|
args[_key] = arguments[_key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return selector.apply(void 0, [store.getState()].concat(args));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return Object(lodash__WEBPACK_IMPORTED_MODULE_3__["mapValues"])(selectors, createStateSelector);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Maps actions to dispatch from a given store.
|
||||||
|
*
|
||||||
|
* @param {Object} actions Actions to register.
|
||||||
|
* @param {Object} store The redux store to which the actions should be mapped.
|
||||||
|
* @return {Object} Actions mapped to the redux store provided.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function mapActions(actions, store) {
|
||||||
|
var createBoundAction = function createBoundAction(action) {
|
||||||
|
return function () {
|
||||||
|
return store.dispatch(action.apply(void 0, arguments));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
return Object(lodash__WEBPACK_IMPORTED_MODULE_3__["mapValues"])(actions, createBoundAction);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns resolvers with matched selectors for a given namespace.
|
||||||
|
* Resolvers are side effects invoked once per argument set of a given selector call,
|
||||||
|
* used in ensuring that the data needs for the selector are satisfied.
|
||||||
|
*
|
||||||
|
* @param {Object} resolvers Resolvers to register.
|
||||||
|
* @param {Object} selectors The current selectors to be modified.
|
||||||
|
* @param {Object} fulfillment Fulfillment implementation functions.
|
||||||
|
* @param {Object} store The redux store to which the resolvers should be mapped.
|
||||||
|
* @return {Object} An object containing updated selectors and resolvers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function mapResolvers(resolvers, selectors, fulfillment, store) {
|
||||||
|
var mapSelector = function mapSelector(selector, selectorName) {
|
||||||
|
var resolver = resolvers[selectorName];
|
||||||
|
|
||||||
|
if (!resolver) {
|
||||||
|
return selector;
|
||||||
|
}
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||||
|
args[_key2] = arguments[_key2];
|
||||||
|
}
|
||||||
|
|
||||||
|
function fulfillSelector() {
|
||||||
|
return _fulfillSelector.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _fulfillSelector() {
|
||||||
|
_fulfillSelector = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__["default"])(
|
||||||
|
/*#__PURE__*/
|
||||||
|
regeneratorRuntime.mark(function _callee() {
|
||||||
|
var state;
|
||||||
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
||||||
|
while (1) {
|
||||||
|
switch (_context.prev = _context.next) {
|
||||||
|
case 0:
|
||||||
|
state = store.getState();
|
||||||
|
|
||||||
|
if (!(typeof resolver.isFulfilled === 'function' && resolver.isFulfilled.apply(resolver, [state].concat(args)))) {
|
||||||
|
_context.next = 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _context.abrupt("return");
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
if (!fulfillment.hasStarted(selectorName, args)) {
|
||||||
|
_context.next = 5;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _context.abrupt("return");
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
fulfillment.start(selectorName, args);
|
||||||
|
_context.next = 8;
|
||||||
|
return fulfillment.fulfill.apply(fulfillment, [selectorName].concat(args));
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
fulfillment.finish(selectorName, args);
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
case "end":
|
||||||
|
return _context.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, _callee, this);
|
||||||
|
}));
|
||||||
|
return _fulfillSelector.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
fulfillSelector.apply(void 0, args);
|
||||||
|
return selector.apply(void 0, args);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var mappedResolvers = Object(lodash__WEBPACK_IMPORTED_MODULE_3__["mapValues"])(resolvers, function (resolver) {
|
||||||
|
var _resolver$fulfill = resolver.fulfill,
|
||||||
|
resolverFulfill = _resolver$fulfill === void 0 ? resolver : _resolver$fulfill;
|
||||||
|
return Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({}, resolver, {
|
||||||
|
fulfill: resolverFulfill
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
resolvers: mappedResolvers,
|
||||||
|
selectors: Object(lodash__WEBPACK_IMPORTED_MODULE_3__["mapValues"])(selectors, mapSelector)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Bundles up fulfillment functions for resolvers.
|
||||||
|
* @param {Object} registry Registry reference, for fulfilling via resolvers
|
||||||
|
* @param {string} key Part of the state shape to register the
|
||||||
|
* selectors for.
|
||||||
|
* @return {Object} An object providing fulfillment functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function getCoreDataFulfillment(registry, key) {
|
||||||
|
var _registry$select = registry.select('core/data'),
|
||||||
|
hasStartedResolution = _registry$select.hasStartedResolution;
|
||||||
|
|
||||||
|
var _registry$dispatch = registry.dispatch('core/data'),
|
||||||
|
startResolution = _registry$dispatch.startResolution,
|
||||||
|
finishResolution = _registry$dispatch.finishResolution;
|
||||||
|
|
||||||
|
return {
|
||||||
|
hasStarted: function hasStarted() {
|
||||||
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
||||||
|
args[_key3] = arguments[_key3];
|
||||||
|
}
|
||||||
|
|
||||||
|
return hasStartedResolution.apply(void 0, [key].concat(args));
|
||||||
|
},
|
||||||
|
start: function start() {
|
||||||
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
||||||
|
args[_key4] = arguments[_key4];
|
||||||
|
}
|
||||||
|
|
||||||
|
return startResolution.apply(void 0, [key].concat(args));
|
||||||
|
},
|
||||||
|
finish: function finish() {
|
||||||
|
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
||||||
|
args[_key5] = arguments[_key5];
|
||||||
|
}
|
||||||
|
|
||||||
|
return finishResolution.apply(void 0, [key].concat(args));
|
||||||
|
},
|
||||||
|
fulfill: function fulfill() {
|
||||||
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
||||||
|
args[_key6] = arguments[_key6];
|
||||||
|
}
|
||||||
|
|
||||||
|
return fulfillWithRegistry.apply(void 0, [registry, key].concat(args));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Calls a resolver given arguments
|
||||||
|
*
|
||||||
|
* @param {Object} registry Registry reference, for fulfilling via resolvers
|
||||||
|
* @param {string} key Part of the state shape to register the
|
||||||
|
* selectors for.
|
||||||
|
* @param {string} selectorName Selector name to fulfill.
|
||||||
|
* @param {Array} args Selector Arguments.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function fulfillWithRegistry(_x, _x2, _x3) {
|
||||||
|
return _fulfillWithRegistry.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _fulfillWithRegistry() {
|
||||||
|
_fulfillWithRegistry = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__["default"])(
|
||||||
|
/*#__PURE__*/
|
||||||
|
regeneratorRuntime.mark(function _callee2(registry, key, selectorName) {
|
||||||
|
var namespace,
|
||||||
|
resolver,
|
||||||
|
_len7,
|
||||||
|
args,
|
||||||
|
_key7,
|
||||||
|
action,
|
||||||
|
_args2 = arguments;
|
||||||
|
|
||||||
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||||
|
while (1) {
|
||||||
|
switch (_context2.prev = _context2.next) {
|
||||||
|
case 0:
|
||||||
|
namespace = registry.stores[key];
|
||||||
|
resolver = Object(lodash__WEBPACK_IMPORTED_MODULE_3__["get"])(namespace, ['resolvers', selectorName]);
|
||||||
|
|
||||||
|
if (resolver) {
|
||||||
|
_context2.next = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _context2.abrupt("return");
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
for (_len7 = _args2.length, args = new Array(_len7 > 3 ? _len7 - 3 : 0), _key7 = 3; _key7 < _len7; _key7++) {
|
||||||
|
args[_key7 - 3] = _args2[_key7];
|
||||||
|
}
|
||||||
|
|
||||||
|
action = resolver.fulfill.apply(resolver, args);
|
||||||
|
|
||||||
|
if (!action) {
|
||||||
|
_context2.next = 9;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_context2.next = 9;
|
||||||
|
return namespace.store.dispatch(action);
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
case "end":
|
||||||
|
return _context2.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, _callee2, this);
|
||||||
|
}));
|
||||||
|
return _fulfillWithRegistry.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./node_modules/@wordpress/data/build-module/plugins/controls/index.js":
|
/***/ "./node_modules/@wordpress/data/build-module/plugins/controls/index.js":
|
||||||
@ -1422,15 +1812,13 @@ var promiseMiddleware = function promiseMiddleware() {
|
|||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRegistry", function() { return createRegistry; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRegistry", function() { return createRegistry; });
|
||||||
/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
|
/* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");
|
||||||
/* harmony import */ var _babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js");
|
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js");
|
||||||
/* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js");
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ "lodash");
|
||||||
/* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js");
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! lodash */ "lodash");
|
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/deprecated */ "@wordpress/deprecated");
|
||||||
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__);
|
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var _namespace_store_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./namespace-store.js */ "./node_modules/@wordpress/data/build-module/namespace-store.js");
|
||||||
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./store */ "./node_modules/@wordpress/data/build-module/store/index.js");
|
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./store */ "./node_modules/@wordpress/data/build-module/store/index.js");
|
||||||
/* harmony import */ var _promise_middleware__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./promise-middleware */ "./node_modules/@wordpress/data/build-module/promise-middleware.js");
|
|
||||||
/* harmony import */ var _resolvers_cache_middleware__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./resolvers-cache-middleware */ "./node_modules/@wordpress/data/build-module/resolvers-cache-middleware.js");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1438,6 +1826,10 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
@ -1445,21 +1837,16 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An isolated orchestrator of store registrations.
|
* An isolated orchestrator of store registrations.
|
||||||
*
|
*
|
||||||
* @typedef {WPDataRegistry}
|
* @typedef {WPDataRegistry}
|
||||||
*
|
*
|
||||||
* @property {Function} registerReducer
|
* @property {Function} registerGenericStore
|
||||||
* @property {Function} registerSelectors
|
|
||||||
* @property {Function} registerResolvers
|
|
||||||
* @property {Function} registerActions
|
|
||||||
* @property {Function} registerStore
|
* @property {Function} registerStore
|
||||||
* @property {Function} subscribe
|
* @property {Function} subscribe
|
||||||
* @property {Function} select
|
* @property {Function} select
|
||||||
* @property {Function} dispatch
|
* @property {Function} dispatch
|
||||||
* @property {Function} use
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1479,7 +1866,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
function createRegistry() {
|
function createRegistry() {
|
||||||
var storeConfigs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
var storeConfigs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||||
var namespaces = {};
|
var stores = {};
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
/**
|
/**
|
||||||
* Global listener called for each store's update.
|
* Global listener called for each store's update.
|
||||||
@ -1490,214 +1877,6 @@ function createRegistry() {
|
|||||||
return listener();
|
return listener();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Registers a new sub-reducer to the global state and returns a Redux-like
|
|
||||||
* store object.
|
|
||||||
*
|
|
||||||
* @param {string} reducerKey Reducer key.
|
|
||||||
* @param {Object} reducer Reducer function.
|
|
||||||
*
|
|
||||||
* @return {Object} Store Object.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function registerReducer(reducerKey, reducer) {
|
|
||||||
var enhancers = [Object(redux__WEBPACK_IMPORTED_MODULE_3__["applyMiddleware"])(Object(_resolvers_cache_middleware__WEBPACK_IMPORTED_MODULE_7__["default"])(registry, reducerKey), _promise_middleware__WEBPACK_IMPORTED_MODULE_6__["default"])];
|
|
||||||
|
|
||||||
if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
|
|
||||||
enhancers.push(window.__REDUX_DEVTOOLS_EXTENSION__({
|
|
||||||
name: reducerKey,
|
|
||||||
instanceId: reducerKey
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
var store = Object(redux__WEBPACK_IMPORTED_MODULE_3__["createStore"])(reducer, Object(lodash__WEBPACK_IMPORTED_MODULE_4__["flowRight"])(enhancers));
|
|
||||||
namespaces[reducerKey] = {
|
|
||||||
store: store,
|
|
||||||
reducer: reducer
|
|
||||||
}; // Customize subscribe behavior to call listeners only on effective change,
|
|
||||||
// not on every dispatch.
|
|
||||||
|
|
||||||
var lastState = store.getState();
|
|
||||||
store.subscribe(function () {
|
|
||||||
var state = store.getState();
|
|
||||||
var hasChanged = state !== lastState;
|
|
||||||
lastState = state;
|
|
||||||
|
|
||||||
if (hasChanged) {
|
|
||||||
globalListener();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return store;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Registers selectors for external usage.
|
|
||||||
*
|
|
||||||
* @param {string} reducerKey Part of the state shape to register the
|
|
||||||
* selectors for.
|
|
||||||
* @param {Object} newSelectors Selectors to register. Keys will be used as the
|
|
||||||
* public facing API. Selectors will get passed the
|
|
||||||
* state as first argument.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function registerSelectors(reducerKey, newSelectors) {
|
|
||||||
var store = namespaces[reducerKey].store;
|
|
||||||
|
|
||||||
var createStateSelector = function createStateSelector(selector) {
|
|
||||||
return function () {
|
|
||||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
||||||
args[_key] = arguments[_key];
|
|
||||||
}
|
|
||||||
|
|
||||||
return selector.apply(void 0, [store.getState()].concat(args));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
namespaces[reducerKey].selectors = Object(lodash__WEBPACK_IMPORTED_MODULE_4__["mapValues"])(newSelectors, createStateSelector);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Registers resolvers for a given reducer key. Resolvers are side effects
|
|
||||||
* invoked once per argument set of a given selector call, used in ensuring
|
|
||||||
* that the data needs for the selector are satisfied.
|
|
||||||
*
|
|
||||||
* @param {string} reducerKey Part of the state shape to register the
|
|
||||||
* resolvers for.
|
|
||||||
* @param {Object} newResolvers Resolvers to register.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function registerResolvers(reducerKey, newResolvers) {
|
|
||||||
namespaces[reducerKey].resolvers = Object(lodash__WEBPACK_IMPORTED_MODULE_4__["mapValues"])(newResolvers, function (resolver) {
|
|
||||||
var _resolver$fulfill = resolver.fulfill,
|
|
||||||
resolverFulfill = _resolver$fulfill === void 0 ? resolver : _resolver$fulfill;
|
|
||||||
return Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_2__["default"])({}, resolver, {
|
|
||||||
fulfill: resolverFulfill
|
|
||||||
});
|
|
||||||
});
|
|
||||||
namespaces[reducerKey].selectors = Object(lodash__WEBPACK_IMPORTED_MODULE_4__["mapValues"])(namespaces[reducerKey].selectors, function (selector, selectorName) {
|
|
||||||
var resolver = newResolvers[selectorName];
|
|
||||||
|
|
||||||
if (!resolver) {
|
|
||||||
return selector;
|
|
||||||
}
|
|
||||||
|
|
||||||
return function () {
|
|
||||||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
||||||
args[_key2] = arguments[_key2];
|
|
||||||
}
|
|
||||||
|
|
||||||
var _select = select('core/data'),
|
|
||||||
hasStartedResolution = _select.hasStartedResolution;
|
|
||||||
|
|
||||||
var _dispatch = dispatch('core/data'),
|
|
||||||
startResolution = _dispatch.startResolution,
|
|
||||||
finishResolution = _dispatch.finishResolution;
|
|
||||||
|
|
||||||
function fulfillSelector() {
|
|
||||||
return _fulfillSelector.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _fulfillSelector() {
|
|
||||||
_fulfillSelector = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__["default"])(
|
|
||||||
/*#__PURE__*/
|
|
||||||
regeneratorRuntime.mark(function _callee() {
|
|
||||||
var state;
|
|
||||||
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
||||||
while (1) {
|
|
||||||
switch (_context.prev = _context.next) {
|
|
||||||
case 0:
|
|
||||||
state = namespaces[reducerKey].store.getState();
|
|
||||||
|
|
||||||
if (!(typeof resolver.isFulfilled === 'function' && resolver.isFulfilled.apply(resolver, [state].concat(args)))) {
|
|
||||||
_context.next = 3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _context.abrupt("return");
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
if (!hasStartedResolution(reducerKey, selectorName, args)) {
|
|
||||||
_context.next = 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _context.abrupt("return");
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
startResolution(reducerKey, selectorName, args);
|
|
||||||
_context.next = 8;
|
|
||||||
return fulfill.apply(void 0, [reducerKey, selectorName].concat(args));
|
|
||||||
|
|
||||||
case 8:
|
|
||||||
finishResolution(reducerKey, selectorName, args);
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
case "end":
|
|
||||||
return _context.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, _callee, this);
|
|
||||||
}));
|
|
||||||
return _fulfillSelector.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
fulfillSelector.apply(void 0, args);
|
|
||||||
return selector.apply(void 0, args);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Registers actions for external usage.
|
|
||||||
*
|
|
||||||
* @param {string} reducerKey Part of the state shape to register the
|
|
||||||
* selectors for.
|
|
||||||
* @param {Object} newActions Actions to register.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function registerActions(reducerKey, newActions) {
|
|
||||||
var store = namespaces[reducerKey].store;
|
|
||||||
|
|
||||||
var createBoundAction = function createBoundAction(action) {
|
|
||||||
return function () {
|
|
||||||
return store.dispatch(action.apply(void 0, arguments));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
namespaces[reducerKey].actions = Object(lodash__WEBPACK_IMPORTED_MODULE_4__["mapValues"])(newActions, createBoundAction);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Convenience for registering reducer with actions and selectors.
|
|
||||||
*
|
|
||||||
* @param {string} reducerKey Reducer key.
|
|
||||||
* @param {Object} options Store description (reducer, actions, selectors, resolvers).
|
|
||||||
*
|
|
||||||
* @return {Object} Registered store object.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function registerStore(reducerKey, options) {
|
|
||||||
if (!options.reducer) {
|
|
||||||
throw new TypeError('Must specify store reducer');
|
|
||||||
}
|
|
||||||
|
|
||||||
var store = registerReducer(reducerKey, options.reducer);
|
|
||||||
|
|
||||||
if (options.actions) {
|
|
||||||
registerActions(reducerKey, options.actions);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.selectors) {
|
|
||||||
registerSelectors(reducerKey, options.selectors);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.resolvers) {
|
|
||||||
registerResolvers(reducerKey, options.resolvers);
|
|
||||||
}
|
|
||||||
|
|
||||||
return store;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Subscribe to changes to any data.
|
* Subscribe to changes to any data.
|
||||||
*
|
*
|
||||||
@ -1710,7 +1889,7 @@ function createRegistry() {
|
|||||||
var subscribe = function subscribe(listener) {
|
var subscribe = function subscribe(listener) {
|
||||||
listeners.push(listener);
|
listeners.push(listener);
|
||||||
return function () {
|
return function () {
|
||||||
listeners = Object(lodash__WEBPACK_IMPORTED_MODULE_4__["without"])(listeners, listener);
|
listeners = Object(lodash__WEBPACK_IMPORTED_MODULE_2__["without"])(listeners, listener);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -1724,20 +1903,8 @@ function createRegistry() {
|
|||||||
|
|
||||||
|
|
||||||
function select(reducerKey) {
|
function select(reducerKey) {
|
||||||
return Object(lodash__WEBPACK_IMPORTED_MODULE_4__["get"])(namespaces, [reducerKey, 'selectors']);
|
var store = stores[reducerKey];
|
||||||
}
|
return store && store.getSelectors();
|
||||||
/**
|
|
||||||
* Calls a resolver given arguments
|
|
||||||
*
|
|
||||||
* @param {string} reducerKey Part of the state shape to register the
|
|
||||||
* selectors for.
|
|
||||||
* @param {string} selectorName Selector name to fulfill.
|
|
||||||
* @param {Array} args Selector Arguments.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function fulfill(_x, _x2) {
|
|
||||||
return _fulfill.apply(this, arguments);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the available actions for a part of the state.
|
* Returns the available actions for a part of the state.
|
||||||
@ -1749,74 +1916,17 @@ function createRegistry() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function _fulfill() {
|
|
||||||
_fulfill = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__["default"])(
|
|
||||||
/*#__PURE__*/
|
|
||||||
regeneratorRuntime.mark(function _callee2(reducerKey, selectorName) {
|
|
||||||
var resolver,
|
|
||||||
store,
|
|
||||||
_len3,
|
|
||||||
args,
|
|
||||||
_key3,
|
|
||||||
action,
|
|
||||||
_args2 = arguments;
|
|
||||||
|
|
||||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
||||||
while (1) {
|
|
||||||
switch (_context2.prev = _context2.next) {
|
|
||||||
case 0:
|
|
||||||
resolver = Object(lodash__WEBPACK_IMPORTED_MODULE_4__["get"])(namespaces, [reducerKey, 'resolvers', selectorName]);
|
|
||||||
|
|
||||||
if (resolver) {
|
|
||||||
_context2.next = 3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _context2.abrupt("return");
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
store = namespaces[reducerKey].store;
|
|
||||||
|
|
||||||
for (_len3 = _args2.length, args = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
||||||
args[_key3 - 2] = _args2[_key3];
|
|
||||||
}
|
|
||||||
|
|
||||||
action = resolver.fulfill.apply(resolver, args);
|
|
||||||
|
|
||||||
if (!action) {
|
|
||||||
_context2.next = 9;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_context2.next = 9;
|
|
||||||
return store.dispatch(action);
|
|
||||||
|
|
||||||
case 9:
|
|
||||||
case "end":
|
|
||||||
return _context2.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, _callee2, this);
|
|
||||||
}));
|
|
||||||
return _fulfill.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
function dispatch(reducerKey) {
|
function dispatch(reducerKey) {
|
||||||
return Object(lodash__WEBPACK_IMPORTED_MODULE_4__["get"])(namespaces, [reducerKey, 'actions']);
|
var store = stores[reducerKey];
|
||||||
}
|
return store && store.getActions();
|
||||||
/**
|
} //
|
||||||
* Maps an object of function values to proxy invocation through to the
|
// Deprecated
|
||||||
* current internal representation of the registry, which may be enhanced
|
// TODO: Remove this after `use()` is removed.
|
||||||
* by plugins.
|
//
|
||||||
*
|
|
||||||
* @param {Object<string,Function>} attributes Object of function values.
|
|
||||||
*
|
|
||||||
* @return {Object<string,Function>} Object enhanced with plugin proxying.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
function withPlugins(attributes) {
|
function withPlugins(attributes) {
|
||||||
return Object(lodash__WEBPACK_IMPORTED_MODULE_4__["mapValues"])(attributes, function (attribute, key) {
|
return Object(lodash__WEBPACK_IMPORTED_MODULE_2__["mapValues"])(attributes, function (attribute, key) {
|
||||||
if (typeof attribute !== 'function') {
|
if (typeof attribute !== 'function') {
|
||||||
return attribute;
|
return attribute;
|
||||||
}
|
}
|
||||||
@ -1826,42 +1936,138 @@ function createRegistry() {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Registers a generic store.
|
||||||
|
*
|
||||||
|
* @param {string} key Store registry key.
|
||||||
|
* @param {Object} config Configuration (getSelectors, getActions, subscribe).
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function registerGenericStore(key, config) {
|
||||||
|
if (typeof config.getSelectors !== 'function') {
|
||||||
|
throw new TypeError('config.getSelectors must be a function');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config.getActions !== 'function') {
|
||||||
|
throw new TypeError('config.getActions must be a function');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof config.subscribe !== 'function') {
|
||||||
|
throw new TypeError('config.subscribe must be a function');
|
||||||
|
}
|
||||||
|
|
||||||
|
stores[key] = config;
|
||||||
|
config.subscribe(globalListener);
|
||||||
|
}
|
||||||
|
|
||||||
var registry = {
|
var registry = {
|
||||||
namespaces: namespaces,
|
registerGenericStore: registerGenericStore,
|
||||||
registerReducer: registerReducer,
|
stores: stores,
|
||||||
registerSelectors: registerSelectors,
|
namespaces: stores,
|
||||||
registerResolvers: registerResolvers,
|
// TODO: Deprecate/remove this.
|
||||||
registerActions: registerActions,
|
|
||||||
registerStore: registerStore,
|
|
||||||
subscribe: subscribe,
|
subscribe: subscribe,
|
||||||
select: select,
|
select: select,
|
||||||
dispatch: dispatch,
|
dispatch: dispatch,
|
||||||
use: use
|
use: use
|
||||||
|
}; //
|
||||||
|
// Deprecated
|
||||||
|
//
|
||||||
|
|
||||||
|
registry.registerReducer = function (reducerKey, reducer) {
|
||||||
|
_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_3___default()('registry.registerReducer', {
|
||||||
|
alternative: 'registry.registerStore',
|
||||||
|
plugin: 'Gutenberg',
|
||||||
|
version: '4.4.0'
|
||||||
|
});
|
||||||
|
var namespace = Object(_namespace_store_js__WEBPACK_IMPORTED_MODULE_4__["default"])(reducerKey, {
|
||||||
|
reducer: reducer
|
||||||
|
}, registry);
|
||||||
|
registerGenericStore(reducerKey, namespace);
|
||||||
|
return namespace.store;
|
||||||
|
}; //
|
||||||
|
// Deprecated
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
registry.registerActions = function (reducerKey, actions) {
|
||||||
|
_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_3___default()('registry.registerActions', {
|
||||||
|
alternative: 'registry.registerStore',
|
||||||
|
plugin: 'Gutenberg',
|
||||||
|
version: '4.4.0'
|
||||||
|
});
|
||||||
|
var namespace = Object(_namespace_store_js__WEBPACK_IMPORTED_MODULE_4__["default"])(reducerKey, {
|
||||||
|
actions: actions
|
||||||
|
}, registry);
|
||||||
|
registerGenericStore(reducerKey, namespace);
|
||||||
|
}; //
|
||||||
|
// Deprecated
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
registry.registerSelectors = function (reducerKey, selectors) {
|
||||||
|
_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_3___default()('registry.registerSelectors', {
|
||||||
|
alternative: 'registry.registerStore',
|
||||||
|
plugin: 'Gutenberg',
|
||||||
|
version: '4.4.0'
|
||||||
|
});
|
||||||
|
var namespace = Object(_namespace_store_js__WEBPACK_IMPORTED_MODULE_4__["default"])(reducerKey, {
|
||||||
|
selectors: selectors
|
||||||
|
}, registry);
|
||||||
|
registerGenericStore(reducerKey, namespace);
|
||||||
|
}; //
|
||||||
|
// Deprecated
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
registry.registerResolvers = function (reducerKey, resolvers) {
|
||||||
|
_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_3___default()('registry.registerResolvers', {
|
||||||
|
alternative: 'registry.registerStore',
|
||||||
|
plugin: 'Gutenberg',
|
||||||
|
version: '4.4.0'
|
||||||
|
});
|
||||||
|
var namespace = Object(_namespace_store_js__WEBPACK_IMPORTED_MODULE_4__["default"])(reducerKey, {
|
||||||
|
resolvers: resolvers
|
||||||
|
}, registry);
|
||||||
|
registerGenericStore(reducerKey, namespace);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Enhances the registry with the prescribed set of overrides. Returns the
|
* Registers a standard `@wordpress/data` store.
|
||||||
* enhanced registry to enable plugin chaining.
|
|
||||||
*
|
*
|
||||||
* @param {WPDataPlugin} plugin Plugin by which to enhance.
|
* @param {string} reducerKey Reducer key.
|
||||||
* @param {?Object} options Optional options to pass to plugin.
|
* @param {Object} options Store description (reducer, actions, selectors, resolvers).
|
||||||
*
|
*
|
||||||
* @return {WPDataRegistry} Enhanced registry.
|
* @return {Object} Registered store object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
registry.registerStore = function (reducerKey, options) {
|
||||||
|
if (!options.reducer) {
|
||||||
|
throw new TypeError('Must specify store reducer');
|
||||||
|
}
|
||||||
|
|
||||||
|
var namespace = Object(_namespace_store_js__WEBPACK_IMPORTED_MODULE_4__["default"])(reducerKey, options, registry);
|
||||||
|
registerGenericStore(reducerKey, namespace);
|
||||||
|
return namespace.store;
|
||||||
|
}; //
|
||||||
|
// TODO:
|
||||||
|
// This function will be deprecated as soon as it is no longer internally referenced.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
function use(plugin, options) {
|
function use(plugin, options) {
|
||||||
registry = Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_2__["default"])({}, registry, plugin(registry, options));
|
registry = Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_1__["default"])({}, registry, plugin(registry, options));
|
||||||
return registry;
|
return registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.entries(Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_2__["default"])({
|
Object.entries(Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_1__["default"])({
|
||||||
'core/data': _store__WEBPACK_IMPORTED_MODULE_5__["default"]
|
'core/data': _store__WEBPACK_IMPORTED_MODULE_5__["default"]
|
||||||
}, storeConfigs)).map(function (_ref) {
|
}, storeConfigs)).map(function (_ref) {
|
||||||
var _ref2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__["default"])(_ref, 2),
|
var _ref2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__["default"])(_ref, 2),
|
||||||
name = _ref2[0],
|
name = _ref2[0],
|
||||||
config = _ref2[1];
|
config = _ref2[1];
|
||||||
|
|
||||||
return registerStore(name, config);
|
return registry.registerStore(name, config);
|
||||||
});
|
});
|
||||||
return withPlugins(registry);
|
return withPlugins(registry);
|
||||||
}
|
}
|
||||||
@ -3454,6 +3660,17 @@ module.exports = function(originalModule) {
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "@wordpress/deprecated":
|
||||||
|
/*!*********************************************!*\
|
||||||
|
!*** external {"this":["wp","deprecated"]} ***!
|
||||||
|
\*********************************************/
|
||||||
|
/*! no static exports found */
|
||||||
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
|
(function() { module.exports = this["wp"]["deprecated"]; }());
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ "@wordpress/element":
|
/***/ "@wordpress/element":
|
||||||
/*!******************************************!*\
|
/*!******************************************!*\
|
||||||
!*** external {"this":["wp","element"]} ***!
|
!*** external {"this":["wp","element"]} ***!
|
||||||
|
2
wp-includes/js/dist/data.js.map
vendored
2
wp-includes/js/dist/data.js.map
vendored
File diff suppressed because one or more lines are too long
448
wp-includes/js/dist/edit-post.js
vendored
448
wp-includes/js/dist/edit-post.js
vendored
@ -2040,7 +2040,7 @@ var textFormattingShortcuts = {
|
|||||||
keyCombination: primary('k'),
|
keyCombination: primary('k'),
|
||||||
description: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Convert the selected text into a link.')
|
description: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Convert the selected text into a link.')
|
||||||
}, {
|
}, {
|
||||||
keyCombination: access('s'),
|
keyCombination: primaryShift('k'),
|
||||||
description: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Remove a link.')
|
description: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Remove a link.')
|
||||||
}, {
|
}, {
|
||||||
keyCombination: access('d'),
|
keyCombination: access('d'),
|
||||||
@ -2793,7 +2793,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor");
|
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor");
|
||||||
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_6__);
|
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_6__);
|
||||||
/* harmony import */ var _section__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./section */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/section.js");
|
/* harmony import */ var _section__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./section */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/section.js");
|
||||||
/* harmony import */ var _options__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./options */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options.js");
|
/* harmony import */ var _options__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./options */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/index.js");
|
||||||
|
/* harmony import */ var _meta_boxes_section__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./meta-boxes-section */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/meta-boxes-section.js");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2815,12 +2816,11 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var MODAL_NAME = 'edit-post/options';
|
var MODAL_NAME = 'edit-post/options';
|
||||||
function OptionsModal(_ref) {
|
function OptionsModal(_ref) {
|
||||||
var isModalActive = _ref.isModalActive,
|
var isModalActive = _ref.isModalActive,
|
||||||
closeModal = _ref.closeModal,
|
closeModal = _ref.closeModal;
|
||||||
_ref$metaBoxes = _ref.metaBoxes,
|
|
||||||
metaBoxes = _ref$metaBoxes === void 0 ? [] : _ref$metaBoxes;
|
|
||||||
|
|
||||||
if (!isModalActive) {
|
if (!isModalActive) {
|
||||||
return null;
|
return null;
|
||||||
@ -2860,22 +2860,13 @@ function OptionsModal(_ref) {
|
|||||||
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_6__["PageAttributesCheck"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_options__WEBPACK_IMPORTED_MODULE_8__["EnablePanelOption"], {
|
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_6__["PageAttributesCheck"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_options__WEBPACK_IMPORTED_MODULE_8__["EnablePanelOption"], {
|
||||||
label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Page Attributes'),
|
label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Page Attributes'),
|
||||||
panelName: "page-attributes"
|
panelName: "page-attributes"
|
||||||
}))), metaBoxes.length !== 0 && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_section__WEBPACK_IMPORTED_MODULE_7__["default"], {
|
}))), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_meta_boxes_section__WEBPACK_IMPORTED_MODULE_9__["default"], {
|
||||||
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Advanced Panels')
|
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Advanced Panels')
|
||||||
}, Object(lodash__WEBPACK_IMPORTED_MODULE_1__["map"])(metaBoxes, function (_ref2) {
|
}));
|
||||||
var title = _ref2.title,
|
|
||||||
id = _ref2.id;
|
|
||||||
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_options__WEBPACK_IMPORTED_MODULE_8__["EnablePanelOption"], {
|
|
||||||
key: id,
|
|
||||||
label: title,
|
|
||||||
panelName: "meta-box-".concat(id)
|
|
||||||
});
|
|
||||||
})));
|
|
||||||
}
|
}
|
||||||
/* harmony default export */ __webpack_exports__["default"] = (Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_5__["compose"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__["withSelect"])(function (select) {
|
/* harmony default export */ __webpack_exports__["default"] = (Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_5__["compose"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__["withSelect"])(function (select) {
|
||||||
return {
|
return {
|
||||||
isModalActive: select('core/edit-post').isModalActive(MODAL_NAME),
|
isModalActive: select('core/edit-post').isModalActive(MODAL_NAME)
|
||||||
metaBoxes: select('core/edit-post').getAllMetaBoxes()
|
|
||||||
};
|
};
|
||||||
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__["withDispatch"])(function (dispatch) {
|
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__["withDispatch"])(function (dispatch) {
|
||||||
return {
|
return {
|
||||||
@ -2888,18 +2879,136 @@ function OptionsModal(_ref) {
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options.js":
|
/***/ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/meta-boxes-section.js":
|
||||||
/*!********************************************************************************************!*\
|
/*!*******************************************************************************************************!*\
|
||||||
!*** ./node_modules/@wordpress/edit-post/build-module/components/options-modal/options.js ***!
|
!*** ./node_modules/@wordpress/edit-post/build-module/components/options-modal/meta-boxes-section.js ***!
|
||||||
\********************************************************************************************/
|
\*******************************************************************************************************/
|
||||||
/*! exports provided: EnablePublishSidebarOption, EnableTipsOption, EnablePanelOption */
|
/*! exports provided: default */
|
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js");
|
||||||
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
||||||
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ "lodash");
|
||||||
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
||||||
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__);
|
||||||
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
||||||
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__);
|
||||||
|
/* harmony import */ var _section__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./section */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/section.js");
|
||||||
|
/* harmony import */ var _options__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./options */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/index.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* External dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function MetaBoxesSection(_ref) {
|
||||||
|
var hasCustomFieldsSupport = _ref.hasCustomFieldsSupport,
|
||||||
|
metaBoxes = _ref.metaBoxes,
|
||||||
|
sectionProps = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_0__["default"])(_ref, ["hasCustomFieldsSupport", "metaBoxes"]);
|
||||||
|
|
||||||
|
if (!hasCustomFieldsSupport && metaBoxes.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_section__WEBPACK_IMPORTED_MODULE_5__["default"], sectionProps, hasCustomFieldsSupport && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_options__WEBPACK_IMPORTED_MODULE_6__["EnableCustomFieldsOption"], {
|
||||||
|
label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Custom Fields')
|
||||||
|
}), Object(lodash__WEBPACK_IMPORTED_MODULE_2__["map"])(metaBoxes, function (_ref2) {
|
||||||
|
var id = _ref2.id,
|
||||||
|
title = _ref2.title;
|
||||||
|
return (// The 'Custom Fields' meta box is a special case handled above.
|
||||||
|
id !== 'postcustom' && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_options__WEBPACK_IMPORTED_MODULE_6__["EnablePanelOption"], {
|
||||||
|
key: id,
|
||||||
|
label: title,
|
||||||
|
panelName: "meta-box-".concat(id)
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* harmony default export */ __webpack_exports__["default"] = (Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_4__["withSelect"])(function (select) {
|
||||||
|
var _select = select('core/editor'),
|
||||||
|
getEditedPostAttribute = _select.getEditedPostAttribute;
|
||||||
|
|
||||||
|
var _select2 = select('core'),
|
||||||
|
getPostType = _select2.getPostType;
|
||||||
|
|
||||||
|
var _select3 = select('core/edit-post'),
|
||||||
|
getAllMetaBoxes = _select3.getAllMetaBoxes;
|
||||||
|
|
||||||
|
var postType = getPostType(getEditedPostAttribute('type'));
|
||||||
|
return {
|
||||||
|
hasCustomFieldsSupport: postType.supports['custom-fields'],
|
||||||
|
metaBoxes: getAllMetaBoxes()
|
||||||
|
};
|
||||||
|
})(MetaBoxesSection));
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/base.js":
|
||||||
|
/*!*************************************************************************************************!*\
|
||||||
|
!*** ./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/base.js ***!
|
||||||
|
\*************************************************************************************************/
|
||||||
|
/*! exports provided: default */
|
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
||||||
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
|
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
||||||
|
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function BaseOption(_ref) {
|
||||||
|
var label = _ref.label,
|
||||||
|
isChecked = _ref.isChecked,
|
||||||
|
onChange = _ref.onChange;
|
||||||
|
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_1__["CheckboxControl"], {
|
||||||
|
className: "edit-post-options-modal__option",
|
||||||
|
label: label,
|
||||||
|
checked: isChecked,
|
||||||
|
onChange: onChange
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* harmony default export */ __webpack_exports__["default"] = (BaseOption);
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/deferred.js":
|
||||||
|
/*!*****************************************************************************************************!*\
|
||||||
|
!*** ./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/deferred.js ***!
|
||||||
|
\*****************************************************************************************************/
|
||||||
|
/*! exports provided: default */
|
||||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EnablePublishSidebarOption", function() { return EnablePublishSidebarOption; });
|
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EnableTipsOption", function() { return EnableTipsOption; });
|
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EnablePanelOption", function() { return EnablePanelOption; });
|
|
||||||
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
|
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
|
||||||
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
|
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
|
||||||
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
|
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
|
||||||
@ -2907,14 +3016,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js");
|
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js");
|
||||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
||||||
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);
|
||||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./base */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/base.js");
|
||||||
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__);
|
|
||||||
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
|
|
||||||
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_7__);
|
|
||||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
|
||||||
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_8__);
|
|
||||||
/* harmony import */ var _wordpress_viewport__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/viewport */ "@wordpress/viewport");
|
|
||||||
/* harmony import */ var _wordpress_viewport__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_viewport__WEBPACK_IMPORTED_MODULE_9__);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2926,32 +3028,21 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
* WordPress dependencies
|
* WordPress dependencies
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Option(_ref) {
|
|
||||||
var label = _ref.label,
|
|
||||||
isChecked = _ref.isChecked,
|
|
||||||
onChange = _ref.onChange;
|
|
||||||
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_6__["CheckboxControl"], {
|
|
||||||
className: "edit-post-options-modal__option",
|
|
||||||
label: label,
|
|
||||||
checked: isChecked,
|
|
||||||
onChange: onChange
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var DeferredOption =
|
var DeferredOption =
|
||||||
/*#__PURE__*/
|
/*#__PURE__*/
|
||||||
function (_Component) {
|
function (_Component) {
|
||||||
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(DeferredOption, _Component);
|
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(DeferredOption, _Component);
|
||||||
|
|
||||||
function DeferredOption(_ref2) {
|
function DeferredOption(_ref) {
|
||||||
var _this;
|
var _this;
|
||||||
|
|
||||||
var isChecked = _ref2.isChecked;
|
var isChecked = _ref.isChecked;
|
||||||
|
|
||||||
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, DeferredOption);
|
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, DeferredOption);
|
||||||
|
|
||||||
@ -2974,7 +3065,7 @@ function (_Component) {
|
|||||||
value: function render() {
|
value: function render() {
|
||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["createElement"])(Option, {
|
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["createElement"])(_base__WEBPACK_IMPORTED_MODULE_6__["default"], {
|
||||||
label: this.props.label,
|
label: this.props.label,
|
||||||
isChecked: this.state.isChecked,
|
isChecked: this.state.isChecked,
|
||||||
onChange: function onChange(isChecked) {
|
onChange: function onChange(isChecked) {
|
||||||
@ -2989,11 +3080,180 @@ function (_Component) {
|
|||||||
return DeferredOption;
|
return DeferredOption;
|
||||||
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Component"]);
|
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Component"]);
|
||||||
|
|
||||||
var EnablePublishSidebarOption = Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_7__["compose"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_8__["withSelect"])(function (select) {
|
/* harmony default export */ __webpack_exports__["default"] = (DeferredOption);
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-custom-fields.js":
|
||||||
|
/*!*****************************************************************************************************************!*\
|
||||||
|
!*** ./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-custom-fields.js ***!
|
||||||
|
\*****************************************************************************************************************/
|
||||||
|
/*! exports provided: default */
|
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
|
||||||
|
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
|
||||||
|
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
|
||||||
|
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
|
||||||
|
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js");
|
||||||
|
/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
|
||||||
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
||||||
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__);
|
||||||
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
||||||
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_7__);
|
||||||
|
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./base */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/base.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var EnableCustomFieldsOption =
|
||||||
|
/*#__PURE__*/
|
||||||
|
function (_Component) {
|
||||||
|
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(EnableCustomFieldsOption, _Component);
|
||||||
|
|
||||||
|
function EnableCustomFieldsOption(_ref) {
|
||||||
|
var _this;
|
||||||
|
|
||||||
|
var isChecked = _ref.isChecked;
|
||||||
|
|
||||||
|
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, EnableCustomFieldsOption);
|
||||||
|
|
||||||
|
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(EnableCustomFieldsOption).apply(this, arguments));
|
||||||
|
_this.toggleCustomFields = _this.toggleCustomFields.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
|
||||||
|
_this.state = {
|
||||||
|
isChecked: isChecked
|
||||||
|
};
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(EnableCustomFieldsOption, [{
|
||||||
|
key: "toggleCustomFields",
|
||||||
|
value: function toggleCustomFields() {
|
||||||
|
// Submit a hidden form which triggers the toggle_custom_fields admin action.
|
||||||
|
// This action will toggle the setting and reload the editor with the meta box
|
||||||
|
// assets included on the page.
|
||||||
|
document.getElementById('toggle-custom-fields-form').submit(); // Make it look like something happened while the page reloads.
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
isChecked: !this.props.isChecked
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: "render",
|
||||||
|
value: function render() {
|
||||||
|
var label = this.props.label;
|
||||||
|
var isChecked = this.state.isChecked;
|
||||||
|
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_base__WEBPACK_IMPORTED_MODULE_8__["default"], {
|
||||||
|
label: label,
|
||||||
|
isChecked: isChecked,
|
||||||
|
onChange: this.toggleCustomFields
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return EnableCustomFieldsOption;
|
||||||
|
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["Component"]);
|
||||||
|
|
||||||
|
/* harmony default export */ __webpack_exports__["default"] = (Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_7__["withSelect"])(function (select) {
|
||||||
|
return {
|
||||||
|
isChecked: select('core/editor').getEditorSettings().enableCustomFields
|
||||||
|
};
|
||||||
|
})(EnableCustomFieldsOption));
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-panel.js":
|
||||||
|
/*!*********************************************************************************************************!*\
|
||||||
|
!*** ./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-panel.js ***!
|
||||||
|
\*********************************************************************************************************/
|
||||||
|
/*! exports provided: default */
|
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
|
||||||
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
||||||
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/base.js");
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* harmony default export */ __webpack_exports__["default"] = (Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__["compose"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["withSelect"])(function (select, _ref) {
|
||||||
|
var panelName = _ref.panelName;
|
||||||
|
return {
|
||||||
|
isChecked: select('core/edit-post').isEditorPanelEnabled(panelName)
|
||||||
|
};
|
||||||
|
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["withDispatch"])(function (dispatch, _ref2) {
|
||||||
|
var panelName = _ref2.panelName;
|
||||||
|
return {
|
||||||
|
onChange: function onChange() {
|
||||||
|
return dispatch('core/edit-post').toggleEditorPanelEnabled(panelName);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}))(_base__WEBPACK_IMPORTED_MODULE_2__["default"]));
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-publish-sidebar.js":
|
||||||
|
/*!*******************************************************************************************************************!*\
|
||||||
|
!*** ./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-publish-sidebar.js ***!
|
||||||
|
\*******************************************************************************************************************/
|
||||||
|
/*! exports provided: default */
|
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
|
||||||
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
||||||
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
/* harmony import */ var _wordpress_viewport__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/viewport */ "@wordpress/viewport");
|
||||||
|
/* harmony import */ var _wordpress_viewport__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_viewport__WEBPACK_IMPORTED_MODULE_2__);
|
||||||
|
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./base */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/base.js");
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* harmony default export */ __webpack_exports__["default"] = (Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__["compose"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["withSelect"])(function (select) {
|
||||||
return {
|
return {
|
||||||
isChecked: select('core/editor').isPublishSidebarEnabled()
|
isChecked: select('core/editor').isPublishSidebarEnabled()
|
||||||
};
|
};
|
||||||
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_8__["withDispatch"])(function (dispatch) {
|
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["withDispatch"])(function (dispatch) {
|
||||||
var _dispatch = dispatch('core/editor'),
|
var _dispatch = dispatch('core/editor'),
|
||||||
enablePublishSidebar = _dispatch.enablePublishSidebar,
|
enablePublishSidebar = _dispatch.enablePublishSidebar,
|
||||||
disablePublishSidebar = _dispatch.disablePublishSidebar;
|
disablePublishSidebar = _dispatch.disablePublishSidebar;
|
||||||
@ -3005,15 +3265,43 @@ var EnablePublishSidebarOption = Object(_wordpress_compose__WEBPACK_IMPORTED_MOD
|
|||||||
};
|
};
|
||||||
}), // In < medium viewports we override this option and always show the publish sidebar.
|
}), // In < medium viewports we override this option and always show the publish sidebar.
|
||||||
// See the edit-post's header component for the specific logic.
|
// See the edit-post's header component for the specific logic.
|
||||||
Object(_wordpress_viewport__WEBPACK_IMPORTED_MODULE_9__["ifViewportMatches"])('medium'))(Option);
|
Object(_wordpress_viewport__WEBPACK_IMPORTED_MODULE_2__["ifViewportMatches"])('medium'))(_base__WEBPACK_IMPORTED_MODULE_3__["default"]));
|
||||||
var EnableTipsOption = Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_7__["compose"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_8__["withSelect"])(function (select) {
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-tips.js":
|
||||||
|
/*!********************************************************************************************************!*\
|
||||||
|
!*** ./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-tips.js ***!
|
||||||
|
\********************************************************************************************************/
|
||||||
|
/*! exports provided: default */
|
||||||
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
|
||||||
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__);
|
||||||
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
||||||
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
|
/* harmony import */ var _deferred__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./deferred */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/deferred.js");
|
||||||
|
/**
|
||||||
|
* WordPress dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* harmony default export */ __webpack_exports__["default"] = (Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__["compose"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["withSelect"])(function (select) {
|
||||||
return {
|
return {
|
||||||
isChecked: select('core/nux').areTipsEnabled()
|
isChecked: select('core/nux').areTipsEnabled()
|
||||||
};
|
};
|
||||||
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_8__["withDispatch"])(function (dispatch) {
|
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["withDispatch"])(function (dispatch) {
|
||||||
var _dispatch2 = dispatch('core/nux'),
|
var _dispatch = dispatch('core/nux'),
|
||||||
enableTips = _dispatch2.enableTips,
|
enableTips = _dispatch.enableTips,
|
||||||
disableTips = _dispatch2.disableTips;
|
disableTips = _dispatch.disableTips;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
onChange: function onChange(isEnabled) {
|
onChange: function onChange(isEnabled) {
|
||||||
@ -3023,20 +3311,36 @@ var EnableTipsOption = Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_7__["c
|
|||||||
}))( // Using DeferredOption here means enableTips() is called when the Options
|
}))( // Using DeferredOption here means enableTips() is called when the Options
|
||||||
// modal is dismissed. This stops the NUX guide from appearing above the
|
// modal is dismissed. This stops the NUX guide from appearing above the
|
||||||
// Options modal, which looks totally weird.
|
// Options modal, which looks totally weird.
|
||||||
DeferredOption);
|
_deferred__WEBPACK_IMPORTED_MODULE_2__["default"]));
|
||||||
var EnablePanelOption = Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_7__["compose"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_8__["withSelect"])(function (select, _ref3) {
|
|
||||||
var panelName = _ref3.panelName;
|
|
||||||
return {
|
/***/ }),
|
||||||
isChecked: select('core/edit-post').isEditorPanelEnabled(panelName)
|
|
||||||
};
|
/***/ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/index.js":
|
||||||
}), Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_8__["withDispatch"])(function (dispatch, _ref4) {
|
/*!**************************************************************************************************!*\
|
||||||
var panelName = _ref4.panelName;
|
!*** ./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/index.js ***!
|
||||||
return {
|
\**************************************************************************************************/
|
||||||
onChange: function onChange() {
|
/*! exports provided: EnableCustomFieldsOption, EnablePanelOption, EnablePublishSidebarOption, EnableTipsOption */
|
||||||
return dispatch('core/edit-post').toggleEditorPanelEnabled(panelName);
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||||
}
|
|
||||||
};
|
"use strict";
|
||||||
}))(Option);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony import */ var _enable_custom_fields__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./enable-custom-fields */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-custom-fields.js");
|
||||||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EnableCustomFieldsOption", function() { return _enable_custom_fields__WEBPACK_IMPORTED_MODULE_0__["default"]; });
|
||||||
|
|
||||||
|
/* harmony import */ var _enable_panel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./enable-panel */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-panel.js");
|
||||||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EnablePanelOption", function() { return _enable_panel__WEBPACK_IMPORTED_MODULE_1__["default"]; });
|
||||||
|
|
||||||
|
/* harmony import */ var _enable_publish_sidebar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./enable-publish-sidebar */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-publish-sidebar.js");
|
||||||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EnablePublishSidebarOption", function() { return _enable_publish_sidebar__WEBPACK_IMPORTED_MODULE_2__["default"]; });
|
||||||
|
|
||||||
|
/* harmony import */ var _enable_tips__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enable-tips */ "./node_modules/@wordpress/edit-post/build-module/components/options-modal/options/enable-tips.js");
|
||||||
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EnableTipsOption", function() { return _enable_tips__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
2
wp-includes/js/dist/edit-post.js.map
vendored
2
wp-includes/js/dist/edit-post.js.map
vendored
File diff suppressed because one or more lines are too long
939
wp-includes/js/dist/editor.js
vendored
939
wp-includes/js/dist/editor.js
vendored
File diff suppressed because it is too large
Load Diff
2
wp-includes/js/dist/editor.js.map
vendored
2
wp-includes/js/dist/editor.js.map
vendored
File diff suppressed because one or more lines are too long
2
wp-includes/js/dist/format-library.js.map
vendored
2
wp-includes/js/dist/format-library.js.map
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
wp-includes/js/dist/notices.js.map
vendored
2
wp-includes/js/dist/notices.js.map
vendored
File diff suppressed because one or more lines are too long
2
wp-includes/js/dist/nux.js
vendored
2
wp-includes/js/dist/nux.js
vendored
@ -397,7 +397,7 @@ function DotTip(_ref) {
|
|||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
tipId = id;
|
tipId = id;
|
||||||
Object(_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5__["deprecated"])('The id prop of wp.nux.DotTip', {
|
_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5___default()('The id prop of wp.nux.DotTip', {
|
||||||
plugin: 'Gutenberg',
|
plugin: 'Gutenberg',
|
||||||
version: '4.4',
|
version: '4.4',
|
||||||
alternative: 'the tipId prop'
|
alternative: 'the tipId prop'
|
||||||
|
2
wp-includes/js/dist/nux.js.map
vendored
2
wp-includes/js/dist/nux.js.map
vendored
File diff suppressed because one or more lines are too long
2
wp-includes/js/dist/rich-text.js.map
vendored
2
wp-includes/js/dist/rich-text.js.map
vendored
File diff suppressed because one or more lines are too long
2
wp-includes/js/dist/viewport.js.map
vendored
2
wp-includes/js/dist/viewport.js.map
vendored
File diff suppressed because one or more lines are too long
@ -237,9 +237,6 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||||||
|
|
||||||
$attachment = get_post( $request['id'] );
|
$attachment = get_post( $request['id'] );
|
||||||
|
|
||||||
/** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php */
|
|
||||||
do_action( 'rest_insert_attachment', $data, $request, false );
|
|
||||||
|
|
||||||
$fields_update = $this->update_additional_fields_for_object( $attachment, $request );
|
$fields_update = $this->update_additional_fields_for_object( $attachment, $request );
|
||||||
|
|
||||||
if ( is_wp_error( $fields_update ) ) {
|
if ( is_wp_error( $fields_update ) ) {
|
||||||
|
@ -739,6 +739,12 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||||||
|
|
||||||
$request->set_param( 'context', 'edit' );
|
$request->set_param( 'context', 'edit' );
|
||||||
|
|
||||||
|
// Filter is fired in WP_REST_Attachments_Controller subclass.
|
||||||
|
if ( 'attachment' === $this->post_type ) {
|
||||||
|
$response = $this->prepare_item_for_response( $post, $request );
|
||||||
|
return rest_ensure_response( $response );
|
||||||
|
}
|
||||||
|
|
||||||
/** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */
|
/** This action is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */
|
||||||
do_action( "rest_after_insert_{$this->post_type}", $post, $request, false );
|
do_action( "rest_after_insert_{$this->post_type}", $post, $request, false );
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-beta2-43861';
|
$wp_version = '5.0-beta2-43862';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user