WordPress/wp-includes/js/dist/format-library.js

1689 lines
77 KiB
JavaScript

this["wp"] = this["wp"] || {}; this["wp"]["formatLibrary"] =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./node_modules/@wordpress/format-library/build-module/index.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js":
/*!**************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js ***!
\**************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _assertThisInitialized; });
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js":
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***!
\*******************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _classCallCheck; });
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/createClass.js":
/*!****************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/createClass.js ***!
\****************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _createClass; });
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js":
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js ***!
\*******************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _getPrototypeOf; });
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/inherits.js":
/*!*************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/inherits.js ***!
\*************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _inherits; });
/* harmony import */ var _setPrototypeOf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) Object(_setPrototypeOf__WEBPACK_IMPORTED_MODULE_0__["default"])(subClass, superClass);
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js":
/*!****************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js ***!
\****************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _objectWithoutProperties; });
/* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./objectWithoutPropertiesLoose */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js");
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js":
/*!*********************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***!
\*********************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _objectWithoutPropertiesLoose; });
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js":
/*!******************************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js ***!
\******************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _possibleConstructorReturn; });
/* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../helpers/esm/typeof */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");
/* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assertThisInitialized */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
function _possibleConstructorReturn(self, call) {
if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(call) === "object" || typeof call === "function")) {
return call;
}
return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__["default"])(self);
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js":
/*!*******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***!
\*******************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _setPrototypeOf; });
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/***/ }),
/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js":
/*!***********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***!
\***********************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _typeof; });
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); }
function _typeof(obj) {
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
_typeof = function _typeof(obj) {
return _typeof2(obj);
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
};
}
return _typeof(obj);
}
/***/ }),
/***/ "./node_modules/@wordpress/format-library/build-module/bold/index.js":
/*!***************************************************************************!*\
!*** ./node_modules/@wordpress/format-library/build-module/bold/index.js ***!
\***************************************************************************/
/*! exports provided: bold */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bold", function() { return bold; });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor");
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__);
/**
* WordPress dependencies
*/
var name = 'core/bold';
var bold = {
name: name,
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Bold'),
tagName: 'strong',
className: null,
edit: function edit(_ref) {
var isActive = _ref.isActive,
value = _ref.value,
onChange = _ref.onChange;
var onToggle = function onToggle() {
return onChange(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__["toggleFormat"])(value, {
type: name
}));
};
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__["RichTextShortcut"], {
type: "primary",
character: "b",
onUse: onToggle
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__["RichTextToolbarButton"], {
name: "bold",
icon: "editor-bold",
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Bold'),
onClick: onToggle,
isActive: isActive,
shortcutType: "primary",
shortcutCharacter: "b"
}));
}
};
/***/ }),
/***/ "./node_modules/@wordpress/format-library/build-module/code/index.js":
/*!***************************************************************************!*\
!*** ./node_modules/@wordpress/format-library/build-module/code/index.js ***!
\***************************************************************************/
/*! exports provided: code */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "code", function() { return code; });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor");
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__);
/**
* WordPress dependencies
*/
var name = 'core/code';
var code = {
name: name,
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Code'),
tagName: 'code',
className: null,
edit: function edit(_ref) {
var value = _ref.value,
onChange = _ref.onChange;
var onToggle = function onToggle() {
return onChange(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__["toggleFormat"])(value, {
type: name
}));
};
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__["RichTextShortcut"], {
type: "access",
character: "x",
onUse: onToggle
});
}
};
/***/ }),
/***/ "./node_modules/@wordpress/format-library/build-module/image/index.js":
/*!****************************************************************************!*\
!*** ./node_modules/@wordpress/format-library/build-module/image/index.js ***!
\****************************************************************************/
/*! exports provided: image */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "image", function() { return image; });
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor");
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_10__);
/**
* WordPress dependencies
*/
var ALLOWED_MEDIA_TYPES = ['image'];
var name = 'core/image';
var image = {
name: name,
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Image'),
keywords: [Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('photo'), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('media')],
object: true,
tagName: 'img',
className: null,
attributes: {
className: 'class',
style: 'style',
url: 'src',
alt: 'alt'
},
edit:
/*#__PURE__*/
function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(ImageEdit, _Component);
function ImageEdit() {
var _this;
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, ImageEdit);
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(ImageEdit).apply(this, arguments));
_this.openModal = _this.openModal.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.closeModal = _this.closeModal.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.state = {
modal: false
};
return _this;
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(ImageEdit, [{
key: "openModal",
value: function openModal() {
this.setState({
modal: true
});
}
}, {
key: "closeModal",
value: function closeModal() {
this.setState({
modal: false
});
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$props = this.props,
value = _this$props.value,
onChange = _this$props.onChange;
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_10__["MediaUploadCheck"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_10__["RichTextInserterItem"], {
name: name,
icon: Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_7__["Path"], {
d: "M4 16h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2zM4 5h10v9H4V5zm14 9v2h4v-2h-4zM2 20h20v-2H2v2zm6.4-8.8L7 9.4 5 12h8l-2.6-3.4-2 2.6z"
})),
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Inline Image'),
onClick: this.openModal
}), this.state.modal && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_10__["MediaUpload"], {
allowedTypes: ALLOWED_MEDIA_TYPES,
onSelect: function onSelect(_ref) {
var id = _ref.id,
url = _ref.url,
alt = _ref.alt,
width = _ref.width;
_this2.closeModal();
onChange(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9__["insertObject"])(value, {
type: name,
attributes: {
className: "wp-image-".concat(id),
style: "width: ".concat(Math.min(width, 150), "px;"),
url: url,
alt: alt
}
}));
},
onClose: this.closeModal,
render: function render(_ref2) {
var open = _ref2.open;
open();
return null;
}
}));
}
}]);
return ImageEdit;
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["Component"])
};
/***/ }),
/***/ "./node_modules/@wordpress/format-library/build-module/index.js":
/*!**********************************************************************!*\
!*** ./node_modules/@wordpress/format-library/build-module/index.js ***!
\**********************************************************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js");
/* harmony import */ var _bold__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bold */ "./node_modules/@wordpress/format-library/build-module/bold/index.js");
/* harmony import */ var _code__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./code */ "./node_modules/@wordpress/format-library/build-module/code/index.js");
/* harmony import */ var _image__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./image */ "./node_modules/@wordpress/format-library/build-module/image/index.js");
/* harmony import */ var _italic__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./italic */ "./node_modules/@wordpress/format-library/build-module/italic/index.js");
/* harmony import */ var _link__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./link */ "./node_modules/@wordpress/format-library/build-module/link/index.js");
/* harmony import */ var _strikethrough__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./strikethrough */ "./node_modules/@wordpress/format-library/build-module/strikethrough/index.js");
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_7__);
/**
* Internal dependencies
*/
/**
* WordPress dependencies
*/
[_bold__WEBPACK_IMPORTED_MODULE_1__["bold"], _code__WEBPACK_IMPORTED_MODULE_2__["code"], _image__WEBPACK_IMPORTED_MODULE_3__["image"], _italic__WEBPACK_IMPORTED_MODULE_4__["italic"], _link__WEBPACK_IMPORTED_MODULE_5__["link"], _strikethrough__WEBPACK_IMPORTED_MODULE_6__["strikethrough"]].forEach(function (_ref) {
var name = _ref.name,
settings = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_0__["default"])(_ref, ["name"]);
return Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_7__["registerFormatType"])(name, settings);
});
/***/ }),
/***/ "./node_modules/@wordpress/format-library/build-module/italic/index.js":
/*!*****************************************************************************!*\
!*** ./node_modules/@wordpress/format-library/build-module/italic/index.js ***!
\*****************************************************************************/
/*! exports provided: italic */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "italic", function() { return italic; });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor");
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__);
/**
* WordPress dependencies
*/
var name = 'core/italic';
var italic = {
name: name,
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Italic'),
tagName: 'em',
className: null,
edit: function edit(_ref) {
var isActive = _ref.isActive,
value = _ref.value,
onChange = _ref.onChange;
var onToggle = function onToggle() {
return onChange(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__["toggleFormat"])(value, {
type: name
}));
};
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__["RichTextShortcut"], {
type: "primary",
character: "i",
onUse: onToggle
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__["RichTextToolbarButton"], {
name: "italic",
icon: "editor-italic",
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Italic'),
onClick: onToggle,
isActive: isActive,
shortcutType: "primary",
shortcutCharacter: "i"
}));
}
};
/***/ }),
/***/ "./node_modules/@wordpress/format-library/build-module/link/index.js":
/*!***************************************************************************!*\
!*** ./node_modules/@wordpress/format-library/build-module/link/index.js ***!
\***************************************************************************/
/*! exports provided: link */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "link", function() { return link; });
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor");
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var _inline__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./inline */ "./node_modules/@wordpress/format-library/build-module/link/inline.js");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
var name = 'core/link';
var link = {
name: name,
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_7__["__"])('Link'),
tagName: 'a',
className: null,
attributes: {
url: 'href',
target: 'target'
},
edit: Object(_wordpress_components__WEBPACK_IMPORTED_MODULE_8__["withSpokenMessages"])(
/*#__PURE__*/
function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(LinkEdit, _Component);
function LinkEdit() {
var _this;
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, LinkEdit);
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(LinkEdit).apply(this, arguments));
_this.addLink = _this.addLink.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.stopAddingLink = _this.stopAddingLink.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.onRemoveFormat = _this.onRemoveFormat.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.state = {
addingLink: false
};
return _this;
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(LinkEdit, [{
key: "addLink",
value: function addLink() {
var _this$props = this.props,
value = _this$props.value,
onChange = _this$props.onChange;
var text = Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9__["getTextContent"])(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9__["slice"])(value));
if (text && Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_10__["isURL"])(text)) {
onChange(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9__["applyFormat"])(value, {
type: name,
attributes: {
url: text
}
}));
} else {
this.setState({
addingLink: true
});
}
}
}, {
key: "stopAddingLink",
value: function stopAddingLink() {
this.setState({
addingLink: false
});
}
}, {
key: "onRemoveFormat",
value: function onRemoveFormat() {
var _this$props2 = this.props,
value = _this$props2.value,
onChange = _this$props2.onChange,
speak = _this$props2.speak;
onChange(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_9__["removeFormat"])(value, name));
speak(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_7__["__"])('Link removed.'), 'assertive');
}
}, {
key: "render",
value: function render() {
var _this$props3 = this.props,
isActive = _this$props3.isActive,
activeAttributes = _this$props3.activeAttributes,
value = _this$props3.value,
onChange = _this$props3.onChange;
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_11__["RichTextShortcut"], {
type: "access",
character: "a",
onUse: this.addLink
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_11__["RichTextShortcut"], {
type: "access",
character: "s",
onUse: this.onRemoveFormat
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_11__["RichTextShortcut"], {
type: "primary",
character: "k",
onUse: this.addLink
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_11__["RichTextShortcut"], {
type: "primaryShift",
character: "k",
onUse: this.onRemoveFormat
}), isActive && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_11__["RichTextToolbarButton"], {
name: "link",
icon: "editor-unlink",
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_7__["__"])('Unlink'),
onClick: this.onRemoveFormat,
isActive: isActive,
shortcutType: "primaryShift",
shortcutCharacter: "k"
}), !isActive && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_11__["RichTextToolbarButton"], {
name: "link",
icon: "admin-links",
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_7__["__"])('Link'),
onClick: this.addLink,
isActive: isActive,
shortcutType: "primary",
shortcutCharacter: "k"
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_inline__WEBPACK_IMPORTED_MODULE_12__["default"], {
addingLink: this.state.addingLink,
stopAddingLink: this.stopAddingLink,
isActive: isActive,
activeAttributes: activeAttributes,
value: value,
onChange: onChange
}));
}
}]);
return LinkEdit;
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["Component"]))
};
/***/ }),
/***/ "./node_modules/@wordpress/format-library/build-module/link/inline.js":
/*!****************************************************************************!*\
!*** ./node_modules/@wordpress/format-library/build-module/link/inline.js ***!
\****************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js");
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var _wordpress_keycodes__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @wordpress/keycodes */ "@wordpress/keycodes");
/* harmony import */ var _wordpress_keycodes__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_wordpress_keycodes__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor");
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_13__);
/* harmony import */ var _positioned_at_selection__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./positioned-at-selection */ "./node_modules/@wordpress/format-library/build-module/link/positioned-at-selection.js");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./utils */ "./node_modules/@wordpress/format-library/build-module/link/utils.js");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
var stopKeyPropagation = function stopKeyPropagation(event) {
return event.stopPropagation();
};
/**
* Generates the format object that will be applied to the link text.
*
* @param {string} url The href of the link.
* @param {boolean} opensInNewWindow Whether this link will open in a new window.
* @param {Object} text The text that is being hyperlinked.
*
* @return {Object} The final format object.
*/
function createLinkFormat(_ref) {
var url = _ref.url,
opensInNewWindow = _ref.opensInNewWindow,
text = _ref.text;
var format = {
type: 'core/link',
attributes: {
url: url
}
};
if (opensInNewWindow) {
// translators: accessibility label for external links, where the argument is the link text
var label = Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["sprintf"])(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('%s (opens in a new tab)'), text).trim();
format.attributes.target = '_blank';
format.attributes.rel = 'noreferrer noopener';
format.attributes['aria-label'] = label;
}
return format;
}
function isShowingInput(props, state) {
return props.addingLink || state.editLink;
}
var LinkEditor = function LinkEditor(_ref2) {
var value = _ref2.value,
onChangeInputValue = _ref2.onChangeInputValue,
onKeyDown = _ref2.onKeyDown,
submitLink = _ref2.submitLink,
autocompleteRef = _ref2.autocompleteRef;
return (// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])("form", {
className: "editor-format-toolbar__link-container-content",
onKeyPress: stopKeyPropagation,
onKeyDown: onKeyDown,
onSubmit: submitLink
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_13__["URLInput"], {
value: value,
onChange: onChangeInputValue,
autocompleteRef: autocompleteRef
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__["IconButton"], {
icon: "editor-break",
label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Apply'),
type: "submit"
}))
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
);
};
var LinkViewerUrl = function LinkViewerUrl(_ref3) {
var url = _ref3.url;
var prependedURL = Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_11__["prependHTTP"])(url);
var linkClassName = classnames__WEBPACK_IMPORTED_MODULE_7___default()('editor-format-toolbar__link-container-value', {
'has-invalid-link': !Object(_utils__WEBPACK_IMPORTED_MODULE_15__["isValidHref"])(prependedURL)
});
if (!url) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])("span", {
className: linkClassName
});
}
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__["ExternalLink"], {
className: linkClassName,
href: url
}, Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_11__["filterURLForDisplay"])(Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_11__["safeDecodeURI"])(url)));
};
var LinkViewer = function LinkViewer(_ref4) {
var url = _ref4.url,
editLink = _ref4.editLink;
return (// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar
/* eslint-disable jsx-a11y/no-static-element-interactions */
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])("div", {
className: "editor-format-toolbar__link-container-content",
onKeyPress: stopKeyPropagation
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(LinkViewerUrl, {
url: url
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__["IconButton"], {
icon: "edit",
label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Edit'),
onClick: editLink
}))
/* eslint-enable jsx-a11y/no-static-element-interactions */
);
};
var InlineLinkUI =
/*#__PURE__*/
function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(InlineLinkUI, _Component);
function InlineLinkUI() {
var _this;
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, InlineLinkUI);
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(InlineLinkUI).apply(this, arguments));
_this.editLink = _this.editLink.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.submitLink = _this.submitLink.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.onKeyDown = _this.onKeyDown.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.onChangeInputValue = _this.onChangeInputValue.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.setLinkTarget = _this.setLinkTarget.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.onClickOutside = _this.onClickOutside.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.resetState = _this.resetState.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__["default"])(_this)));
_this.autocompleteRef = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createRef"])();
_this.state = {
opensInNewWindow: false,
inputValue: ''
};
return _this;
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(InlineLinkUI, [{
key: "onKeyDown",
value: function onKeyDown(event) {
if ([_wordpress_keycodes__WEBPACK_IMPORTED_MODULE_10__["LEFT"], _wordpress_keycodes__WEBPACK_IMPORTED_MODULE_10__["DOWN"], _wordpress_keycodes__WEBPACK_IMPORTED_MODULE_10__["RIGHT"], _wordpress_keycodes__WEBPACK_IMPORTED_MODULE_10__["UP"], _wordpress_keycodes__WEBPACK_IMPORTED_MODULE_10__["BACKSPACE"], _wordpress_keycodes__WEBPACK_IMPORTED_MODULE_10__["ENTER"]].indexOf(event.keyCode) > -1) {
// Stop the key event from propagating up to ObserveTyping.startTypingInTextField.
event.stopPropagation();
}
}
}, {
key: "onChangeInputValue",
value: function onChangeInputValue(inputValue) {
this.setState({
inputValue: inputValue
});
}
}, {
key: "setLinkTarget",
value: function setLinkTarget(opensInNewWindow) {
var _this$props = this.props,
_this$props$activeAtt = _this$props.activeAttributes.url,
url = _this$props$activeAtt === void 0 ? '' : _this$props$activeAtt,
value = _this$props.value,
onChange = _this$props.onChange;
this.setState({
opensInNewWindow: opensInNewWindow
}); // Apply now if URL is not being edited.
if (!isShowingInput(this.props, this.state)) {
onChange(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_12__["applyFormat"])(value, createLinkFormat({
url: url,
opensInNewWindow: opensInNewWindow,
text: value.text
})));
}
}
}, {
key: "editLink",
value: function editLink(event) {
this.setState({
editLink: true
});
event.preventDefault();
}
}, {
key: "submitLink",
value: function submitLink(event) {
var _this$props2 = this.props,
isActive = _this$props2.isActive,
value = _this$props2.value,
onChange = _this$props2.onChange,
speak = _this$props2.speak;
var _this$state = this.state,
inputValue = _this$state.inputValue,
opensInNewWindow = _this$state.opensInNewWindow;
var url = Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_11__["prependHTTP"])(inputValue);
var format = createLinkFormat({
url: url,
opensInNewWindow: opensInNewWindow,
text: value.text
});
event.preventDefault();
if (Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_12__["isCollapsed"])(value) && !isActive) {
var toInsert = Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_12__["applyFormat"])(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_12__["create"])({
text: url
}), format, 0, url.length);
onChange(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_12__["insert"])(value, toInsert));
} else {
onChange(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_12__["applyFormat"])(value, format));
}
this.resetState();
if (!Object(_utils__WEBPACK_IMPORTED_MODULE_15__["isValidHref"])(url)) {
speak(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Warning: the link has been inserted but may have errors. Please test it.'), 'assertive');
} else if (isActive) {
speak(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Link edited.'), 'assertive');
} else {
speak(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Link inserted'), 'assertive');
}
}
}, {
key: "onClickOutside",
value: function onClickOutside(event) {
// The autocomplete suggestions list renders in a separate popover (in a portal),
// so onClickOutside fails to detect that a click on a suggestion occured in the
// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and
// return to avoid the popover being closed.
var autocompleteElement = this.autocompleteRef.current;
if (autocompleteElement && autocompleteElement.contains(event.target)) {
return;
}
this.resetState();
}
}, {
key: "resetState",
value: function resetState() {
this.props.stopAddingLink();
this.setState({
editLink: false
});
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$props3 = this.props,
isActive = _this$props3.isActive,
url = _this$props3.activeAttributes.url,
addingLink = _this$props3.addingLink,
value = _this$props3.value;
if (!isActive && !addingLink) {
return null;
}
var _this$state2 = this.state,
inputValue = _this$state2.inputValue,
opensInNewWindow = _this$state2.opensInNewWindow;
var showInput = isShowingInput(this.props, this.state);
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_positioned_at_selection__WEBPACK_IMPORTED_MODULE_14__["default"], {
key: "".concat(value.start).concat(value.end)
/* Used to force rerender on selection change */
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_13__["URLPopover"], {
onClickOutside: this.onClickOutside,
onClose: this.resetState,
focusOnMount: showInput ? 'firstElement' : false,
renderSettings: function renderSettings() {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__["ToggleControl"], {
label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_8__["__"])('Open in New Tab'),
checked: opensInNewWindow,
onChange: _this2.setLinkTarget
});
}
}, showInput ? Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(LinkEditor, {
value: inputValue,
onChangeInputValue: this.onChangeInputValue,
onKeyDown: this.onKeyDown,
submitLink: this.submitLink,
autocompleteRef: this.autocompleteRef
}) : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["createElement"])(LinkViewer, {
url: url,
editLink: this.editLink
})));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(props, state) {
var _props$activeAttribut = props.activeAttributes,
url = _props$activeAttribut.url,
target = _props$activeAttribut.target;
var opensInNewWindow = target === '_blank';
if (!isShowingInput(props, state)) {
if (url !== state.inputValue) {
return {
inputValue: url
};
}
if (opensInNewWindow !== state.opensInNewWindow) {
return {
opensInNewWindow: opensInNewWindow
};
}
}
return null;
}
}]);
return InlineLinkUI;
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_6__["Component"]);
/* harmony default export */ __webpack_exports__["default"] = (Object(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__["withSpokenMessages"])(InlineLinkUI));
/***/ }),
/***/ "./node_modules/@wordpress/format-library/build-module/link/positioned-at-selection.js":
/*!*********************************************************************************************!*\
!*** ./node_modules/@wordpress/format-library/build-module/link/positioned-at-selection.js ***!
\*********************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js");
/* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js");
/* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js");
/* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");
/* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _wordpress_dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/dom */ "@wordpress/dom");
/* harmony import */ var _wordpress_dom__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_dom__WEBPACK_IMPORTED_MODULE_6__);
/**
* WordPress dependencies
*/
/**
* Returns a style object for applying as `position: absolute` for an element
* relative to the bottom-center of the current selection. Includes `top` and
* `left` style properties.
*
* @return {Object} Style object.
*/
function getCurrentCaretPositionStyle() {
var selection = window.getSelection(); // Unlikely, but in the case there is no selection, return empty styles so
// as to avoid a thrown error by `Selection#getRangeAt` on invalid index.
if (selection.rangeCount === 0) {
return {};
} // Get position relative viewport.
var rect = Object(_wordpress_dom__WEBPACK_IMPORTED_MODULE_6__["getRectangleFromRange"])(selection.getRangeAt(0));
var top = rect.top + rect.height;
var left = rect.left + rect.width / 2; // Offset by positioned parent, if one exists.
var offsetParent = Object(_wordpress_dom__WEBPACK_IMPORTED_MODULE_6__["getOffsetParent"])(selection.anchorNode);
if (offsetParent) {
var parentRect = offsetParent.getBoundingClientRect();
top -= parentRect.top;
left -= parentRect.left;
}
return {
top: top,
left: left
};
}
/**
* Component which renders itself positioned under the current caret selection.
* The position is calculated at the time of the component being mounted, so it
* should only be mounted after the desired selection has been made.
*
* @type {WPComponent}
*/
var PositionedAtSelection =
/*#__PURE__*/
function (_Component) {
Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__["default"])(PositionedAtSelection, _Component);
function PositionedAtSelection() {
var _this;
Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, PositionedAtSelection);
_this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(PositionedAtSelection).apply(this, arguments));
_this.state = {
style: getCurrentCaretPositionStyle()
};
return _this;
}
Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(PositionedAtSelection, [{
key: "render",
value: function render() {
var children = this.props.children;
var style = this.state.style;
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["createElement"])("div", {
className: "editor-format-toolbar__selection-position",
style: style
}, children);
}
}]);
return PositionedAtSelection;
}(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Component"]);
/* harmony default export */ __webpack_exports__["default"] = (PositionedAtSelection);
/***/ }),
/***/ "./node_modules/@wordpress/format-library/build-module/link/utils.js":
/*!***************************************************************************!*\
!*** ./node_modules/@wordpress/format-library/build-module/link/utils.js ***!
\***************************************************************************/
/*! exports provided: isValidHref */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidHref", function() { return isValidHref; });
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url");
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__);
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Check for issues with the provided href.
*
* @param {string} href The href.
*
* @return {boolean} Is the href invalid?
*/
function isValidHref(href) {
if (!href) {
return false;
}
var trimmedHref = href.trim();
if (!trimmedHref) {
return false;
} // Does the href start with something that looks like a URL protocol?
if (/^\S+:/.test(trimmedHref)) {
var protocol = Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["getProtocol"])(trimmedHref);
if (!Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["isValidProtocol"])(protocol)) {
return false;
} // Add some extra checks for http(s) URIs, since these are the most common use-case.
// This ensures URIs with an http protocol have exactly two forward slashes following the protocol.
if (Object(lodash__WEBPACK_IMPORTED_MODULE_0__["startsWith"])(protocol, 'http') && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) {
return false;
}
var authority = Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["getAuthority"])(trimmedHref);
if (!Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["isValidAuthority"])(authority)) {
return false;
}
var path = Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["getPath"])(trimmedHref);
if (path && !Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["isValidPath"])(path)) {
return false;
}
var queryString = Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["getQueryString"])(trimmedHref);
if (queryString && !Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["isValidQueryString"])(queryString)) {
return false;
}
var fragment = Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["getFragment"])(trimmedHref);
if (fragment && !Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["isValidFragment"])(fragment)) {
return false;
}
} // Validate anchor links.
if (Object(lodash__WEBPACK_IMPORTED_MODULE_0__["startsWith"])(trimmedHref, '#') && !Object(_wordpress_url__WEBPACK_IMPORTED_MODULE_1__["isValidFragment"])(trimmedHref)) {
return false;
}
return true;
}
/***/ }),
/***/ "./node_modules/@wordpress/format-library/build-module/strikethrough/index.js":
/*!************************************************************************************!*\
!*** ./node_modules/@wordpress/format-library/build-module/strikethrough/index.js ***!
\************************************************************************************/
/*! exports provided: strikethrough */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strikethrough", function() { return strikethrough; });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/rich-text */ "@wordpress/rich-text");
/* harmony import */ var _wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/editor */ "@wordpress/editor");
/* harmony import */ var _wordpress_editor__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__);
/**
* WordPress dependencies
*/
var name = 'core/strikethrough';
var strikethrough = {
name: name,
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Strikethrough'),
tagName: 'del',
className: null,
edit: function edit(_ref) {
var isActive = _ref.isActive,
value = _ref.value,
onChange = _ref.onChange;
var onToggle = function onToggle() {
return onChange(Object(_wordpress_rich_text__WEBPACK_IMPORTED_MODULE_2__["toggleFormat"])(value, {
type: name
}));
};
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__["RichTextShortcut"], {
type: "access",
character: "d",
onUse: onToggle
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_editor__WEBPACK_IMPORTED_MODULE_3__["RichTextToolbarButton"], {
name: "strikethrough",
icon: "editor-strikethrough",
title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Strikethrough'),
onClick: onToggle,
isActive: isActive,
shortcutType: "access",
shortcutCharacter: "d"
}));
}
};
/***/ }),
/***/ "./node_modules/classnames/index.js":
/*!******************************************!*\
!*** ./node_modules/classnames/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg) && arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/***/ "@wordpress/components":
/*!*********************************************!*\
!*** external {"this":["wp","components"]} ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["components"]; }());
/***/ }),
/***/ "@wordpress/dom":
/*!**************************************!*\
!*** external {"this":["wp","dom"]} ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["dom"]; }());
/***/ }),
/***/ "@wordpress/editor":
/*!*****************************************!*\
!*** external {"this":["wp","editor"]} ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["editor"]; }());
/***/ }),
/***/ "@wordpress/element":
/*!******************************************!*\
!*** external {"this":["wp","element"]} ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["element"]; }());
/***/ }),
/***/ "@wordpress/i18n":
/*!***************************************!*\
!*** external {"this":["wp","i18n"]} ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["i18n"]; }());
/***/ }),
/***/ "@wordpress/keycodes":
/*!*******************************************!*\
!*** external {"this":["wp","keycodes"]} ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["keycodes"]; }());
/***/ }),
/***/ "@wordpress/rich-text":
/*!*******************************************!*\
!*** external {"this":["wp","richText"]} ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["richText"]; }());
/***/ }),
/***/ "@wordpress/url":
/*!**************************************!*\
!*** external {"this":["wp","url"]} ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["url"]; }());
/***/ }),
/***/ "lodash":
/*!*************************!*\
!*** external "lodash" ***!
\*************************/
/*! no static exports found */
/***/ (function(module, exports) {
(function() { module.exports = this["lodash"]; }());
/***/ })
/******/ });
//# sourceMappingURL=format-library.js.map