mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
81f62198c3
Moves the widgets block editor from Gutenberg into WordPress Core. - Adds @wordpress/edit-widgets, @wordpress/customize-widgets and @wordpress/widgets. - Modifies wp-admin/widgets.php to branch between the old editor and new editor depending on wp_use_widgets_block_editor(). - Modifies WP_Customize_Widgets to branch between the old editor control and new editor control depending on wp_use_widgets_block_editor(). Fixes #51506. Props isabel_brison, TimothyBlynJacobs, andraganescu, kevin940726, talldanwp. Built from https://develop.svn.wordpress.org/trunk@50996 git-svn-id: http://core.svn.wordpress.org/trunk@50605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
301 lines
10 KiB
JavaScript
301 lines
10 KiB
JavaScript
this["wp"] = this["wp"] || {}; this["wp"]["widgets"] =
|
|
/******/ (function(modules) { // webpackBootstrap
|
|
/******/ // The module cache
|
|
/******/ var installedModules = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
/******/
|
|
/******/ // Check if module is in cache
|
|
/******/ if(installedModules[moduleId]) {
|
|
/******/ return installedModules[moduleId].exports;
|
|
/******/ }
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = installedModules[moduleId] = {
|
|
/******/ i: moduleId,
|
|
/******/ l: false,
|
|
/******/ exports: {}
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
/******/
|
|
/******/ // Flag the module as loaded
|
|
/******/ module.l = true;
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
/******/
|
|
/******/
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
/******/ __webpack_require__.m = modules;
|
|
/******/
|
|
/******/ // expose the module cache
|
|
/******/ __webpack_require__.c = installedModules;
|
|
/******/
|
|
/******/ // define getter function for harmony exports
|
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
/******/ }
|
|
/******/ };
|
|
/******/
|
|
/******/ // define __esModule on exports
|
|
/******/ __webpack_require__.r = function(exports) {
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
/******/ }
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
/******/ };
|
|
/******/
|
|
/******/ // create a fake namespace object
|
|
/******/ // mode & 1: value is a module id, require it
|
|
/******/ // mode & 2: merge all properties of value into the ns
|
|
/******/ // mode & 4: return value when already ns object
|
|
/******/ // mode & 8|1: behave like require
|
|
/******/ __webpack_require__.t = function(value, mode) {
|
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
/******/ if(mode & 8) return value;
|
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
/******/ var ns = Object.create(null);
|
|
/******/ __webpack_require__.r(ns);
|
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
/******/ return ns;
|
|
/******/ };
|
|
/******/
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
/******/ __webpack_require__.n = function(module) {
|
|
/******/ var getter = module && module.__esModule ?
|
|
/******/ function getDefault() { return module['default']; } :
|
|
/******/ function getModuleExports() { return module; };
|
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
/******/ return getter;
|
|
/******/ };
|
|
/******/
|
|
/******/ // Object.prototype.hasOwnProperty.call
|
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
/******/
|
|
/******/ // __webpack_public_path__
|
|
/******/ __webpack_require__.p = "";
|
|
/******/
|
|
/******/
|
|
/******/ // Load entry module and return exports
|
|
/******/ return __webpack_require__(__webpack_require__.s = "4g8P");
|
|
/******/ })
|
|
/************************************************************************/
|
|
/******/ ({
|
|
|
|
/***/ "1ZqX":
|
|
/***/ (function(module, exports) {
|
|
|
|
(function() { module.exports = window["wp"]["data"]; }());
|
|
|
|
/***/ }),
|
|
|
|
/***/ "4g8P":
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, "MoveToWidgetArea", function() { return /* reexport */ MoveToWidgetArea; });
|
|
__webpack_require__.d(__webpack_exports__, "registerLegacyWidgetVariations", function() { return /* reexport */ registerLegacyWidgetVariations; });
|
|
__webpack_require__.d(__webpack_exports__, "getWidgetIdFromBlock", function() { return /* reexport */ getWidgetIdFromBlock; });
|
|
__webpack_require__.d(__webpack_exports__, "addWidgetIdToBlock", function() { return /* reexport */ addWidgetIdToBlock; });
|
|
|
|
// EXTERNAL MODULE: external ["wp","element"]
|
|
var external_wp_element_ = __webpack_require__("GRId");
|
|
|
|
// EXTERNAL MODULE: external ["wp","components"]
|
|
var external_wp_components_ = __webpack_require__("tI+e");
|
|
|
|
// EXTERNAL MODULE: external ["wp","i18n"]
|
|
var external_wp_i18n_ = __webpack_require__("l3Sj");
|
|
|
|
// EXTERNAL MODULE: external ["wp","primitives"]
|
|
var external_wp_primitives_ = __webpack_require__("Tqx9");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/move-to.js
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
const moveTo = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
viewBox: "0 0 24 24"
|
|
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
|
|
d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z"
|
|
}));
|
|
/* harmony default export */ var move_to = (moveTo);
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/components/move-to-widget-area/index.js
|
|
|
|
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
function MoveToWidgetArea({
|
|
currentWidgetAreaId,
|
|
widgetAreas,
|
|
onSelect
|
|
}) {
|
|
return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], null, toggleProps => Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], {
|
|
icon: move_to,
|
|
label: Object(external_wp_i18n_["__"])('Move to widget area'),
|
|
toggleProps: toggleProps
|
|
}, ({
|
|
onClose
|
|
}) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], {
|
|
label: Object(external_wp_i18n_["__"])('Move to')
|
|
}, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItemsChoice"], {
|
|
choices: widgetAreas.map(widgetArea => ({
|
|
value: widgetArea.id,
|
|
label: widgetArea.name,
|
|
info: widgetArea.description
|
|
})),
|
|
value: currentWidgetAreaId,
|
|
onSelect: value => {
|
|
onSelect(value);
|
|
onClose();
|
|
}
|
|
})))));
|
|
}
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/components/index.js
|
|
|
|
|
|
// EXTERNAL MODULE: external ["wp","data"]
|
|
var external_wp_data_ = __webpack_require__("1ZqX");
|
|
|
|
// EXTERNAL MODULE: external ["wp","coreData"]
|
|
var external_wp_coreData_ = __webpack_require__("jZUy");
|
|
|
|
// EXTERNAL MODULE: external ["wp","blocks"]
|
|
var external_wp_blocks_ = __webpack_require__("HSyU");
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/register-legacy-widget-variations.js
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
|
|
|
|
function registerLegacyWidgetVariations(settings) {
|
|
const unsubscribe = Object(external_wp_data_["subscribe"])(() => {
|
|
var _settings$widgetTypes, _select$getWidgetType;
|
|
|
|
const hiddenIds = (_settings$widgetTypes = settings === null || settings === void 0 ? void 0 : settings.widgetTypesToHideFromLegacyWidgetBlock) !== null && _settings$widgetTypes !== void 0 ? _settings$widgetTypes : [];
|
|
const widgetTypes = (_select$getWidgetType = Object(external_wp_data_["select"])(external_wp_coreData_["store"]).getWidgetTypes({
|
|
per_page: -1
|
|
})) === null || _select$getWidgetType === void 0 ? void 0 : _select$getWidgetType.filter(widgetType => !hiddenIds.includes(widgetType.id));
|
|
|
|
if (widgetTypes) {
|
|
unsubscribe();
|
|
Object(external_wp_data_["dispatch"])(external_wp_blocks_["store"]).addBlockVariations('core/legacy-widget', widgetTypes.map(widgetType => ({
|
|
name: widgetType.id,
|
|
title: widgetType.name,
|
|
description: widgetType.description,
|
|
attributes: widgetType.is_multi ? {
|
|
idBase: widgetType.id,
|
|
instance: {}
|
|
} : {
|
|
id: widgetType.id
|
|
}
|
|
})));
|
|
}
|
|
});
|
|
}
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/utils.js
|
|
// @ts-check
|
|
|
|
/**
|
|
* Get the internal widget id from block.
|
|
*
|
|
* @typedef {Object} Attributes
|
|
* @property {string} __internalWidgetId The internal widget id.
|
|
* @typedef {Object} Block
|
|
* @property {Attributes} attributes The attributes of the block.
|
|
*
|
|
* @param {Block} block The block.
|
|
* @return {string} The internal widget id.
|
|
*/
|
|
function getWidgetIdFromBlock(block) {
|
|
return block.attributes.__internalWidgetId;
|
|
}
|
|
/**
|
|
* Add internal widget id to block's attributes.
|
|
*
|
|
* @param {Block} block The block.
|
|
* @param {string} widgetId The widget id.
|
|
* @return {Block} The updated block.
|
|
*/
|
|
|
|
function addWidgetIdToBlock(block, widgetId) {
|
|
return { ...block,
|
|
attributes: { ...(block.attributes || {}),
|
|
__internalWidgetId: widgetId
|
|
}
|
|
};
|
|
}
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/index.js
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "GRId":
|
|
/***/ (function(module, exports) {
|
|
|
|
(function() { module.exports = window["wp"]["element"]; }());
|
|
|
|
/***/ }),
|
|
|
|
/***/ "HSyU":
|
|
/***/ (function(module, exports) {
|
|
|
|
(function() { module.exports = window["wp"]["blocks"]; }());
|
|
|
|
/***/ }),
|
|
|
|
/***/ "Tqx9":
|
|
/***/ (function(module, exports) {
|
|
|
|
(function() { module.exports = window["wp"]["primitives"]; }());
|
|
|
|
/***/ }),
|
|
|
|
/***/ "jZUy":
|
|
/***/ (function(module, exports) {
|
|
|
|
(function() { module.exports = window["wp"]["coreData"]; }());
|
|
|
|
/***/ }),
|
|
|
|
/***/ "l3Sj":
|
|
/***/ (function(module, exports) {
|
|
|
|
(function() { module.exports = window["wp"]["i18n"]; }());
|
|
|
|
/***/ }),
|
|
|
|
/***/ "tI+e":
|
|
/***/ (function(module, exports) {
|
|
|
|
(function() { module.exports = window["wp"]["components"]; }());
|
|
|
|
/***/ })
|
|
|
|
/******/ }); |