[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 this["wp"] = this["wp"] || {}; this["wp"]["listReusableBlocks"] = 2 /******/ (function(modules) { // webpackBootstrap 3 /******/ // The module cache 4 /******/ var installedModules = {}; 5 /******/ 6 /******/ // The require function 7 /******/ function __webpack_require__(moduleId) { 8 /******/ 9 /******/ // Check if module is in cache 10 /******/ if(installedModules[moduleId]) { 11 /******/ return installedModules[moduleId].exports; 12 /******/ } 13 /******/ // Create a new module (and put it into the cache) 14 /******/ var module = installedModules[moduleId] = { 15 /******/ i: moduleId, 16 /******/ l: false, 17 /******/ exports: {} 18 /******/ }; 19 /******/ 20 /******/ // Execute the module function 21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 /******/ 23 /******/ // Flag the module as loaded 24 /******/ module.l = true; 25 /******/ 26 /******/ // Return the exports of the module 27 /******/ return module.exports; 28 /******/ } 29 /******/ 30 /******/ 31 /******/ // expose the modules object (__webpack_modules__) 32 /******/ __webpack_require__.m = modules; 33 /******/ 34 /******/ // expose the module cache 35 /******/ __webpack_require__.c = installedModules; 36 /******/ 37 /******/ // define getter function for harmony exports 38 /******/ __webpack_require__.d = function(exports, name, getter) { 39 /******/ if(!__webpack_require__.o(exports, name)) { 40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 /******/ } 42 /******/ }; 43 /******/ 44 /******/ // define __esModule on exports 45 /******/ __webpack_require__.r = function(exports) { 46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 /******/ } 49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 /******/ }; 51 /******/ 52 /******/ // create a fake namespace object 53 /******/ // mode & 1: value is a module id, require it 54 /******/ // mode & 2: merge all properties of value into the ns 55 /******/ // mode & 4: return value when already ns object 56 /******/ // mode & 8|1: behave like require 57 /******/ __webpack_require__.t = function(value, mode) { 58 /******/ if(mode & 1) value = __webpack_require__(value); 59 /******/ if(mode & 8) return value; 60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 /******/ var ns = Object.create(null); 62 /******/ __webpack_require__.r(ns); 63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 /******/ return ns; 66 /******/ }; 67 /******/ 68 /******/ // getDefaultExport function for compatibility with non-harmony modules 69 /******/ __webpack_require__.n = function(module) { 70 /******/ var getter = module && module.__esModule ? 71 /******/ function getDefault() { return module['default']; } : 72 /******/ function getModuleExports() { return module; }; 73 /******/ __webpack_require__.d(getter, 'a', getter); 74 /******/ return getter; 75 /******/ }; 76 /******/ 77 /******/ // Object.prototype.hasOwnProperty.call 78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 /******/ 80 /******/ // __webpack_public_path__ 81 /******/ __webpack_require__.p = ""; 82 /******/ 83 /******/ 84 /******/ // Load entry module and return exports 85 /******/ return __webpack_require__(__webpack_require__.s = "./node_modules/@wordpress/list-reusable-blocks/build-module/index.js"); 86 /******/ }) 87 /************************************************************************/ 88 /******/ ({ 89 90 /***/ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js": 91 /*!**************************************************************************!*\ 92 !*** ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js ***! 93 \**************************************************************************/ 94 /*! exports provided: default */ 95 /***/ (function(module, __webpack_exports__, __webpack_require__) { 96 97 "use strict"; 98 __webpack_require__.r(__webpack_exports__); 99 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _assertThisInitialized; }); 100 function _assertThisInitialized(self) { 101 if (self === void 0) { 102 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 103 } 104 105 return self; 106 } 107 108 /***/ }), 109 110 /***/ "./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js": 111 /*!*********************************************************************!*\ 112 !*** ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js ***! 113 \*********************************************************************/ 114 /*! exports provided: default */ 115 /***/ (function(module, __webpack_exports__, __webpack_require__) { 116 117 "use strict"; 118 __webpack_require__.r(__webpack_exports__); 119 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _asyncToGenerator; }); 120 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { 121 try { 122 var info = gen[key](arg); 123 var value = info.value; 124 } catch (error) { 125 reject(error); 126 return; 127 } 128 129 if (info.done) { 130 resolve(value); 131 } else { 132 Promise.resolve(value).then(_next, _throw); 133 } 134 } 135 136 function _asyncToGenerator(fn) { 137 return function () { 138 var self = this, 139 args = arguments; 140 return new Promise(function (resolve, reject) { 141 var gen = fn.apply(self, args); 142 143 function _next(value) { 144 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); 145 } 146 147 function _throw(err) { 148 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); 149 } 150 151 _next(undefined); 152 }); 153 }; 154 } 155 156 /***/ }), 157 158 /***/ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js": 159 /*!*******************************************************************!*\ 160 !*** ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***! 161 \*******************************************************************/ 162 /*! exports provided: default */ 163 /***/ (function(module, __webpack_exports__, __webpack_require__) { 164 165 "use strict"; 166 __webpack_require__.r(__webpack_exports__); 167 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _classCallCheck; }); 168 function _classCallCheck(instance, Constructor) { 169 if (!(instance instanceof Constructor)) { 170 throw new TypeError("Cannot call a class as a function"); 171 } 172 } 173 174 /***/ }), 175 176 /***/ "./node_modules/@babel/runtime/helpers/esm/createClass.js": 177 /*!****************************************************************!*\ 178 !*** ./node_modules/@babel/runtime/helpers/esm/createClass.js ***! 179 \****************************************************************/ 180 /*! exports provided: default */ 181 /***/ (function(module, __webpack_exports__, __webpack_require__) { 182 183 "use strict"; 184 __webpack_require__.r(__webpack_exports__); 185 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _createClass; }); 186 function _defineProperties(target, props) { 187 for (var i = 0; i < props.length; i++) { 188 var descriptor = props[i]; 189 descriptor.enumerable = descriptor.enumerable || false; 190 descriptor.configurable = true; 191 if ("value" in descriptor) descriptor.writable = true; 192 Object.defineProperty(target, descriptor.key, descriptor); 193 } 194 } 195 196 function _createClass(Constructor, protoProps, staticProps) { 197 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 198 if (staticProps) _defineProperties(Constructor, staticProps); 199 return Constructor; 200 } 201 202 /***/ }), 203 204 /***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js": 205 /*!*******************************************************************!*\ 206 !*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***! 207 \*******************************************************************/ 208 /*! exports provided: default */ 209 /***/ (function(module, __webpack_exports__, __webpack_require__) { 210 211 "use strict"; 212 __webpack_require__.r(__webpack_exports__); 213 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _defineProperty; }); 214 function _defineProperty(obj, key, value) { 215 if (key in obj) { 216 Object.defineProperty(obj, key, { 217 value: value, 218 enumerable: true, 219 configurable: true, 220 writable: true 221 }); 222 } else { 223 obj[key] = value; 224 } 225 226 return obj; 227 } 228 229 /***/ }), 230 231 /***/ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js": 232 /*!*******************************************************************!*\ 233 !*** ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js ***! 234 \*******************************************************************/ 235 /*! exports provided: default */ 236 /***/ (function(module, __webpack_exports__, __webpack_require__) { 237 238 "use strict"; 239 __webpack_require__.r(__webpack_exports__); 240 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _getPrototypeOf; }); 241 function _getPrototypeOf(o) { 242 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { 243 return o.__proto__ || Object.getPrototypeOf(o); 244 }; 245 return _getPrototypeOf(o); 246 } 247 248 /***/ }), 249 250 /***/ "./node_modules/@babel/runtime/helpers/esm/inherits.js": 251 /*!*************************************************************!*\ 252 !*** ./node_modules/@babel/runtime/helpers/esm/inherits.js ***! 253 \*************************************************************/ 254 /*! exports provided: default */ 255 /***/ (function(module, __webpack_exports__, __webpack_require__) { 256 257 "use strict"; 258 __webpack_require__.r(__webpack_exports__); 259 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _inherits; }); 260 /* harmony import */ var _setPrototypeOf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js"); 261 262 function _inherits(subClass, superClass) { 263 if (typeof superClass !== "function" && superClass !== null) { 264 throw new TypeError("Super expression must either be null or a function"); 265 } 266 267 subClass.prototype = Object.create(superClass && superClass.prototype, { 268 constructor: { 269 value: subClass, 270 writable: true, 271 configurable: true 272 } 273 }); 274 if (superClass) Object(_setPrototypeOf__WEBPACK_IMPORTED_MODULE_0__["default"])(subClass, superClass); 275 } 276 277 /***/ }), 278 279 /***/ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js": 280 /*!*****************************************************************!*\ 281 !*** ./node_modules/@babel/runtime/helpers/esm/objectSpread.js ***! 282 \*****************************************************************/ 283 /*! exports provided: default */ 284 /***/ (function(module, __webpack_exports__, __webpack_require__) { 285 286 "use strict"; 287 __webpack_require__.r(__webpack_exports__); 288 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _objectSpread; }); 289 /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js"); 290 291 function _objectSpread(target) { 292 for (var i = 1; i < arguments.length; i++) { 293 var source = arguments[i] != null ? arguments[i] : {}; 294 var ownKeys = Object.keys(source); 295 296 if (typeof Object.getOwnPropertySymbols === 'function') { 297 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { 298 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 299 })); 300 } 301 302 ownKeys.forEach(function (key) { 303 Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(target, key, source[key]); 304 }); 305 } 306 307 return target; 308 } 309 310 /***/ }), 311 312 /***/ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js": 313 /*!******************************************************************************!*\ 314 !*** ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js ***! 315 \******************************************************************************/ 316 /*! exports provided: default */ 317 /***/ (function(module, __webpack_exports__, __webpack_require__) { 318 319 "use strict"; 320 __webpack_require__.r(__webpack_exports__); 321 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _possibleConstructorReturn; }); 322 /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../helpers/esm/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js"); 323 /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assertThisInitialized */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js"); 324 325 326 function _possibleConstructorReturn(self, call) { 327 if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(call) === "object" || typeof call === "function")) { 328 return call; 329 } 330 331 return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__["default"])(self); 332 } 333 334 /***/ }), 335 336 /***/ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js": 337 /*!*******************************************************************!*\ 338 !*** ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***! 339 \*******************************************************************/ 340 /*! exports provided: default */ 341 /***/ (function(module, __webpack_exports__, __webpack_require__) { 342 343 "use strict"; 344 __webpack_require__.r(__webpack_exports__); 345 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _setPrototypeOf; }); 346 function _setPrototypeOf(o, p) { 347 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { 348 o.__proto__ = p; 349 return o; 350 }; 351 352 return _setPrototypeOf(o, p); 353 } 354 355 /***/ }), 356 357 /***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js": 358 /*!***********************************************************!*\ 359 !*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***! 360 \***********************************************************/ 361 /*! exports provided: default */ 362 /***/ (function(module, __webpack_exports__, __webpack_require__) { 363 364 "use strict"; 365 __webpack_require__.r(__webpack_exports__); 366 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _typeof; }); 367 function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); } 368 369 function _typeof(obj) { 370 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { 371 _typeof = function _typeof(obj) { 372 return _typeof2(obj); 373 }; 374 } else { 375 _typeof = function _typeof(obj) { 376 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); 377 }; 378 } 379 380 return _typeof(obj); 381 } 382 383 /***/ }), 384 385 /***/ "./node_modules/@wordpress/list-reusable-blocks/build-module/components/import-dropdown/index.js": 386 /*!*******************************************************************************************************!*\ 387 !*** ./node_modules/@wordpress/list-reusable-blocks/build-module/components/import-dropdown/index.js ***! 388 \*******************************************************************************************************/ 389 /*! exports provided: default */ 390 /***/ (function(module, __webpack_exports__, __webpack_require__) { 391 392 "use strict"; 393 __webpack_require__.r(__webpack_exports__); 394 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 395 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 396 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "lodash"); 397 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); 398 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 399 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); 400 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); 401 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); 402 /* harmony import */ var _import_form__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../import-form */ "./node_modules/@wordpress/list-reusable-blocks/build-module/components/import-form/index.js"); 403 404 405 /** 406 * External dependencies 407 */ 408 409 /** 410 * WordPress dependencies 411 */ 412 413 414 415 /** 416 * Internal dependencies 417 */ 418 419 420 421 function ImportDropdown(_ref) { 422 var onUpload = _ref.onUpload; 423 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["Dropdown"], { 424 position: "bottom right", 425 contentClassName: "list-reusable-blocks-import-dropdown__content", 426 renderToggle: function renderToggle(_ref2) { 427 var isOpen = _ref2.isOpen, 428 onToggle = _ref2.onToggle; 429 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["Button"], { 430 type: "button", 431 "aria-expanded": isOpen, 432 onClick: onToggle, 433 isPrimary: true 434 }, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Import from JSON')); 435 }, 436 renderContent: function renderContent(_ref3) { 437 var onClose = _ref3.onClose; 438 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_import_form__WEBPACK_IMPORTED_MODULE_4__["default"], { 439 onUpload: Object(lodash__WEBPACK_IMPORTED_MODULE_1__["flow"])(onClose, onUpload) 440 }); 441 } 442 }); 443 } 444 445 /* harmony default export */ __webpack_exports__["default"] = (ImportDropdown); 446 447 448 /***/ }), 449 450 /***/ "./node_modules/@wordpress/list-reusable-blocks/build-module/components/import-form/index.js": 451 /*!***************************************************************************************************!*\ 452 !*** ./node_modules/@wordpress/list-reusable-blocks/build-module/components/import-form/index.js ***! 453 \***************************************************************************************************/ 454 /*! exports provided: default */ 455 /***/ (function(module, __webpack_exports__, __webpack_require__) { 456 457 "use strict"; 458 __webpack_require__.r(__webpack_exports__); 459 /* 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"); 460 /* 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"); 461 /* 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"); 462 /* 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"); 463 /* 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"); 464 /* 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"); 465 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 466 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__); 467 /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose"); 468 /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_7__); 469 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 470 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__); 471 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); 472 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__); 473 /* harmony import */ var _utils_import__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../utils/import */ "./node_modules/@wordpress/list-reusable-blocks/build-module/utils/import.js"); 474 475 476 477 478 479 480 481 482 /** 483 * WordPress dependencies 484 */ 485 486 487 488 489 /** 490 * Internal dependencies 491 */ 492 493 494 495 var ImportForm = 496 /*#__PURE__*/ 497 function (_Component) { 498 Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(ImportForm, _Component); 499 500 function ImportForm() { 501 var _this; 502 503 Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, ImportForm); 504 505 _this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(ImportForm).apply(this, arguments)); 506 _this.state = { 507 isLoading: false, 508 error: null, 509 file: null 510 }; 511 _this.isStillMounted = true; 512 _this.onChangeFile = _this.onChangeFile.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this))); 513 _this.onSubmit = _this.onSubmit.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this))); 514 return _this; 515 } 516 517 Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(ImportForm, [{ 518 key: "componentWillUnmount", 519 value: function componentWillUnmount() { 520 this.isStillMounted = false; 521 } 522 }, { 523 key: "onChangeFile", 524 value: function onChangeFile(event) { 525 this.setState({ 526 file: event.target.files[0] 527 }); 528 } 529 }, { 530 key: "onSubmit", 531 value: function onSubmit(event) { 532 var _this2 = this; 533 534 event.preventDefault(); 535 var file = this.state.file; 536 var onUpload = this.props.onUpload; 537 538 if (!file) { 539 return; 540 } 541 542 this.setState({ 543 isLoading: true 544 }); 545 Object(_utils_import__WEBPACK_IMPORTED_MODULE_10__["default"])(file).then(function (reusableBlock) { 546 if (!_this2.isStillMounted) { 547 return; 548 } 549 550 _this2.setState({ 551 isLoading: false 552 }); 553 554 onUpload(reusableBlock); 555 }).catch(function (error) { 556 if (!_this2.isStillMounted) { 557 return; 558 } 559 560 var uiMessage; 561 562 switch (error.message) { 563 case 'Invalid JSON file': 564 uiMessage = Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Invalid JSON file'); 565 break; 566 567 case 'Invalid Reusable Block JSON file': 568 uiMessage = Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Invalid Reusable Block JSON file'); 569 break; 570 571 default: 572 uiMessage = Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Unknown error'); 573 } 574 575 _this2.setState({ 576 isLoading: false, 577 error: uiMessage 578 }); 579 }); 580 } 581 }, { 582 key: "render", 583 value: function render() { 584 var instanceId = this.props.instanceId; 585 var _this$state = this.state, 586 file = _this$state.file, 587 isLoading = _this$state.isLoading, 588 error = _this$state.error; 589 var inputId = 'list-reusable-blocks-import-form-' + instanceId; 590 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])("form", { 591 className: "list-reusable-blocks-import-form", 592 onSubmit: this.onSubmit 593 }, error && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__["Notice"], { 594 status: "error" 595 }, error), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])("label", { 596 htmlFor: inputId, 597 className: "list-reusable-blocks-import-form__label" 598 }, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('File')), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])("input", { 599 id: inputId, 600 type: "file", 601 onChange: this.onChangeFile 602 }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__["Button"], { 603 type: "submit", 604 isBusy: isLoading, 605 disabled: !file || isLoading, 606 isDefault: true, 607 className: "list-reusable-blocks-import-form__button" 608 }, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Import'))); 609 } 610 }]); 611 612 return ImportForm; 613 }(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["Component"]); 614 615 /* harmony default export */ __webpack_exports__["default"] = (Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_7__["withInstanceId"])(ImportForm)); 616 617 618 /***/ }), 619 620 /***/ "./node_modules/@wordpress/list-reusable-blocks/build-module/index.js": 621 /*!****************************************************************************!*\ 622 !*** ./node_modules/@wordpress/list-reusable-blocks/build-module/index.js ***! 623 \****************************************************************************/ 624 /*! no exports provided */ 625 /***/ (function(module, __webpack_exports__, __webpack_require__) { 626 627 "use strict"; 628 __webpack_require__.r(__webpack_exports__); 629 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 630 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 631 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 632 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); 633 /* harmony import */ var _utils_export__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/export */ "./node_modules/@wordpress/list-reusable-blocks/build-module/utils/export.js"); 634 /* harmony import */ var _components_import_dropdown__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/import-dropdown */ "./node_modules/@wordpress/list-reusable-blocks/build-module/components/import-dropdown/index.js"); 635 636 637 /** 638 * WordPress dependencies 639 */ 640 641 642 /** 643 * Internal dependencies 644 */ 645 646 647 // Setup Export Links 648 649 document.body.addEventListener('click', function (event) { 650 if (!event.target.classList.contains('wp-list-reusable-blocks__export')) { 651 return; 652 } 653 654 event.preventDefault(); 655 Object(_utils_export__WEBPACK_IMPORTED_MODULE_2__["default"])(event.target.dataset.id); 656 }); // Setup Import Form 657 658 document.addEventListener('DOMContentLoaded', function () { 659 var button = document.querySelector('.page-title-action'); 660 661 if (!button) { 662 return; 663 } 664 665 var showNotice = function showNotice() { 666 var notice = document.createElement('div'); 667 notice.className = 'notice notice-success is-dismissible'; 668 notice.innerHTML = "<p>".concat(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Reusable block imported successfully!'), "</p>"); 669 var headerEnd = document.querySelector('.wp-header-end'); 670 671 if (!headerEnd) { 672 return; 673 } 674 675 headerEnd.parentNode.insertBefore(notice, headerEnd); 676 }; 677 678 var container = document.createElement('div'); 679 container.className = 'list-reusable-blocks__container'; 680 button.parentNode.insertBefore(container, button); 681 Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["render"])(Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_components_import_dropdown__WEBPACK_IMPORTED_MODULE_3__["default"], { 682 onUpload: showNotice 683 }), container); 684 }); 685 686 687 /***/ }), 688 689 /***/ "./node_modules/@wordpress/list-reusable-blocks/build-module/utils/export.js": 690 /*!***********************************************************************************!*\ 691 !*** ./node_modules/@wordpress/list-reusable-blocks/build-module/utils/export.js ***! 692 \***********************************************************************************/ 693 /*! exports provided: default */ 694 /***/ (function(module, __webpack_exports__, __webpack_require__) { 695 696 "use strict"; 697 __webpack_require__.r(__webpack_exports__); 698 /* 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"); 699 /* 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"); 700 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ "lodash"); 701 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__); 702 /* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); 703 /* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_3__); 704 /* harmony import */ var _file__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./file */ "./node_modules/@wordpress/list-reusable-blocks/build-module/utils/file.js"); 705 706 707 708 /** 709 * External dependencies 710 */ 711 712 /** 713 * WordPress dependencies 714 */ 715 716 717 /** 718 * Internal dependencies 719 */ 720 721 722 /** 723 * Export a reusable block as a JSON file. 724 * 725 * @param {number} id 726 */ 727 728 function exportReusableBlock(_x) { 729 return _exportReusableBlock.apply(this, arguments); 730 } 731 732 function _exportReusableBlock() { 733 _exportReusableBlock = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_1__["default"])( 734 /*#__PURE__*/ 735 regeneratorRuntime.mark(function _callee(id) { 736 var postType, reusableBlock, fileContent, fileName; 737 return regeneratorRuntime.wrap(function _callee$(_context) { 738 while (1) { 739 switch (_context.prev = _context.next) { 740 case 0: 741 _context.next = 2; 742 return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_3___default()({ 743 path: "/wp/v2/types/wp_block" 744 }); 745 746 case 2: 747 postType = _context.sent; 748 _context.next = 5; 749 return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_3___default()({ 750 path: "/wp/v2/".concat(postType.rest_base, "/").concat(id) 751 }); 752 753 case 5: 754 reusableBlock = _context.sent; 755 fileContent = JSON.stringify(Object(_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_0__["default"])({ 756 __file: 'wp_block' 757 }, Object(lodash__WEBPACK_IMPORTED_MODULE_2__["pick"])(reusableBlock, ['title', 'content'])), null, 2); 758 fileName = Object(lodash__WEBPACK_IMPORTED_MODULE_2__["kebabCase"])(reusableBlock.title) + '.json'; 759 Object(_file__WEBPACK_IMPORTED_MODULE_4__["download"])(fileName, fileContent, 'application/json'); 760 761 case 9: 762 case "end": 763 return _context.stop(); 764 } 765 } 766 }, _callee, this); 767 })); 768 return _exportReusableBlock.apply(this, arguments); 769 } 770 771 /* harmony default export */ __webpack_exports__["default"] = (exportReusableBlock); 772 773 774 /***/ }), 775 776 /***/ "./node_modules/@wordpress/list-reusable-blocks/build-module/utils/file.js": 777 /*!*********************************************************************************!*\ 778 !*** ./node_modules/@wordpress/list-reusable-blocks/build-module/utils/file.js ***! 779 \*********************************************************************************/ 780 /*! exports provided: download, readTextFile */ 781 /***/ (function(module, __webpack_exports__, __webpack_require__) { 782 783 "use strict"; 784 __webpack_require__.r(__webpack_exports__); 785 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "download", function() { return download; }); 786 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readTextFile", function() { return readTextFile; }); 787 /** 788 * Downloads a file. 789 * 790 * @param {string} fileName File Name. 791 * @param {string} content File Content. 792 * @param {string} contentType File mime type. 793 */ 794 function download(fileName, content, contentType) { 795 var file = new window.Blob([content], { 796 type: contentType 797 }); // IE11 can't use the click to download technique 798 // we use a specific IE11 technique instead. 799 800 if (window.navigator.msSaveOrOpenBlob) { 801 window.navigator.msSaveOrOpenBlob(file, fileName); 802 } else { 803 var a = document.createElement('a'); 804 a.href = URL.createObjectURL(file); 805 a.download = fileName; 806 a.style.display = 'none'; 807 document.body.appendChild(a); 808 a.click(); 809 document.body.removeChild(a); 810 } 811 } 812 /** 813 * Reads the textual content of the given file. 814 * 815 * @param {File} file File. 816 * @return {Promise<string>} Content of the file. 817 */ 818 819 function readTextFile(file) { 820 var reader = new window.FileReader(); 821 return new Promise(function (resolve) { 822 reader.onload = function () { 823 resolve(reader.result); 824 }; 825 826 reader.readAsText(file); 827 }); 828 } 829 830 831 /***/ }), 832 833 /***/ "./node_modules/@wordpress/list-reusable-blocks/build-module/utils/import.js": 834 /*!***********************************************************************************!*\ 835 !*** ./node_modules/@wordpress/list-reusable-blocks/build-module/utils/import.js ***! 836 \***********************************************************************************/ 837 /*! exports provided: default */ 838 /***/ (function(module, __webpack_exports__, __webpack_require__) { 839 840 "use strict"; 841 __webpack_require__.r(__webpack_exports__); 842 /* 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"); 843 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "lodash"); 844 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__); 845 /* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); 846 /* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2__); 847 /* harmony import */ var _file__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./file */ "./node_modules/@wordpress/list-reusable-blocks/build-module/utils/file.js"); 848 849 850 /** 851 * External dependencies 852 */ 853 854 /** 855 * WordPress dependencies 856 */ 857 858 859 /** 860 * Internal dependencies 861 */ 862 863 864 /** 865 * Import a reusable block from a JSON file. 866 * 867 * @param {File} file File. 868 * @return {Promise} Promise returning the imported reusable block. 869 */ 870 871 function importReusableBlock(_x) { 872 return _importReusableBlock.apply(this, arguments); 873 } 874 875 function _importReusableBlock() { 876 _importReusableBlock = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__["default"])( 877 /*#__PURE__*/ 878 regeneratorRuntime.mark(function _callee(file) { 879 var fileContent, parsedContent, postType, reusableBlock; 880 return regeneratorRuntime.wrap(function _callee$(_context) { 881 while (1) { 882 switch (_context.prev = _context.next) { 883 case 0: 884 _context.next = 2; 885 return Object(_file__WEBPACK_IMPORTED_MODULE_3__["readTextFile"])(file); 886 887 case 2: 888 fileContent = _context.sent; 889 _context.prev = 3; 890 parsedContent = JSON.parse(fileContent); 891 _context.next = 10; 892 break; 893 894 case 7: 895 _context.prev = 7; 896 _context.t0 = _context["catch"](3); 897 throw new Error('Invalid JSON file'); 898 899 case 10: 900 if (!(parsedContent.__file !== 'wp_block' || !parsedContent.title || !parsedContent.content || !Object(lodash__WEBPACK_IMPORTED_MODULE_1__["isString"])(parsedContent.title) || !Object(lodash__WEBPACK_IMPORTED_MODULE_1__["isString"])(parsedContent.content))) { 901 _context.next = 12; 902 break; 903 } 904 905 throw new Error('Invalid Reusable Block JSON file'); 906 907 case 12: 908 _context.next = 14; 909 return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ 910 path: "/wp/v2/types/wp_block" 911 }); 912 913 case 14: 914 postType = _context.sent; 915 _context.next = 17; 916 return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_2___default()({ 917 path: "/wp/v2/".concat(postType.rest_base), 918 data: { 919 title: parsedContent.title, 920 content: parsedContent.content 921 }, 922 method: 'POST' 923 }); 924 925 case 17: 926 reusableBlock = _context.sent; 927 return _context.abrupt("return", reusableBlock); 928 929 case 19: 930 case "end": 931 return _context.stop(); 932 } 933 } 934 }, _callee, this, [[3, 7]]); 935 })); 936 return _importReusableBlock.apply(this, arguments); 937 } 938 939 /* harmony default export */ __webpack_exports__["default"] = (importReusableBlock); 940 941 942 /***/ }), 943 944 /***/ "@wordpress/api-fetch": 945 /*!*******************************************!*\ 946 !*** external {"this":["wp","apiFetch"]} ***! 947 \*******************************************/ 948 /*! no static exports found */ 949 /***/ (function(module, exports) { 950 951 (function() { module.exports = this["wp"]["apiFetch"]; }()); 952 953 /***/ }), 954 955 /***/ "@wordpress/components": 956 /*!*********************************************!*\ 957 !*** external {"this":["wp","components"]} ***! 958 \*********************************************/ 959 /*! no static exports found */ 960 /***/ (function(module, exports) { 961 962 (function() { module.exports = this["wp"]["components"]; }()); 963 964 /***/ }), 965 966 /***/ "@wordpress/compose": 967 /*!******************************************!*\ 968 !*** external {"this":["wp","compose"]} ***! 969 \******************************************/ 970 /*! no static exports found */ 971 /***/ (function(module, exports) { 972 973 (function() { module.exports = this["wp"]["compose"]; }()); 974 975 /***/ }), 976 977 /***/ "@wordpress/element": 978 /*!******************************************!*\ 979 !*** external {"this":["wp","element"]} ***! 980 \******************************************/ 981 /*! no static exports found */ 982 /***/ (function(module, exports) { 983 984 (function() { module.exports = this["wp"]["element"]; }()); 985 986 /***/ }), 987 988 /***/ "@wordpress/i18n": 989 /*!***************************************!*\ 990 !*** external {"this":["wp","i18n"]} ***! 991 \***************************************/ 992 /*! no static exports found */ 993 /***/ (function(module, exports) { 994 995 (function() { module.exports = this["wp"]["i18n"]; }()); 996 997 /***/ }), 998 999 /***/ "lodash": 1000 /*!*************************!*\ 1001 !*** external "lodash" ***! 1002 \*************************/ 1003 /*! no static exports found */ 1004 /***/ (function(module, exports) { 1005 1006 (function() { module.exports = this["lodash"]; }()); 1007 1008 /***/ }) 1009 1010 /******/ }); 1011 //# sourceMappingURL=list-reusable-blocks.js.map
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Jan 7 01:00:05 2019 | Cross-referenced by PHPXref 0.7.1 |