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


Generated: Mon Jan 27 01:00:03 2020 Cross-referenced by PHPXref 0.7.1