2018-12-14 12:02:53 +01:00
|
|
|
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
|
2019-09-19 17:19:18 +02:00
|
|
|
/******/ return __webpack_require__(__webpack_require__.s = 390);
|
2018-12-14 12:02:53 +01:00
|
|
|
/******/ })
|
|
|
|
/************************************************************************/
|
|
|
|
/******/ ({
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
/***/ 0:
|
|
|
|
/***/ (function(module, exports) {
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
(function() { module.exports = this["wp"]["element"]; }());
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ 1:
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
(function() { module.exports = this["wp"]["i18n"]; }());
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
/***/ 10:
|
2018-12-14 12:02:53 +01:00
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
"use strict";
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
|
|
|
|
function _defineProperty(obj, key, value) {
|
|
|
|
if (key in obj) {
|
|
|
|
Object.defineProperty(obj, key, {
|
|
|
|
value: value,
|
|
|
|
enumerable: true,
|
|
|
|
configurable: true,
|
|
|
|
writable: true
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
obj[key] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ 11:
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ 12:
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
"use strict";
|
2018-12-18 04:14:52 +01:00
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
|
2018-12-14 12:02:53 +01:00
|
|
|
function _classCallCheck(instance, Constructor) {
|
|
|
|
if (!(instance instanceof Constructor)) {
|
|
|
|
throw new TypeError("Cannot call a class as a function");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/***/ 13:
|
2018-12-14 12:02:53 +01:00
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
2018-12-18 04:14:52 +01:00
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
|
2019-09-19 17:19:18 +02:00
|
|
|
/* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
|
|
|
|
/* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
2018-12-18 04:14:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
function _possibleConstructorReturn(self, call) {
|
|
|
|
if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) {
|
|
|
|
return call;
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self);
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/***/ 14:
|
2018-12-14 12:02:53 +01:00
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
2018-12-18 04:14:52 +01:00
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
|
2018-12-14 12:02:53 +01:00
|
|
|
function _getPrototypeOf(o) {
|
|
|
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
|
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
|
|
};
|
|
|
|
return _getPrototypeOf(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/***/ 15:
|
2018-12-14 12:02:53 +01:00
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
2018-12-18 04:14:52 +01:00
|
|
|
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
|
|
function _setPrototypeOf(o, p) {
|
|
|
|
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
|
|
o.__proto__ = p;
|
|
|
|
return o;
|
|
|
|
};
|
|
|
|
|
|
|
|
return _setPrototypeOf(o, p);
|
|
|
|
}
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; });
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
});
|
2018-12-18 04:14:52 +01:00
|
|
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
/***/ }),
|
|
|
|
|
2019-03-21 13:48:00 +01:00
|
|
|
/***/ 18:
|
2019-04-22 14:40:04 +02:00
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
|
|
|
|
function _extends() {
|
|
|
|
_extends = Object.assign || function (target) {
|
|
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
|
|
var source = arguments[i];
|
|
|
|
|
|
|
|
for (var key in source) {
|
|
|
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
|
|
target[key] = source[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return target;
|
|
|
|
};
|
|
|
|
|
|
|
|
return _extends.apply(this, arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/***/ 19:
|
2018-12-18 04:14:52 +01:00
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
(function() { module.exports = this["wp"]["keycodes"]; }());
|
2018-12-18 04:14:52 +01:00
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/***/ 2:
|
2018-12-18 04:14:52 +01:00
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
(function() { module.exports = this["lodash"]; }());
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
/***/ 21:
|
2018-12-14 12:02:53 +01:00
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
2018-12-18 04:14:52 +01:00
|
|
|
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
|
2018-12-14 12:02:53 +01:00
|
|
|
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;
|
|
|
|
}
|
2018-12-18 04:14:52 +01:00
|
|
|
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; });
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
function _objectWithoutProperties(source, excluded) {
|
|
|
|
if (source == null) return {};
|
|
|
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
|
|
var key, i;
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
if (Object.getOwnPropertySymbols) {
|
|
|
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
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];
|
|
|
|
}
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
return target;
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/***/ 22:
|
2019-04-22 14:40:04 +02:00
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
(function() { module.exports = this["wp"]["richText"]; }());
|
2019-04-22 14:40:04 +02:00
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ 25:
|
2018-12-18 04:14:52 +01:00
|
|
|
/***/ (function(module, exports) {
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
(function() { module.exports = this["wp"]["dom"]; }());
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ 26:
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
(function() { module.exports = this["wp"]["url"]; }());
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2019-03-21 13:48:00 +01:00
|
|
|
/***/ 3:
|
2019-09-19 17:19:18 +02:00
|
|
|
/***/ (function(module, exports) {
|
2019-03-21 13:48:00 +01:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
(function() { module.exports = this["wp"]["components"]; }());
|
2019-03-21 13:48:00 +01:00
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/***/ 31:
|
2018-12-14 12:02:53 +01:00
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
2018-12-18 04:14:52 +01:00
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
|
2018-12-14 12:02:53 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/***/ 390:
|
2018-12-14 12:02:53 +01:00
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
2018-12-18 04:14:52 +01:00
|
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules
|
|
|
|
var objectWithoutProperties = __webpack_require__(21);
|
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
// EXTERNAL MODULE: external {"this":["wp","richText"]}
|
2019-09-19 17:19:18 +02:00
|
|
|
var external_this_wp_richText_ = __webpack_require__(22);
|
2019-03-07 10:09:59 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// EXTERNAL MODULE: external {"this":["wp","element"]}
|
|
|
|
var external_this_wp_element_ = __webpack_require__(0);
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: external {"this":["wp","i18n"]}
|
|
|
|
var external_this_wp_i18n_ = __webpack_require__(1);
|
|
|
|
|
2019-03-21 13:48:00 +01:00
|
|
|
// EXTERNAL MODULE: external {"this":["wp","blockEditor"]}
|
2019-09-19 17:19:18 +02:00
|
|
|
var external_this_wp_blockEditor_ = __webpack_require__(6);
|
2018-12-18 04:14:52 +01:00
|
|
|
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/bold/index.js
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
var bold_name = 'core/bold';
|
2019-09-19 17:19:18 +02:00
|
|
|
|
|
|
|
var title = Object(external_this_wp_i18n_["__"])('Bold');
|
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
var bold = {
|
2018-12-18 04:14:52 +01:00
|
|
|
name: bold_name,
|
2019-09-19 17:19:18 +02:00
|
|
|
title: title,
|
2018-12-17 05:52:00 +01:00
|
|
|
tagName: 'strong',
|
|
|
|
className: null,
|
2018-12-14 12:02:53 +01:00
|
|
|
edit: function edit(_ref) {
|
|
|
|
var isActive = _ref.isActive,
|
|
|
|
value = _ref.value,
|
2018-12-17 05:52:00 +01:00
|
|
|
onChange = _ref.onChange;
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
var onToggle = function onToggle() {
|
2018-12-18 04:14:52 +01:00
|
|
|
return onChange(Object(external_this_wp_richText_["toggleFormat"])(value, {
|
|
|
|
type: bold_name
|
2018-12-14 12:02:53 +01:00
|
|
|
}));
|
|
|
|
};
|
|
|
|
|
2019-03-21 13:48:00 +01:00
|
|
|
return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], {
|
2018-12-14 12:02:53 +01:00
|
|
|
type: "primary",
|
|
|
|
character: "b",
|
|
|
|
onUse: onToggle
|
2019-03-21 13:48:00 +01:00
|
|
|
}), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], {
|
2018-12-14 12:02:53 +01:00
|
|
|
name: "bold",
|
|
|
|
icon: "editor-bold",
|
2019-09-19 17:19:18 +02:00
|
|
|
title: title,
|
2018-12-14 12:02:53 +01:00
|
|
|
onClick: onToggle,
|
|
|
|
isActive: isActive,
|
|
|
|
shortcutType: "primary",
|
|
|
|
shortcutCharacter: "b"
|
2019-09-19 17:19:18 +02:00
|
|
|
}), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__unstableRichTextInputEvent"], {
|
2019-03-07 10:09:59 +01:00
|
|
|
inputType: "formatBold",
|
|
|
|
onInput: onToggle
|
2018-12-14 12:02:53 +01:00
|
|
|
}));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/code/index.js
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
var code_name = 'core/code';
|
2019-09-19 17:19:18 +02:00
|
|
|
|
|
|
|
var code_title = Object(external_this_wp_i18n_["__"])('Inline Code');
|
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
var code = {
|
2018-12-18 04:14:52 +01:00
|
|
|
name: code_name,
|
2019-09-19 17:19:18 +02:00
|
|
|
title: code_title,
|
2018-12-17 05:52:00 +01:00
|
|
|
tagName: 'code',
|
|
|
|
className: null,
|
2019-09-19 17:19:18 +02:00
|
|
|
__unstableInputRule: function __unstableInputRule(value) {
|
|
|
|
var BACKTICK = '`';
|
|
|
|
var _value = value,
|
|
|
|
start = _value.start,
|
|
|
|
text = _value.text;
|
|
|
|
var characterBefore = text.slice(start - 1, start); // Quick check the text for the necessary character.
|
|
|
|
|
|
|
|
if (characterBefore !== BACKTICK) {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
var textBefore = text.slice(0, start - 1);
|
|
|
|
var indexBefore = textBefore.lastIndexOf(BACKTICK);
|
|
|
|
|
|
|
|
if (indexBefore === -1) {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
var startIndex = indexBefore;
|
|
|
|
var endIndex = start - 2;
|
|
|
|
|
|
|
|
if (startIndex === endIndex) {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
value = Object(external_this_wp_richText_["remove"])(value, startIndex, startIndex + 1);
|
|
|
|
value = Object(external_this_wp_richText_["remove"])(value, endIndex, endIndex + 1);
|
|
|
|
value = Object(external_this_wp_richText_["applyFormat"])(value, {
|
|
|
|
type: code_name
|
|
|
|
}, startIndex, endIndex);
|
|
|
|
return value;
|
|
|
|
},
|
2018-12-14 12:02:53 +01:00
|
|
|
edit: function edit(_ref) {
|
|
|
|
var value = _ref.value,
|
2019-03-21 13:48:00 +01:00
|
|
|
onChange = _ref.onChange,
|
|
|
|
isActive = _ref.isActive;
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
var onToggle = function onToggle() {
|
2018-12-18 04:14:52 +01:00
|
|
|
return onChange(Object(external_this_wp_richText_["toggleFormat"])(value, {
|
|
|
|
type: code_name
|
2018-12-14 12:02:53 +01:00
|
|
|
}));
|
|
|
|
};
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], {
|
2019-03-21 13:48:00 +01:00
|
|
|
icon: "editor-code",
|
2019-09-19 17:19:18 +02:00
|
|
|
title: code_title,
|
2019-03-21 13:48:00 +01:00
|
|
|
onClick: onToggle,
|
2019-09-19 17:19:18 +02:00
|
|
|
isActive: isActive
|
|
|
|
});
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
|
2019-03-21 13:48:00 +01:00
|
|
|
var objectSpread = __webpack_require__(7);
|
2019-03-07 10:09:59 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
2019-09-19 17:19:18 +02:00
|
|
|
var classCallCheck = __webpack_require__(12);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
|
2019-09-19 17:19:18 +02:00
|
|
|
var createClass = __webpack_require__(11);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
|
2019-09-19 17:19:18 +02:00
|
|
|
var possibleConstructorReturn = __webpack_require__(13);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
|
2019-09-19 17:19:18 +02:00
|
|
|
var getPrototypeOf = __webpack_require__(14);
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
|
|
|
|
var assertThisInitialized = __webpack_require__(5);
|
2018-12-18 04:14:52 +01:00
|
|
|
|
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
|
2019-09-19 17:19:18 +02:00
|
|
|
var inherits = __webpack_require__(15);
|
2018-12-18 04:14:52 +01:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
|
|
|
|
var esm_extends = __webpack_require__(18);
|
2018-12-18 04:14:52 +01:00
|
|
|
|
|
|
|
// EXTERNAL MODULE: external {"this":["wp","components"]}
|
2019-09-19 17:19:18 +02:00
|
|
|
var external_this_wp_components_ = __webpack_require__(3);
|
2018-12-18 04:14:52 +01:00
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
// EXTERNAL MODULE: external {"this":["wp","keycodes"]}
|
2019-09-19 17:19:18 +02:00
|
|
|
var external_this_wp_keycodes_ = __webpack_require__(19);
|
|
|
|
|
|
|
|
// EXTERNAL MODULE: external {"this":["wp","dom"]}
|
|
|
|
var external_this_wp_dom_ = __webpack_require__(25);
|
2019-03-07 10:09:59 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/image/index.js
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
|
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
var ALLOWED_MEDIA_TYPES = ['image'];
|
2018-12-18 04:14:52 +01:00
|
|
|
var image_name = 'core/image';
|
2019-03-07 10:09:59 +01:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
var image_title = Object(external_this_wp_i18n_["__"])('Inline image');
|
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
var stopKeyPropagation = function stopKeyPropagation(event) {
|
|
|
|
return event.stopPropagation();
|
|
|
|
};
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
var image_PopoverAtImage = function PopoverAtImage(_ref) {
|
|
|
|
var dependencies = _ref.dependencies,
|
|
|
|
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["dependencies"]);
|
|
|
|
|
|
|
|
return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Popover"], Object(esm_extends["a" /* default */])({
|
|
|
|
position: "bottom center",
|
|
|
|
focusOnMount: false,
|
|
|
|
anchorRect: Object(external_this_wp_element_["useMemo"])(function () {
|
|
|
|
return Object(external_this_wp_dom_["computeCaretRect"])();
|
|
|
|
}, dependencies)
|
|
|
|
}, props));
|
|
|
|
};
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
var image_image = {
|
|
|
|
name: image_name,
|
2019-09-19 17:19:18 +02:00
|
|
|
title: image_title,
|
2018-12-18 04:14:52 +01:00
|
|
|
keywords: [Object(external_this_wp_i18n_["__"])('photo'), Object(external_this_wp_i18n_["__"])('media')],
|
2018-12-14 12:02:53 +01:00
|
|
|
object: true,
|
2018-12-17 05:52:00 +01:00
|
|
|
tagName: 'img',
|
|
|
|
className: null,
|
2018-12-14 12:02:53 +01:00
|
|
|
attributes: {
|
|
|
|
className: 'class',
|
|
|
|
style: 'style',
|
|
|
|
url: 'src',
|
|
|
|
alt: 'alt'
|
|
|
|
},
|
|
|
|
edit:
|
|
|
|
/*#__PURE__*/
|
|
|
|
function (_Component) {
|
2018-12-18 04:14:52 +01:00
|
|
|
Object(inherits["a" /* default */])(ImageEdit, _Component);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
function ImageEdit() {
|
|
|
|
var _this;
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
Object(classCallCheck["a" /* default */])(this, ImageEdit);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
_this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(ImageEdit).apply(this, arguments));
|
2019-09-19 17:19:18 +02:00
|
|
|
_this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.openModal = _this.openModal.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.closeModal = _this.closeModal.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
2018-12-14 12:02:53 +01:00
|
|
|
_this.state = {
|
|
|
|
modal: false
|
|
|
|
};
|
|
|
|
return _this;
|
|
|
|
}
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
Object(createClass["a" /* default */])(ImageEdit, [{
|
2019-03-07 10:09:59 +01:00
|
|
|
key: "onChange",
|
|
|
|
value: function onChange(width) {
|
|
|
|
this.setState({
|
|
|
|
width: width
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
key: "onKeyDown",
|
|
|
|
value: function onKeyDown(event) {
|
|
|
|
if ([external_this_wp_keycodes_["LEFT"], external_this_wp_keycodes_["DOWN"], external_this_wp_keycodes_["RIGHT"], external_this_wp_keycodes_["UP"], external_this_wp_keycodes_["BACKSPACE"], external_this_wp_keycodes_["ENTER"]].indexOf(event.keyCode) > -1) {
|
|
|
|
// Stop the key event from propagating up to ObserveTyping.startTypingInTextField.
|
|
|
|
event.stopPropagation();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
2018-12-14 12:02:53 +01:00
|
|
|
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,
|
2019-03-07 10:09:59 +01:00
|
|
|
onChange = _this$props.onChange,
|
2019-03-21 13:48:00 +01:00
|
|
|
isObjectActive = _this$props.isObjectActive,
|
|
|
|
activeObjectAttributes = _this$props.activeObjectAttributes;
|
2019-09-19 17:19:18 +02:00
|
|
|
var style = activeObjectAttributes.style;
|
2019-03-21 13:48:00 +01:00
|
|
|
return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], {
|
2018-12-18 04:14:52 +01:00
|
|
|
icon: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], {
|
2018-12-14 12:02:53 +01:00
|
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
|
|
viewBox: "0 0 24 24"
|
2018-12-18 04:14:52 +01:00
|
|
|
}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], {
|
2018-12-14 12:02:53 +01:00
|
|
|
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"
|
|
|
|
})),
|
2019-09-19 17:19:18 +02:00
|
|
|
title: image_title,
|
2019-03-21 13:48:00 +01:00
|
|
|
onClick: this.openModal,
|
|
|
|
isActive: isObjectActive
|
|
|
|
}), this.state.modal && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUpload"], {
|
2018-12-14 12:02:53 +01:00
|
|
|
allowedTypes: ALLOWED_MEDIA_TYPES,
|
2019-09-19 17:19:18 +02:00
|
|
|
onSelect: function onSelect(_ref2) {
|
|
|
|
var id = _ref2.id,
|
|
|
|
url = _ref2.url,
|
|
|
|
alt = _ref2.alt,
|
|
|
|
width = _ref2.width;
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
_this2.closeModal();
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
onChange(Object(external_this_wp_richText_["insertObject"])(value, {
|
|
|
|
type: image_name,
|
2018-12-14 12:02:53 +01:00
|
|
|
attributes: {
|
|
|
|
className: "wp-image-".concat(id),
|
|
|
|
style: "width: ".concat(Math.min(width, 150), "px;"),
|
|
|
|
url: url,
|
|
|
|
alt: alt
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
onClose: this.closeModal,
|
2019-09-19 17:19:18 +02:00
|
|
|
render: function render(_ref3) {
|
|
|
|
var open = _ref3.open;
|
2018-12-14 12:02:53 +01:00
|
|
|
open();
|
|
|
|
return null;
|
|
|
|
}
|
2019-09-19 17:19:18 +02:00
|
|
|
}), isObjectActive && Object(external_this_wp_element_["createElement"])(image_PopoverAtImage // Reposition Popover when the selection changes or
|
|
|
|
// when the width changes.
|
|
|
|
, {
|
|
|
|
dependencies: [style, value.start]
|
2019-03-07 10:09:59 +01:00
|
|
|
}, Object(external_this_wp_element_["createElement"])("form", {
|
2019-03-21 13:48:00 +01:00
|
|
|
className: "editor-format-toolbar__image-container-content block-editor-format-toolbar__image-container-content",
|
2019-03-07 10:09:59 +01:00
|
|
|
onKeyPress: stopKeyPropagation,
|
|
|
|
onKeyDown: this.onKeyDown,
|
|
|
|
onSubmit: function onSubmit(event) {
|
2019-03-21 13:48:00 +01:00
|
|
|
var newReplacements = value.replacements.slice();
|
|
|
|
newReplacements[value.start] = {
|
2019-03-07 10:09:59 +01:00
|
|
|
type: image_name,
|
2019-03-21 13:48:00 +01:00
|
|
|
attributes: Object(objectSpread["a" /* default */])({}, activeObjectAttributes, {
|
2019-03-07 10:09:59 +01:00
|
|
|
style: "width: ".concat(_this2.state.width, "px;")
|
|
|
|
})
|
2019-03-21 13:48:00 +01:00
|
|
|
};
|
2019-03-07 10:09:59 +01:00
|
|
|
onChange(Object(objectSpread["a" /* default */])({}, value, {
|
2019-03-21 13:48:00 +01:00
|
|
|
replacements: newReplacements
|
2019-03-07 10:09:59 +01:00
|
|
|
}));
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], {
|
2019-03-21 13:48:00 +01:00
|
|
|
className: "editor-format-toolbar__image-container-value block-editor-format-toolbar__image-container-value",
|
2019-03-07 10:09:59 +01:00
|
|
|
type: "number",
|
|
|
|
label: Object(external_this_wp_i18n_["__"])('Width'),
|
|
|
|
value: this.state.width,
|
|
|
|
min: 1,
|
|
|
|
onChange: this.onChange
|
|
|
|
}), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], {
|
|
|
|
icon: "editor-break",
|
|
|
|
label: Object(external_this_wp_i18n_["__"])('Apply'),
|
|
|
|
type: "submit"
|
2019-09-19 17:19:18 +02:00
|
|
|
}))));
|
2019-03-07 10:09:59 +01:00
|
|
|
}
|
|
|
|
}], [{
|
|
|
|
key: "getDerivedStateFromProps",
|
|
|
|
value: function getDerivedStateFromProps(props, state) {
|
2019-03-21 13:48:00 +01:00
|
|
|
var style = props.activeObjectAttributes.style;
|
2019-03-07 10:09:59 +01:00
|
|
|
|
|
|
|
if (style === state.previousStyle) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!style) {
|
|
|
|
return {
|
|
|
|
width: undefined,
|
|
|
|
previousStyle: style
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
width: style.replace(/\D/g, ''),
|
|
|
|
previousStyle: style
|
|
|
|
};
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
}]);
|
|
|
|
|
|
|
|
return ImageEdit;
|
2018-12-18 04:14:52 +01:00
|
|
|
}(external_this_wp_element_["Component"])
|
2018-12-14 12:02:53 +01:00
|
|
|
};
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/italic/index.js
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
var italic_name = 'core/italic';
|
2019-09-19 17:19:18 +02:00
|
|
|
|
|
|
|
var italic_title = Object(external_this_wp_i18n_["__"])('Italic');
|
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
var italic = {
|
2018-12-18 04:14:52 +01:00
|
|
|
name: italic_name,
|
2019-09-19 17:19:18 +02:00
|
|
|
title: italic_title,
|
2018-12-17 05:52:00 +01:00
|
|
|
tagName: 'em',
|
|
|
|
className: null,
|
2018-12-14 12:02:53 +01:00
|
|
|
edit: function edit(_ref) {
|
|
|
|
var isActive = _ref.isActive,
|
|
|
|
value = _ref.value,
|
2018-12-17 05:52:00 +01:00
|
|
|
onChange = _ref.onChange;
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
var onToggle = function onToggle() {
|
2018-12-18 04:14:52 +01:00
|
|
|
return onChange(Object(external_this_wp_richText_["toggleFormat"])(value, {
|
|
|
|
type: italic_name
|
2018-12-14 12:02:53 +01:00
|
|
|
}));
|
|
|
|
};
|
|
|
|
|
2019-03-21 13:48:00 +01:00
|
|
|
return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], {
|
2018-12-14 12:02:53 +01:00
|
|
|
type: "primary",
|
|
|
|
character: "i",
|
|
|
|
onUse: onToggle
|
2019-03-21 13:48:00 +01:00
|
|
|
}), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], {
|
2018-12-14 12:02:53 +01:00
|
|
|
name: "italic",
|
|
|
|
icon: "editor-italic",
|
2019-09-19 17:19:18 +02:00
|
|
|
title: italic_title,
|
2018-12-14 12:02:53 +01:00
|
|
|
onClick: onToggle,
|
|
|
|
isActive: isActive,
|
|
|
|
shortcutType: "primary",
|
|
|
|
shortcutCharacter: "i"
|
2019-09-19 17:19:18 +02:00
|
|
|
}), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__unstableRichTextInputEvent"], {
|
2019-03-07 10:09:59 +01:00
|
|
|
inputType: "formatItalic",
|
|
|
|
onInput: onToggle
|
2018-12-14 12:02:53 +01:00
|
|
|
}));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// EXTERNAL MODULE: external {"this":["wp","url"]}
|
2019-09-19 17:19:18 +02:00
|
|
|
var external_this_wp_url_ = __webpack_require__(26);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
// EXTERNAL MODULE: external {"this":["wp","htmlEntities"]}
|
|
|
|
var external_this_wp_htmlEntities_ = __webpack_require__(54);
|
2019-04-22 14:40:04 +02:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// EXTERNAL MODULE: external "lodash"
|
|
|
|
var external_lodash_ = __webpack_require__(2);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/utils.js
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
/**
|
|
|
|
* 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(external_this_wp_url_["getProtocol"])(trimmedHref);
|
|
|
|
|
|
|
|
if (!Object(external_this_wp_url_["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(external_lodash_["startsWith"])(protocol, 'http') && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
var authority = Object(external_this_wp_url_["getAuthority"])(trimmedHref);
|
|
|
|
|
|
|
|
if (!Object(external_this_wp_url_["isValidAuthority"])(authority)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
var path = Object(external_this_wp_url_["getPath"])(trimmedHref);
|
|
|
|
|
|
|
|
if (path && !Object(external_this_wp_url_["isValidPath"])(path)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
var queryString = Object(external_this_wp_url_["getQueryString"])(trimmedHref);
|
|
|
|
|
|
|
|
if (queryString && !Object(external_this_wp_url_["isValidQueryString"])(queryString)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
var fragment = Object(external_this_wp_url_["getFragment"])(trimmedHref);
|
|
|
|
|
|
|
|
if (fragment && !Object(external_this_wp_url_["isValidFragment"])(fragment)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} // Validate anchor links.
|
|
|
|
|
|
|
|
|
|
|
|
if (Object(external_lodash_["startsWith"])(trimmedHref, '#') && !Object(external_this_wp_url_["isValidFragment"])(trimmedHref)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2019-03-07 10:09:59 +01:00
|
|
|
/**
|
|
|
|
* Generates the format object that will be applied to the link text.
|
|
|
|
*
|
2019-09-19 17:19:18 +02:00
|
|
|
* @param {Object} options
|
|
|
|
* @param {string} options.url The href of the link.
|
|
|
|
* @param {boolean} options.opensInNewWindow Whether this link will open in a new window.
|
|
|
|
* @param {Object} options.text The text that is being hyperlinked.
|
2019-03-07 10:09:59 +01:00
|
|
|
*
|
|
|
|
* @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(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('%s (opens in a new tab)'), text);
|
|
|
|
format.attributes.target = '_blank';
|
|
|
|
format.attributes.rel = 'noreferrer noopener';
|
|
|
|
format.attributes['aria-label'] = label;
|
|
|
|
}
|
|
|
|
|
|
|
|
return format;
|
|
|
|
}
|
2018-12-18 04:14:52 +01:00
|
|
|
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/inline.js
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-22 14:40:04 +02:00
|
|
|
|
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-17 05:52:00 +01:00
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
var inline_stopKeyPropagation = function stopKeyPropagation(event) {
|
2018-12-14 12:02:53 +01:00
|
|
|
return event.stopPropagation();
|
|
|
|
};
|
|
|
|
|
|
|
|
function isShowingInput(props, state) {
|
|
|
|
return props.addingLink || state.editLink;
|
|
|
|
}
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
var inline_URLPopoverAtLink = function URLPopoverAtLink(_ref) {
|
|
|
|
var isActive = _ref.isActive,
|
|
|
|
addingLink = _ref.addingLink,
|
|
|
|
value = _ref.value,
|
|
|
|
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["isActive", "addingLink", "value"]);
|
2019-04-22 14:40:04 +02:00
|
|
|
|
|
|
|
var anchorRect = Object(external_this_wp_element_["useMemo"])(function () {
|
2019-05-16 20:08:00 +02:00
|
|
|
var selection = window.getSelection();
|
|
|
|
var range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
|
2019-04-22 14:40:04 +02:00
|
|
|
|
|
|
|
if (!range) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (addingLink) {
|
|
|
|
return Object(external_this_wp_dom_["getRectangleFromRange"])(range);
|
|
|
|
}
|
|
|
|
|
|
|
|
var element = range.startContainer; // If the caret is right before the element, select the next element.
|
|
|
|
|
|
|
|
element = element.nextElementSibling || element;
|
|
|
|
|
|
|
|
while (element.nodeType !== window.Node.ELEMENT_NODE) {
|
|
|
|
element = element.parentNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
var closest = element.closest('a');
|
|
|
|
|
|
|
|
if (closest) {
|
|
|
|
return closest.getBoundingClientRect();
|
|
|
|
}
|
|
|
|
}, [isActive, addingLink, value.start, value.end]);
|
|
|
|
|
|
|
|
if (!anchorRect) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["URLPopover"], Object(esm_extends["a" /* default */])({
|
|
|
|
anchorRect: anchorRect
|
|
|
|
}, props));
|
|
|
|
};
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
var inline_InlineLinkUI =
|
2018-12-14 12:02:53 +01:00
|
|
|
/*#__PURE__*/
|
|
|
|
function (_Component) {
|
2018-12-18 04:14:52 +01:00
|
|
|
Object(inherits["a" /* default */])(InlineLinkUI, _Component);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
function InlineLinkUI() {
|
|
|
|
var _this;
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
Object(classCallCheck["a" /* default */])(this, InlineLinkUI);
|
|
|
|
|
|
|
|
_this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(InlineLinkUI).apply(this, arguments));
|
2019-09-19 17:19:18 +02:00
|
|
|
_this.editLink = _this.editLink.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.submitLink = _this.submitLink.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.onChangeInputValue = _this.onChangeInputValue.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.setLinkTarget = _this.setLinkTarget.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.onFocusOutside = _this.onFocusOutside.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.resetState = _this.resetState.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
2018-12-18 04:14:52 +01:00
|
|
|
_this.autocompleteRef = Object(external_this_wp_element_["createRef"])();
|
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 16:37:00 +01:00
|
|
|
_this.state = {
|
|
|
|
opensInNewWindow: false,
|
|
|
|
inputValue: ''
|
|
|
|
};
|
2018-12-14 12:02:53 +01:00
|
|
|
return _this;
|
|
|
|
}
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
Object(createClass["a" /* default */])(InlineLinkUI, [{
|
2018-12-14 12:02:53 +01:00
|
|
|
key: "onKeyDown",
|
|
|
|
value: function onKeyDown(event) {
|
2018-12-18 04:14:52 +01:00
|
|
|
if ([external_this_wp_keycodes_["LEFT"], external_this_wp_keycodes_["DOWN"], external_this_wp_keycodes_["RIGHT"], external_this_wp_keycodes_["UP"], external_this_wp_keycodes_["BACKSPACE"], external_this_wp_keycodes_["ENTER"]].indexOf(event.keyCode) > -1) {
|
2018-12-14 12:02:53 +01:00
|
|
|
// 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,
|
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 16:37:00 +01:00
|
|
|
_this$props$activeAtt = _this$props.activeAttributes.url,
|
|
|
|
url = _this$props$activeAtt === void 0 ? '' : _this$props$activeAtt,
|
2018-12-14 12:02:53 +01:00
|
|
|
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)) {
|
2018-12-19 04:16:48 +01:00
|
|
|
var selectedText = Object(external_this_wp_richText_["getTextContent"])(Object(external_this_wp_richText_["slice"])(value));
|
2018-12-18 04:14:52 +01:00
|
|
|
onChange(Object(external_this_wp_richText_["applyFormat"])(value, createLinkFormat({
|
2018-12-14 12:02:53 +01:00
|
|
|
url: url,
|
2018-12-15 12:00:40 +01:00
|
|
|
opensInNewWindow: opensInNewWindow,
|
2018-12-19 04:16:48 +01:00
|
|
|
text: selectedText
|
2018-12-14 12:02:53 +01:00
|
|
|
})));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
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;
|
2018-12-18 04:14:52 +01:00
|
|
|
var url = Object(external_this_wp_url_["prependHTTP"])(inputValue);
|
2018-12-19 04:16:48 +01:00
|
|
|
var selectedText = Object(external_this_wp_richText_["getTextContent"])(Object(external_this_wp_richText_["slice"])(value));
|
2018-12-14 12:02:53 +01:00
|
|
|
var format = createLinkFormat({
|
|
|
|
url: url,
|
2018-12-15 12:00:40 +01:00
|
|
|
opensInNewWindow: opensInNewWindow,
|
2018-12-19 04:16:48 +01:00
|
|
|
text: selectedText
|
2018-12-14 12:02:53 +01:00
|
|
|
});
|
|
|
|
event.preventDefault();
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
if (Object(external_this_wp_richText_["isCollapsed"])(value) && !isActive) {
|
|
|
|
var toInsert = Object(external_this_wp_richText_["applyFormat"])(Object(external_this_wp_richText_["create"])({
|
2018-12-14 12:02:53 +01:00
|
|
|
text: url
|
|
|
|
}), format, 0, url.length);
|
2018-12-18 04:14:52 +01:00
|
|
|
onChange(Object(external_this_wp_richText_["insert"])(value, toInsert));
|
2018-12-14 12:02:53 +01:00
|
|
|
} else {
|
2018-12-18 04:14:52 +01:00
|
|
|
onChange(Object(external_this_wp_richText_["applyFormat"])(value, format));
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
this.resetState();
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
if (!isValidHref(url)) {
|
|
|
|
speak(Object(external_this_wp_i18n_["__"])('Warning: the link has been inserted but may have errors. Please test it.'), 'assertive');
|
2018-12-17 05:52:00 +01:00
|
|
|
} else if (isActive) {
|
2018-12-18 04:14:52 +01:00
|
|
|
speak(Object(external_this_wp_i18n_["__"])('Link edited.'), 'assertive');
|
2018-12-14 12:02:53 +01:00
|
|
|
} else {
|
Block Editor: Upgrade the `@wordpress/` packages.
This brings the block editor in core up to date with the Gutenberg 4.8 plugin release.
Props aduth, gziolo, youknowriad, mkaz, jorgefilipecosta, swissspidy, iseulde, soean, noisysocks, joen, brentswisher, dekervit, dimadin, zebulan, johnny5, nosolosw, netweb, ryelle, etoledom, mzorz, desrosj, mmtr86, tinkerbelly, ocean90, earnjam, ajitbohra, talldanwp, notnownikki, mcsf, afercia, adamsilverstein, gutendev, naoki0h, miyauchi, aldavigdis.
Fixes #45885.
Built from https://develop.svn.wordpress.org/trunk@44533
git-svn-id: http://core.svn.wordpress.org/trunk@44364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-10 02:54:56 +01:00
|
|
|
speak(Object(external_this_wp_i18n_["__"])('Link inserted.'), 'assertive');
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
2019-09-19 17:19:18 +02:00
|
|
|
key: "onFocusOutside",
|
|
|
|
value: function onFocusOutside() {
|
2018-12-14 12:02:53 +01:00
|
|
|
// The autocomplete suggestions list renders in a separate popover (in a portal),
|
2019-09-19 17:19:18 +02:00
|
|
|
// so onFocusOutside fails to detect that a click on a suggestion occurred in the
|
2018-12-14 12:02:53 +01:00
|
|
|
// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and
|
|
|
|
// return to avoid the popover being closed.
|
|
|
|
var autocompleteElement = this.autocompleteRef.current;
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
if (autocompleteElement && autocompleteElement.contains(document.activeElement)) {
|
2018-12-14 12:02:53 +01:00
|
|
|
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);
|
2019-04-22 14:40:04 +02:00
|
|
|
return Object(external_this_wp_element_["createElement"])(inline_URLPopoverAtLink, {
|
|
|
|
value: value,
|
|
|
|
isActive: isActive,
|
|
|
|
addingLink: addingLink,
|
2019-09-19 17:19:18 +02:00
|
|
|
onFocusOutside: this.onFocusOutside,
|
Block Editor: Update `@wordpress` dependencies to match Gutenberg 4.5.1.
- Update the annotations, api-fetch, block-library, blocks, components, compose, core-data, data, date, dom, edit-post, editor, element, format-library, html-entities, i18n, jest-console, jest-preset-default, keycodes, list-reusable-blocks, notices, nux, plugins, rich-text, scripts, token-lists, url, viewport packages.
- Upgrades React from 16.5.2 to 16.6.3.
- Adds a missing `wp-date` dependency to the editor script.
- Updates changed dependencies in `script-loader.php`.
- Fixes undefined notices in some blocks.
- Removes incorrect `gutenberg` textdomain.
Merges [43891], [43903], and [43919] to trunk.
Props atimmer, aduth, youknowriad, danielbachhuber.
See #45145.
Built from https://develop.svn.wordpress.org/trunk@44262
git-svn-id: http://core.svn.wordpress.org/trunk@44092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-17 16:37:00 +01:00
|
|
|
onClose: this.resetState,
|
2018-12-14 12:02:53 +01:00
|
|
|
focusOnMount: showInput ? 'firstElement' : false,
|
|
|
|
renderSettings: function renderSettings() {
|
2018-12-18 04:14:52 +01:00
|
|
|
return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], {
|
|
|
|
label: Object(external_this_wp_i18n_["__"])('Open in New Tab'),
|
2018-12-14 12:02:53 +01:00
|
|
|
checked: opensInNewWindow,
|
|
|
|
onChange: _this2.setLinkTarget
|
|
|
|
});
|
|
|
|
}
|
2019-09-19 17:19:18 +02:00
|
|
|
}, showInput ? Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["URLPopover"].LinkEditor, {
|
|
|
|
className: "editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",
|
2018-12-14 12:02:53 +01:00
|
|
|
value: inputValue,
|
|
|
|
onChangeInputValue: this.onChangeInputValue,
|
|
|
|
onKeyDown: this.onKeyDown,
|
2019-09-19 17:19:18 +02:00
|
|
|
onKeyPress: inline_stopKeyPropagation,
|
|
|
|
onSubmit: this.submitLink,
|
2018-12-14 12:02:53 +01:00
|
|
|
autocompleteRef: this.autocompleteRef
|
2019-09-19 17:19:18 +02:00
|
|
|
}) : Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["URLPopover"].LinkViewer, {
|
|
|
|
className: "editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content",
|
|
|
|
onKeyPress: inline_stopKeyPropagation,
|
2018-12-14 12:02:53 +01:00
|
|
|
url: url,
|
2019-09-19 17:19:18 +02:00
|
|
|
onEditLinkClick: this.editLink,
|
|
|
|
linkClassName: isValidHref(Object(external_this_wp_url_["prependHTTP"])(url)) ? undefined : 'has-invalid-link'
|
2019-04-22 14:40:04 +02:00
|
|
|
}));
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
}], [{
|
|
|
|
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;
|
2018-12-18 04:14:52 +01:00
|
|
|
}(external_this_wp_element_["Component"]);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
/* harmony default export */ var inline = (Object(external_this_wp_components_["withSpokenMessages"])(inline_InlineLinkUI));
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/index.js
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
/**
|
2018-12-18 04:14:52 +01:00
|
|
|
* Internal dependencies
|
2018-12-14 12:02:53 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
var link_name = 'core/link';
|
2019-09-19 17:19:18 +02:00
|
|
|
|
|
|
|
var link_title = Object(external_this_wp_i18n_["__"])('Link');
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
var link_link = {
|
|
|
|
name: link_name,
|
2019-09-19 17:19:18 +02:00
|
|
|
title: link_title,
|
2018-12-18 04:14:52 +01:00
|
|
|
tagName: 'a',
|
|
|
|
className: null,
|
|
|
|
attributes: {
|
|
|
|
url: 'href',
|
|
|
|
target: 'target'
|
|
|
|
},
|
2019-09-19 17:19:18 +02:00
|
|
|
__unstablePasteRule: function __unstablePasteRule(value, _ref) {
|
|
|
|
var html = _ref.html,
|
|
|
|
plainText = _ref.plainText;
|
|
|
|
|
|
|
|
if (Object(external_this_wp_richText_["isCollapsed"])(value)) {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
var pastedText = (html || plainText).replace(/<[^>]+>/g, '').trim(); // A URL was pasted, turn the selection into a link
|
|
|
|
|
|
|
|
if (!Object(external_this_wp_url_["isURL"])(pastedText)) {
|
|
|
|
return value;
|
|
|
|
} // Allows us to ask for this information when we get a report.
|
|
|
|
|
|
|
|
|
|
|
|
window.console.log('Created link:\n\n', pastedText);
|
|
|
|
return Object(external_this_wp_richText_["applyFormat"])(value, {
|
|
|
|
type: link_name,
|
|
|
|
attributes: {
|
|
|
|
url: Object(external_this_wp_htmlEntities_["decodeEntities"])(pastedText)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2018-12-18 04:14:52 +01:00
|
|
|
edit: Object(external_this_wp_components_["withSpokenMessages"])(
|
|
|
|
/*#__PURE__*/
|
|
|
|
function (_Component) {
|
|
|
|
Object(inherits["a" /* default */])(LinkEdit, _Component);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
function LinkEdit() {
|
|
|
|
var _this;
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
Object(classCallCheck["a" /* default */])(this, LinkEdit);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
_this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(LinkEdit).apply(this, arguments));
|
2019-09-19 17:19:18 +02:00
|
|
|
_this.addLink = _this.addLink.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.stopAddingLink = _this.stopAddingLink.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
|
|
|
_this.onRemoveFormat = _this.onRemoveFormat.bind(Object(assertThisInitialized["a" /* default */])(_this));
|
2018-12-18 04:14:52 +01:00
|
|
|
_this.state = {
|
|
|
|
addingLink: false
|
|
|
|
};
|
|
|
|
return _this;
|
2018-12-17 05:52:00 +01:00
|
|
|
}
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
Object(createClass["a" /* default */])(LinkEdit, [{
|
|
|
|
key: "addLink",
|
|
|
|
value: function addLink() {
|
|
|
|
var _this$props = this.props,
|
|
|
|
value = _this$props.value,
|
|
|
|
onChange = _this$props.onChange;
|
|
|
|
var text = Object(external_this_wp_richText_["getTextContent"])(Object(external_this_wp_richText_["slice"])(value));
|
2018-12-17 05:52:00 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
if (text && Object(external_this_wp_url_["isURL"])(text)) {
|
|
|
|
onChange(Object(external_this_wp_richText_["applyFormat"])(value, {
|
|
|
|
type: link_name,
|
|
|
|
attributes: {
|
|
|
|
url: text
|
|
|
|
}
|
|
|
|
}));
|
2019-09-19 17:19:18 +02:00
|
|
|
} else if (text && Object(external_this_wp_url_["isEmail"])(text)) {
|
|
|
|
onChange(Object(external_this_wp_richText_["applyFormat"])(value, {
|
|
|
|
type: link_name,
|
|
|
|
attributes: {
|
|
|
|
url: "mailto:".concat(text)
|
|
|
|
}
|
|
|
|
}));
|
2018-12-18 04:14:52 +01:00
|
|
|
} 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(external_this_wp_richText_["removeFormat"])(value, link_name));
|
|
|
|
speak(Object(external_this_wp_i18n_["__"])('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;
|
2019-03-21 13:48:00 +01:00
|
|
|
return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], {
|
2018-12-18 04:14:52 +01:00
|
|
|
type: "primary",
|
|
|
|
character: "k",
|
|
|
|
onUse: this.addLink
|
2019-03-21 13:48:00 +01:00
|
|
|
}), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], {
|
2018-12-18 04:14:52 +01:00
|
|
|
type: "primaryShift",
|
|
|
|
character: "k",
|
|
|
|
onUse: this.onRemoveFormat
|
2019-03-21 13:48:00 +01:00
|
|
|
}), isActive && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], {
|
2018-12-18 04:14:52 +01:00
|
|
|
name: "link",
|
|
|
|
icon: "editor-unlink",
|
|
|
|
title: Object(external_this_wp_i18n_["__"])('Unlink'),
|
|
|
|
onClick: this.onRemoveFormat,
|
|
|
|
isActive: isActive,
|
|
|
|
shortcutType: "primaryShift",
|
|
|
|
shortcutCharacter: "k"
|
2019-03-21 13:48:00 +01:00
|
|
|
}), !isActive && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], {
|
2018-12-18 04:14:52 +01:00
|
|
|
name: "link",
|
|
|
|
icon: "admin-links",
|
2019-09-19 17:19:18 +02:00
|
|
|
title: link_title,
|
2018-12-18 04:14:52 +01:00
|
|
|
onClick: this.addLink,
|
|
|
|
isActive: isActive,
|
|
|
|
shortcutType: "primary",
|
|
|
|
shortcutCharacter: "k"
|
|
|
|
}), Object(external_this_wp_element_["createElement"])(inline, {
|
|
|
|
addingLink: this.state.addingLink,
|
|
|
|
stopAddingLink: this.stopAddingLink,
|
|
|
|
isActive: isActive,
|
|
|
|
activeAttributes: activeAttributes,
|
|
|
|
value: value,
|
|
|
|
onChange: onChange
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}]);
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
return LinkEdit;
|
|
|
|
}(external_this_wp_element_["Component"]))
|
|
|
|
};
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/strikethrough/index.js
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
var strikethrough_name = 'core/strikethrough';
|
2019-09-19 17:19:18 +02:00
|
|
|
|
|
|
|
var strikethrough_title = Object(external_this_wp_i18n_["__"])('Strikethrough');
|
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
var strikethrough = {
|
2018-12-18 04:14:52 +01:00
|
|
|
name: strikethrough_name,
|
2019-09-19 17:19:18 +02:00
|
|
|
title: strikethrough_title,
|
2019-03-21 13:48:00 +01:00
|
|
|
tagName: 's',
|
2018-12-17 05:52:00 +01:00
|
|
|
className: null,
|
2018-12-14 12:02:53 +01:00
|
|
|
edit: function edit(_ref) {
|
|
|
|
var isActive = _ref.isActive,
|
|
|
|
value = _ref.value,
|
2018-12-17 05:52:00 +01:00
|
|
|
onChange = _ref.onChange;
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
var onToggle = function onToggle() {
|
2018-12-18 04:14:52 +01:00
|
|
|
return onChange(Object(external_this_wp_richText_["toggleFormat"])(value, {
|
|
|
|
type: strikethrough_name
|
2018-12-14 12:02:53 +01:00
|
|
|
}));
|
|
|
|
};
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], {
|
2018-12-14 12:02:53 +01:00
|
|
|
icon: "editor-strikethrough",
|
2019-09-19 17:19:18 +02:00
|
|
|
title: strikethrough_title,
|
2018-12-14 12:02:53 +01:00
|
|
|
onClick: onToggle,
|
2019-09-19 17:19:18 +02:00
|
|
|
isActive: isActive
|
|
|
|
});
|
2018-12-14 12:02:53 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/underline/index.js
|
2018-12-14 12:02:53 +01:00
|
|
|
|
2018-12-17 05:52:00 +01:00
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var underline_name = 'core/underline';
|
|
|
|
var underline = {
|
|
|
|
name: underline_name,
|
|
|
|
title: Object(external_this_wp_i18n_["__"])('Underline'),
|
|
|
|
tagName: 'span',
|
|
|
|
className: null,
|
|
|
|
attributes: {
|
|
|
|
style: 'style'
|
|
|
|
},
|
|
|
|
edit: function edit(_ref) {
|
|
|
|
var value = _ref.value,
|
|
|
|
onChange = _ref.onChange;
|
|
|
|
|
|
|
|
var onToggle = function onToggle() {
|
|
|
|
onChange(Object(external_this_wp_richText_["toggleFormat"])(value, {
|
|
|
|
type: underline_name,
|
|
|
|
attributes: {
|
|
|
|
style: 'text-decoration: underline;'
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
|
2019-03-21 13:48:00 +01:00
|
|
|
return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], {
|
2019-03-07 10:09:59 +01:00
|
|
|
type: "primary",
|
|
|
|
character: "u",
|
|
|
|
onUse: onToggle
|
2019-09-19 17:19:18 +02:00
|
|
|
}), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__unstableRichTextInputEvent"], {
|
2019-03-07 10:09:59 +01:00
|
|
|
inputType: "formatUnderline",
|
|
|
|
onInput: onToggle
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/default-formats.js
|
2018-12-18 04:14:52 +01:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2018-12-17 05:52:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
|
|
|
|
/* harmony default export */ var default_formats = ([bold, code, image_image, italic, link_link, strikethrough, underline]);
|
|
|
|
|
|
|
|
// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/index.js
|
|
|
|
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
2018-12-17 05:52:00 +01:00
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2018-12-17 05:52:00 +01:00
|
|
|
|
2019-03-07 10:09:59 +01:00
|
|
|
|
|
|
|
default_formats.forEach(function (_ref) {
|
2018-12-18 04:14:52 +01:00
|
|
|
var name = _ref.name,
|
|
|
|
settings = Object(objectWithoutProperties["a" /* default */])(_ref, ["name"]);
|
2018-12-17 05:52:00 +01:00
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
return Object(external_this_wp_richText_["registerFormatType"])(name, settings);
|
|
|
|
});
|
2018-12-17 05:52:00 +01:00
|
|
|
|
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
/***/ }),
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
/***/ 5:
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ 54:
|
2018-12-14 12:02:53 +01:00
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
2019-09-19 17:19:18 +02:00
|
|
|
(function() { module.exports = this["wp"]["htmlEntities"]; }());
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ 6:
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
(function() { module.exports = this["wp"]["blockEditor"]; }());
|
2018-12-14 12:02:53 +01:00
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2019-03-21 13:48:00 +01:00
|
|
|
/***/ 7:
|
2019-03-07 10:09:59 +01:00
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
|
2019-09-19 17:19:18 +02:00
|
|
|
/* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
|
2019-03-07 10:09:59 +01:00
|
|
|
|
|
|
|
function _objectSpread(target) {
|
|
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
|
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
|
|
var ownKeys = Object.keys(source);
|
|
|
|
|
|
|
|
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
|
|
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
|
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
ownKeys.forEach(function (key) {
|
|
|
|
Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return target;
|
|
|
|
}
|
|
|
|
|
2018-12-14 12:02:53 +01:00
|
|
|
/***/ })
|
|
|
|
|
2018-12-18 04:14:52 +01:00
|
|
|
/******/ });
|