[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> list-reusable-blocks.js (source)

   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 = 439);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 0:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = this["wp"]["element"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 1:
  98  /***/ (function(module, exports) {
  99  
 100  (function() { module.exports = this["wp"]["i18n"]; }());
 101  
 102  /***/ }),
 103  
 104  /***/ 13:
 105  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 106  
 107  "use strict";
 108  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
 109  function _defineProperties(target, props) {
 110    for (var i = 0; i < props.length; i++) {
 111      var descriptor = props[i];
 112      descriptor.enumerable = descriptor.enumerable || false;
 113      descriptor.configurable = true;
 114      if ("value" in descriptor) descriptor.writable = true;
 115      Object.defineProperty(target, descriptor.key, descriptor);
 116    }
 117  }
 118  
 119  function _createClass(Constructor, protoProps, staticProps) {
 120    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
 121    if (staticProps) _defineProperties(Constructor, staticProps);
 122    return Constructor;
 123  }
 124  
 125  /***/ }),
 126  
 127  /***/ 14:
 128  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 129  
 130  "use strict";
 131  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
 132  function _classCallCheck(instance, Constructor) {
 133    if (!(instance instanceof Constructor)) {
 134      throw new TypeError("Cannot call a class as a function");
 135    }
 136  }
 137  
 138  /***/ }),
 139  
 140  /***/ 15:
 141  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 142  
 143  "use strict";
 144  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
 145  /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(34);
 146  /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7);
 147  
 148  
 149  function _possibleConstructorReturn(self, call) {
 150    if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) {
 151      return call;
 152    }
 153  
 154    return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self);
 155  }
 156  
 157  /***/ }),
 158  
 159  /***/ 16:
 160  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 161  
 162  "use strict";
 163  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
 164  function _getPrototypeOf(o) {
 165    _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
 166      return o.__proto__ || Object.getPrototypeOf(o);
 167    };
 168    return _getPrototypeOf(o);
 169  }
 170  
 171  /***/ }),
 172  
 173  /***/ 17:
 174  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 175  
 176  "use strict";
 177  
 178  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
 179  function _setPrototypeOf(o, p) {
 180    _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
 181      o.__proto__ = p;
 182      return o;
 183    };
 184  
 185    return _setPrototypeOf(o, p);
 186  }
 187  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
 188  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; });
 189  
 190  function _inherits(subClass, superClass) {
 191    if (typeof superClass !== "function" && superClass !== null) {
 192      throw new TypeError("Super expression must either be null or a function");
 193    }
 194  
 195    subClass.prototype = Object.create(superClass && superClass.prototype, {
 196      constructor: {
 197        value: subClass,
 198        writable: true,
 199        configurable: true
 200      }
 201    });
 202    if (superClass) _setPrototypeOf(subClass, superClass);
 203  }
 204  
 205  /***/ }),
 206  
 207  /***/ 2:
 208  /***/ (function(module, exports) {
 209  
 210  (function() { module.exports = this["lodash"]; }());
 211  
 212  /***/ }),
 213  
 214  /***/ 23:
 215  /***/ (function(module, exports) {
 216  
 217  (function() { module.exports = this["regeneratorRuntime"]; }());
 218  
 219  /***/ }),
 220  
 221  /***/ 3:
 222  /***/ (function(module, exports) {
 223  
 224  (function() { module.exports = this["wp"]["components"]; }());
 225  
 226  /***/ }),
 227  
 228  /***/ 34:
 229  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 230  
 231  "use strict";
 232  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
 233  function _typeof(obj) {
 234    "@babel/helpers - typeof";
 235  
 236    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
 237      _typeof = function _typeof(obj) {
 238        return typeof obj;
 239      };
 240    } else {
 241      _typeof = function _typeof(obj) {
 242        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
 243      };
 244    }
 245  
 246    return _typeof(obj);
 247  }
 248  
 249  /***/ }),
 250  
 251  /***/ 42:
 252  /***/ (function(module, exports) {
 253  
 254  (function() { module.exports = this["wp"]["apiFetch"]; }());
 255  
 256  /***/ }),
 257  
 258  /***/ 439:
 259  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 260  
 261  "use strict";
 262  __webpack_require__.r(__webpack_exports__);
 263  
 264  // EXTERNAL MODULE: external {"this":["wp","element"]}
 265  var external_this_wp_element_ = __webpack_require__(0);
 266  
 267  // EXTERNAL MODULE: external {"this":["wp","i18n"]}
 268  var external_this_wp_i18n_ = __webpack_require__(1);
 269  
 270  // EXTERNAL MODULE: external {"this":"regeneratorRuntime"}
 271  var external_this_regeneratorRuntime_ = __webpack_require__(23);
 272  var external_this_regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(external_this_regeneratorRuntime_);
 273  
 274  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
 275  var asyncToGenerator = __webpack_require__(49);
 276  
 277  // EXTERNAL MODULE: external {"this":"lodash"}
 278  var external_this_lodash_ = __webpack_require__(2);
 279  
 280  // EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
 281  var external_this_wp_apiFetch_ = __webpack_require__(42);
 282  var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
 283  
 284  // CONCATENATED MODULE: ./node_modules/@wordpress/list-reusable-blocks/build-module/utils/file.js
 285  /**
 286   * Downloads a file.
 287   *
 288   * @param {string} fileName    File Name.
 289   * @param {string} content     File Content.
 290   * @param {string} contentType File mime type.
 291   */
 292  function download(fileName, content, contentType) {
 293    var file = new window.Blob([content], {
 294      type: contentType
 295    }); // IE11 can't use the click to download technique
 296    // we use a specific IE11 technique instead.
 297  
 298    if (window.navigator.msSaveOrOpenBlob) {
 299      window.navigator.msSaveOrOpenBlob(file, fileName);
 300    } else {
 301      var a = document.createElement('a');
 302      a.href = URL.createObjectURL(file);
 303      a.download = fileName;
 304      a.style.display = 'none';
 305      document.body.appendChild(a);
 306      a.click();
 307      document.body.removeChild(a);
 308    }
 309  }
 310  /**
 311   * Reads the textual content of the given file.
 312   *
 313   * @param  {File} file        File.
 314   * @return {Promise<string>}  Content of the file.
 315   */
 316  
 317  function readTextFile(file) {
 318    var reader = new window.FileReader();
 319    return new Promise(function (resolve) {
 320      reader.onload = function () {
 321        resolve(reader.result);
 322      };
 323  
 324      reader.readAsText(file);
 325    });
 326  }
 327  
 328  // CONCATENATED MODULE: ./node_modules/@wordpress/list-reusable-blocks/build-module/utils/export.js
 329  
 330  
 331  
 332  /**
 333   * External dependencies
 334   */
 335  
 336  /**
 337   * WordPress dependencies
 338   */
 339  
 340  
 341  /**
 342   * Internal dependencies
 343   */
 344  
 345  
 346  /**
 347   * Export a reusable block as a JSON file.
 348   *
 349   * @param {number} id
 350   */
 351  
 352  function exportReusableBlock(_x) {
 353    return _exportReusableBlock.apply(this, arguments);
 354  }
 355  
 356  function _exportReusableBlock() {
 357    _exportReusableBlock = Object(asyncToGenerator["a" /* default */])(
 358    /*#__PURE__*/
 359    external_this_regeneratorRuntime_default.a.mark(function _callee(id) {
 360      var postType, post, title, content, fileContent, fileName;
 361      return external_this_regeneratorRuntime_default.a.wrap(function _callee$(_context) {
 362        while (1) {
 363          switch (_context.prev = _context.next) {
 364            case 0:
 365              _context.next = 2;
 366              return external_this_wp_apiFetch_default()({
 367                path: "/wp/v2/types/wp_block"
 368              });
 369  
 370            case 2:
 371              postType = _context.sent;
 372              _context.next = 5;
 373              return external_this_wp_apiFetch_default()({
 374                path: "/wp/v2/".concat(postType.rest_base, "/").concat(id, "?context=edit")
 375              });
 376  
 377            case 5:
 378              post = _context.sent;
 379              title = post.title.raw;
 380              content = post.content.raw;
 381              fileContent = JSON.stringify({
 382                __file: 'wp_block',
 383                title: title,
 384                content: content
 385              }, null, 2);
 386              fileName = Object(external_this_lodash_["kebabCase"])(title) + '.json';
 387              download(fileName, fileContent, 'application/json');
 388  
 389            case 11:
 390            case "end":
 391              return _context.stop();
 392          }
 393        }
 394      }, _callee);
 395    }));
 396    return _exportReusableBlock.apply(this, arguments);
 397  }
 398  
 399  /* harmony default export */ var utils_export = (exportReusableBlock);
 400  
 401  // EXTERNAL MODULE: external {"this":["wp","components"]}
 402  var external_this_wp_components_ = __webpack_require__(3);
 403  
 404  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
 405  var classCallCheck = __webpack_require__(14);
 406  
 407  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
 408  var createClass = __webpack_require__(13);
 409  
 410  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
 411  var possibleConstructorReturn = __webpack_require__(15);
 412  
 413  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
 414  var getPrototypeOf = __webpack_require__(16);
 415  
 416  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
 417  var assertThisInitialized = __webpack_require__(7);
 418  
 419  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
 420  var inherits = __webpack_require__(17);
 421  
 422  // EXTERNAL MODULE: external {"this":["wp","compose"]}
 423  var external_this_wp_compose_ = __webpack_require__(8);
 424  
 425  // CONCATENATED MODULE: ./node_modules/@wordpress/list-reusable-blocks/build-module/utils/import.js
 426  
 427  
 428  
 429  /**
 430   * External dependencies
 431   */
 432  
 433  /**
 434   * WordPress dependencies
 435   */
 436  
 437  
 438  /**
 439   * Internal dependencies
 440   */
 441  
 442  
 443  /**
 444   * Import a reusable block from a JSON file.
 445   *
 446   * @param {File}     file File.
 447   * @return {Promise} Promise returning the imported reusable block.
 448   */
 449  
 450  function importReusableBlock(_x) {
 451    return _importReusableBlock.apply(this, arguments);
 452  }
 453  
 454  function _importReusableBlock() {
 455    _importReusableBlock = Object(asyncToGenerator["a" /* default */])(
 456    /*#__PURE__*/
 457    external_this_regeneratorRuntime_default.a.mark(function _callee(file) {
 458      var fileContent, parsedContent, postType, reusableBlock;
 459      return external_this_regeneratorRuntime_default.a.wrap(function _callee$(_context) {
 460        while (1) {
 461          switch (_context.prev = _context.next) {
 462            case 0:
 463              _context.next = 2;
 464              return readTextFile(file);
 465  
 466            case 2:
 467              fileContent = _context.sent;
 468              _context.prev = 3;
 469              parsedContent = JSON.parse(fileContent);
 470              _context.next = 10;
 471              break;
 472  
 473            case 7:
 474              _context.prev = 7;
 475              _context.t0 = _context["catch"](3);
 476              throw new Error('Invalid JSON file');
 477  
 478            case 10:
 479              if (!(parsedContent.__file !== 'wp_block' || !parsedContent.title || !parsedContent.content || !Object(external_this_lodash_["isString"])(parsedContent.title) || !Object(external_this_lodash_["isString"])(parsedContent.content))) {
 480                _context.next = 12;
 481                break;
 482              }
 483  
 484              throw new Error('Invalid Reusable Block JSON file');
 485  
 486            case 12:
 487              _context.next = 14;
 488              return external_this_wp_apiFetch_default()({
 489                path: "/wp/v2/types/wp_block"
 490              });
 491  
 492            case 14:
 493              postType = _context.sent;
 494              _context.next = 17;
 495              return external_this_wp_apiFetch_default()({
 496                path: "/wp/v2/".concat(postType.rest_base),
 497                data: {
 498                  title: parsedContent.title,
 499                  content: parsedContent.content,
 500                  status: 'publish'
 501                },
 502                method: 'POST'
 503              });
 504  
 505            case 17:
 506              reusableBlock = _context.sent;
 507              return _context.abrupt("return", reusableBlock);
 508  
 509            case 19:
 510            case "end":
 511              return _context.stop();
 512          }
 513        }
 514      }, _callee, null, [[3, 7]]);
 515    }));
 516    return _importReusableBlock.apply(this, arguments);
 517  }
 518  
 519  /* harmony default export */ var utils_import = (importReusableBlock);
 520  
 521  // CONCATENATED MODULE: ./node_modules/@wordpress/list-reusable-blocks/build-module/components/import-form/index.js
 522  
 523  
 524  
 525  
 526  
 527  
 528  
 529  
 530  /**
 531   * WordPress dependencies
 532   */
 533  
 534  
 535  
 536  
 537  /**
 538   * Internal dependencies
 539   */
 540  
 541  
 542  
 543  var import_form_ImportForm =
 544  /*#__PURE__*/
 545  function (_Component) {
 546    Object(inherits["a" /* default */])(ImportForm, _Component);
 547  
 548    function ImportForm() {
 549      var _this;
 550  
 551      Object(classCallCheck["a" /* default */])(this, ImportForm);
 552  
 553      _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(ImportForm).apply(this, arguments));
 554      _this.state = {
 555        isLoading: false,
 556        error: null,
 557        file: null
 558      };
 559      _this.isStillMounted = true;
 560      _this.onChangeFile = _this.onChangeFile.bind(Object(assertThisInitialized["a" /* default */])(_this));
 561      _this.onSubmit = _this.onSubmit.bind(Object(assertThisInitialized["a" /* default */])(_this));
 562      return _this;
 563    }
 564  
 565    Object(createClass["a" /* default */])(ImportForm, [{
 566      key: "componentWillUnmount",
 567      value: function componentWillUnmount() {
 568        this.isStillMounted = false;
 569      }
 570    }, {
 571      key: "onChangeFile",
 572      value: function onChangeFile(event) {
 573        this.setState({
 574          file: event.target.files[0]
 575        });
 576      }
 577    }, {
 578      key: "onSubmit",
 579      value: function onSubmit(event) {
 580        var _this2 = this;
 581  
 582        event.preventDefault();
 583        var file = this.state.file;
 584        var onUpload = this.props.onUpload;
 585  
 586        if (!file) {
 587          return;
 588        }
 589  
 590        this.setState({
 591          isLoading: true
 592        });
 593        utils_import(file).then(function (reusableBlock) {
 594          if (!_this2.isStillMounted) {
 595            return;
 596          }
 597  
 598          _this2.setState({
 599            isLoading: false
 600          });
 601  
 602          onUpload(reusableBlock);
 603        }).catch(function (error) {
 604          if (!_this2.isStillMounted) {
 605            return;
 606          }
 607  
 608          var uiMessage;
 609  
 610          switch (error.message) {
 611            case 'Invalid JSON file':
 612              uiMessage = Object(external_this_wp_i18n_["__"])('Invalid JSON file');
 613              break;
 614  
 615            case 'Invalid Reusable Block JSON file':
 616              uiMessage = Object(external_this_wp_i18n_["__"])('Invalid Reusable Block JSON file');
 617              break;
 618  
 619            default:
 620              uiMessage = Object(external_this_wp_i18n_["__"])('Unknown error');
 621          }
 622  
 623          _this2.setState({
 624            isLoading: false,
 625            error: uiMessage
 626          });
 627        });
 628      }
 629    }, {
 630      key: "render",
 631      value: function render() {
 632        var instanceId = this.props.instanceId;
 633        var _this$state = this.state,
 634            file = _this$state.file,
 635            isLoading = _this$state.isLoading,
 636            error = _this$state.error;
 637        var inputId = 'list-reusable-blocks-import-form-' + instanceId;
 638        return Object(external_this_wp_element_["createElement"])("form", {
 639          className: "list-reusable-blocks-import-form",
 640          onSubmit: this.onSubmit
 641        }, error && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Notice"], {
 642          status: "error"
 643        }, error), Object(external_this_wp_element_["createElement"])("label", {
 644          htmlFor: inputId,
 645          className: "list-reusable-blocks-import-form__label"
 646        }, Object(external_this_wp_i18n_["__"])('File')), Object(external_this_wp_element_["createElement"])("input", {
 647          id: inputId,
 648          type: "file",
 649          onChange: this.onChangeFile
 650        }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
 651          type: "submit",
 652          isBusy: isLoading,
 653          disabled: !file || isLoading,
 654          isSecondary: true,
 655          className: "list-reusable-blocks-import-form__button"
 656        }, Object(external_this_wp_i18n_["_x"])('Import', 'button label')));
 657      }
 658    }]);
 659  
 660    return ImportForm;
 661  }(external_this_wp_element_["Component"]);
 662  
 663  /* harmony default export */ var import_form = (Object(external_this_wp_compose_["withInstanceId"])(import_form_ImportForm));
 664  
 665  // CONCATENATED MODULE: ./node_modules/@wordpress/list-reusable-blocks/build-module/components/import-dropdown/index.js
 666  
 667  
 668  /**
 669   * External dependencies
 670   */
 671  
 672  /**
 673   * WordPress dependencies
 674   */
 675  
 676  
 677  
 678  /**
 679   * Internal dependencies
 680   */
 681  
 682  
 683  
 684  function ImportDropdown(_ref) {
 685    var onUpload = _ref.onUpload;
 686    return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], {
 687      position: "bottom right",
 688      contentClassName: "list-reusable-blocks-import-dropdown__content",
 689      renderToggle: function renderToggle(_ref2) {
 690        var isOpen = _ref2.isOpen,
 691            onToggle = _ref2.onToggle;
 692        return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], {
 693          "aria-expanded": isOpen,
 694          onClick: onToggle,
 695          isPrimary: true
 696        }, Object(external_this_wp_i18n_["__"])('Import from JSON'));
 697      },
 698      renderContent: function renderContent(_ref3) {
 699        var onClose = _ref3.onClose;
 700        return Object(external_this_wp_element_["createElement"])(import_form, {
 701          onUpload: Object(external_this_lodash_["flow"])(onClose, onUpload)
 702        });
 703      }
 704    });
 705  }
 706  
 707  /* harmony default export */ var import_dropdown = (ImportDropdown);
 708  
 709  // CONCATENATED MODULE: ./node_modules/@wordpress/list-reusable-blocks/build-module/index.js
 710  
 711  
 712  /**
 713   * WordPress dependencies
 714   */
 715  
 716  
 717  /**
 718   * Internal dependencies
 719   */
 720  
 721  
 722   // Setup Export Links
 723  
 724  document.body.addEventListener('click', function (event) {
 725    if (!event.target.classList.contains('wp-list-reusable-blocks__export')) {
 726      return;
 727    }
 728  
 729    event.preventDefault();
 730    utils_export(event.target.dataset.id);
 731  }); // Setup Import Form
 732  
 733  document.addEventListener('DOMContentLoaded', function () {
 734    var button = document.querySelector('.page-title-action');
 735  
 736    if (!button) {
 737      return;
 738    }
 739  
 740    var showNotice = function showNotice() {
 741      var notice = document.createElement('div');
 742      notice.className = 'notice notice-success is-dismissible';
 743      notice.innerHTML = "<p>".concat(Object(external_this_wp_i18n_["__"])('Reusable block imported successfully!'), "</p>");
 744      var headerEnd = document.querySelector('.wp-header-end');
 745  
 746      if (!headerEnd) {
 747        return;
 748      }
 749  
 750      headerEnd.parentNode.insertBefore(notice, headerEnd);
 751    };
 752  
 753    var container = document.createElement('div');
 754    container.className = 'list-reusable-blocks__container';
 755    button.parentNode.insertBefore(container, button);
 756    Object(external_this_wp_element_["render"])(Object(external_this_wp_element_["createElement"])(import_dropdown, {
 757      onUpload: showNotice
 758    }), container);
 759  });
 760  
 761  
 762  /***/ }),
 763  
 764  /***/ 49:
 765  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 766  
 767  "use strict";
 768  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; });
 769  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
 770    try {
 771      var info = gen[key](arg);
 772      var value = info.value;
 773    } catch (error) {
 774      reject(error);
 775      return;
 776    }
 777  
 778    if (info.done) {
 779      resolve(value);
 780    } else {
 781      Promise.resolve(value).then(_next, _throw);
 782    }
 783  }
 784  
 785  function _asyncToGenerator(fn) {
 786    return function () {
 787      var self = this,
 788          args = arguments;
 789      return new Promise(function (resolve, reject) {
 790        var gen = fn.apply(self, args);
 791  
 792        function _next(value) {
 793          asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
 794        }
 795  
 796        function _throw(err) {
 797          asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
 798        }
 799  
 800        _next(undefined);
 801      });
 802    };
 803  }
 804  
 805  /***/ }),
 806  
 807  /***/ 7:
 808  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 809  
 810  "use strict";
 811  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; });
 812  function _assertThisInitialized(self) {
 813    if (self === void 0) {
 814      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
 815    }
 816  
 817    return self;
 818  }
 819  
 820  /***/ }),
 821  
 822  /***/ 8:
 823  /***/ (function(module, exports) {
 824  
 825  (function() { module.exports = this["wp"]["compose"]; }());
 826  
 827  /***/ })
 828  
 829  /******/ });


Generated: Tue Apr 7 01:00:07 2020 Cross-referenced by PHPXref 0.7.1