|
1 this["wp"] = this["wp"] || {}; this["wp"]["formatLibrary"] = |
|
2 /******/ (function(modules) { // webpackBootstrap |
|
3 /******/ // The module cache |
|
4 /******/ var installedModules = {}; |
|
5 /******/ |
|
6 /******/ // The require function |
|
7 /******/ function __webpack_require__(moduleId) { |
|
8 /******/ |
|
9 /******/ // Check if module is in cache |
|
10 /******/ if(installedModules[moduleId]) { |
|
11 /******/ return installedModules[moduleId].exports; |
|
12 /******/ } |
|
13 /******/ // Create a new module (and put it into the cache) |
|
14 /******/ var module = installedModules[moduleId] = { |
|
15 /******/ i: moduleId, |
|
16 /******/ l: false, |
|
17 /******/ exports: {} |
|
18 /******/ }; |
|
19 /******/ |
|
20 /******/ // Execute the module function |
|
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
|
22 /******/ |
|
23 /******/ // Flag the module as loaded |
|
24 /******/ module.l = true; |
|
25 /******/ |
|
26 /******/ // Return the exports of the module |
|
27 /******/ return module.exports; |
|
28 /******/ } |
|
29 /******/ |
|
30 /******/ |
|
31 /******/ // expose the modules object (__webpack_modules__) |
|
32 /******/ __webpack_require__.m = modules; |
|
33 /******/ |
|
34 /******/ // expose the module cache |
|
35 /******/ __webpack_require__.c = installedModules; |
|
36 /******/ |
|
37 /******/ // define getter function for harmony exports |
|
38 /******/ __webpack_require__.d = function(exports, name, getter) { |
|
39 /******/ if(!__webpack_require__.o(exports, name)) { |
|
40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
|
41 /******/ } |
|
42 /******/ }; |
|
43 /******/ |
|
44 /******/ // define __esModule on exports |
|
45 /******/ __webpack_require__.r = function(exports) { |
|
46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
48 /******/ } |
|
49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
50 /******/ }; |
|
51 /******/ |
|
52 /******/ // create a fake namespace object |
|
53 /******/ // mode & 1: value is a module id, require it |
|
54 /******/ // mode & 2: merge all properties of value into the ns |
|
55 /******/ // mode & 4: return value when already ns object |
|
56 /******/ // mode & 8|1: behave like require |
|
57 /******/ __webpack_require__.t = function(value, mode) { |
|
58 /******/ if(mode & 1) value = __webpack_require__(value); |
|
59 /******/ if(mode & 8) return value; |
|
60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
|
61 /******/ var ns = Object.create(null); |
|
62 /******/ __webpack_require__.r(ns); |
|
63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
|
64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
|
65 /******/ return ns; |
|
66 /******/ }; |
|
67 /******/ |
|
68 /******/ // getDefaultExport function for compatibility with non-harmony modules |
|
69 /******/ __webpack_require__.n = function(module) { |
|
70 /******/ var getter = module && module.__esModule ? |
|
71 /******/ function getDefault() { return module['default']; } : |
|
72 /******/ function getModuleExports() { return module; }; |
|
73 /******/ __webpack_require__.d(getter, 'a', getter); |
|
74 /******/ return getter; |
|
75 /******/ }; |
|
76 /******/ |
|
77 /******/ // Object.prototype.hasOwnProperty.call |
|
78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|
79 /******/ |
|
80 /******/ // __webpack_public_path__ |
|
81 /******/ __webpack_require__.p = ""; |
|
82 /******/ |
|
83 /******/ |
|
84 /******/ // Load entry module and return exports |
|
85 /******/ return __webpack_require__(__webpack_require__.s = 367); |
|
86 /******/ }) |
|
87 /************************************************************************/ |
|
88 /******/ ({ |
|
89 |
|
90 /***/ 0: |
|
91 /***/ (function(module, exports) { |
|
92 |
|
93 (function() { module.exports = this["wp"]["element"]; }()); |
|
94 |
|
95 /***/ }), |
|
96 |
|
97 /***/ 1: |
|
98 /***/ (function(module, exports) { |
|
99 |
|
100 (function() { module.exports = this["wp"]["i18n"]; }()); |
|
101 |
|
102 /***/ }), |
|
103 |
|
104 /***/ 10: |
|
105 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
106 |
|
107 "use strict"; |
|
108 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); |
|
109 function _classCallCheck(instance, Constructor) { |
|
110 if (!(instance instanceof Constructor)) { |
|
111 throw new TypeError("Cannot call a class as a function"); |
|
112 } |
|
113 } |
|
114 |
|
115 /***/ }), |
|
116 |
|
117 /***/ 11: |
|
118 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
119 |
|
120 "use strict"; |
|
121 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; }); |
|
122 /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32); |
|
123 /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); |
|
124 |
|
125 |
|
126 function _possibleConstructorReturn(self, call) { |
|
127 if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) { |
|
128 return call; |
|
129 } |
|
130 |
|
131 return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self); |
|
132 } |
|
133 |
|
134 /***/ }), |
|
135 |
|
136 /***/ 12: |
|
137 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
138 |
|
139 "use strict"; |
|
140 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); |
|
141 function _getPrototypeOf(o) { |
|
142 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { |
|
143 return o.__proto__ || Object.getPrototypeOf(o); |
|
144 }; |
|
145 return _getPrototypeOf(o); |
|
146 } |
|
147 |
|
148 /***/ }), |
|
149 |
|
150 /***/ 13: |
|
151 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
152 |
|
153 "use strict"; |
|
154 |
|
155 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js |
|
156 function _setPrototypeOf(o, p) { |
|
157 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { |
|
158 o.__proto__ = p; |
|
159 return o; |
|
160 }; |
|
161 |
|
162 return _setPrototypeOf(o, p); |
|
163 } |
|
164 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js |
|
165 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; }); |
|
166 |
|
167 function _inherits(subClass, superClass) { |
|
168 if (typeof superClass !== "function" && superClass !== null) { |
|
169 throw new TypeError("Super expression must either be null or a function"); |
|
170 } |
|
171 |
|
172 subClass.prototype = Object.create(superClass && superClass.prototype, { |
|
173 constructor: { |
|
174 value: subClass, |
|
175 writable: true, |
|
176 configurable: true |
|
177 } |
|
178 }); |
|
179 if (superClass) _setPrototypeOf(subClass, superClass); |
|
180 } |
|
181 |
|
182 /***/ }), |
|
183 |
|
184 /***/ 15: |
|
185 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
186 |
|
187 "use strict"; |
|
188 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
|
189 function _defineProperty(obj, key, value) { |
|
190 if (key in obj) { |
|
191 Object.defineProperty(obj, key, { |
|
192 value: value, |
|
193 enumerable: true, |
|
194 configurable: true, |
|
195 writable: true |
|
196 }); |
|
197 } else { |
|
198 obj[key] = value; |
|
199 } |
|
200 |
|
201 return obj; |
|
202 } |
|
203 |
|
204 /***/ }), |
|
205 |
|
206 /***/ 16: |
|
207 /***/ (function(module, exports, __webpack_require__) { |
|
208 |
|
209 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
210 Copyright (c) 2017 Jed Watson. |
|
211 Licensed under the MIT License (MIT), see |
|
212 http://jedwatson.github.io/classnames |
|
213 */ |
|
214 /* global define */ |
|
215 |
|
216 (function () { |
|
217 'use strict'; |
|
218 |
|
219 var hasOwn = {}.hasOwnProperty; |
|
220 |
|
221 function classNames () { |
|
222 var classes = []; |
|
223 |
|
224 for (var i = 0; i < arguments.length; i++) { |
|
225 var arg = arguments[i]; |
|
226 if (!arg) continue; |
|
227 |
|
228 var argType = typeof arg; |
|
229 |
|
230 if (argType === 'string' || argType === 'number') { |
|
231 classes.push(arg); |
|
232 } else if (Array.isArray(arg) && arg.length) { |
|
233 var inner = classNames.apply(null, arg); |
|
234 if (inner) { |
|
235 classes.push(inner); |
|
236 } |
|
237 } else if (argType === 'object') { |
|
238 for (var key in arg) { |
|
239 if (hasOwn.call(arg, key) && arg[key]) { |
|
240 classes.push(key); |
|
241 } |
|
242 } |
|
243 } |
|
244 } |
|
245 |
|
246 return classes.join(' '); |
|
247 } |
|
248 |
|
249 if ( true && module.exports) { |
|
250 classNames.default = classNames; |
|
251 module.exports = classNames; |
|
252 } else if (true) { |
|
253 // register as 'classnames', consistent with npm package name |
|
254 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { |
|
255 return classNames; |
|
256 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), |
|
257 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
258 } else {} |
|
259 }()); |
|
260 |
|
261 |
|
262 /***/ }), |
|
263 |
|
264 /***/ 18: |
|
265 /***/ (function(module, exports) { |
|
266 |
|
267 (function() { module.exports = this["wp"]["keycodes"]; }()); |
|
268 |
|
269 /***/ }), |
|
270 |
|
271 /***/ 19: |
|
272 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
273 |
|
274 "use strict"; |
|
275 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); |
|
276 function _extends() { |
|
277 _extends = Object.assign || function (target) { |
|
278 for (var i = 1; i < arguments.length; i++) { |
|
279 var source = arguments[i]; |
|
280 |
|
281 for (var key in source) { |
|
282 if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
283 target[key] = source[key]; |
|
284 } |
|
285 } |
|
286 } |
|
287 |
|
288 return target; |
|
289 }; |
|
290 |
|
291 return _extends.apply(this, arguments); |
|
292 } |
|
293 |
|
294 /***/ }), |
|
295 |
|
296 /***/ 2: |
|
297 /***/ (function(module, exports) { |
|
298 |
|
299 (function() { module.exports = this["lodash"]; }()); |
|
300 |
|
301 /***/ }), |
|
302 |
|
303 /***/ 20: |
|
304 /***/ (function(module, exports) { |
|
305 |
|
306 (function() { module.exports = this["wp"]["richText"]; }()); |
|
307 |
|
308 /***/ }), |
|
309 |
|
310 /***/ 21: |
|
311 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
312 |
|
313 "use strict"; |
|
314 |
|
315 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js |
|
316 function _objectWithoutPropertiesLoose(source, excluded) { |
|
317 if (source == null) return {}; |
|
318 var target = {}; |
|
319 var sourceKeys = Object.keys(source); |
|
320 var key, i; |
|
321 |
|
322 for (i = 0; i < sourceKeys.length; i++) { |
|
323 key = sourceKeys[i]; |
|
324 if (excluded.indexOf(key) >= 0) continue; |
|
325 target[key] = source[key]; |
|
326 } |
|
327 |
|
328 return target; |
|
329 } |
|
330 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js |
|
331 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); |
|
332 |
|
333 function _objectWithoutProperties(source, excluded) { |
|
334 if (source == null) return {}; |
|
335 var target = _objectWithoutPropertiesLoose(source, excluded); |
|
336 var key, i; |
|
337 |
|
338 if (Object.getOwnPropertySymbols) { |
|
339 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); |
|
340 |
|
341 for (i = 0; i < sourceSymbolKeys.length; i++) { |
|
342 key = sourceSymbolKeys[i]; |
|
343 if (excluded.indexOf(key) >= 0) continue; |
|
344 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; |
|
345 target[key] = source[key]; |
|
346 } |
|
347 } |
|
348 |
|
349 return target; |
|
350 } |
|
351 |
|
352 /***/ }), |
|
353 |
|
354 /***/ 24: |
|
355 /***/ (function(module, exports) { |
|
356 |
|
357 (function() { module.exports = this["wp"]["dom"]; }()); |
|
358 |
|
359 /***/ }), |
|
360 |
|
361 /***/ 25: |
|
362 /***/ (function(module, exports) { |
|
363 |
|
364 (function() { module.exports = this["wp"]["url"]; }()); |
|
365 |
|
366 /***/ }), |
|
367 |
|
368 /***/ 3: |
|
369 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
370 |
|
371 "use strict"; |
|
372 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; }); |
|
373 function _assertThisInitialized(self) { |
|
374 if (self === void 0) { |
|
375 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
|
376 } |
|
377 |
|
378 return self; |
|
379 } |
|
380 |
|
381 /***/ }), |
|
382 |
|
383 /***/ 32: |
|
384 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
385 |
|
386 "use strict"; |
|
387 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); |
|
388 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); } |
|
389 |
|
390 function _typeof(obj) { |
|
391 if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { |
|
392 _typeof = function _typeof(obj) { |
|
393 return _typeof2(obj); |
|
394 }; |
|
395 } else { |
|
396 _typeof = function _typeof(obj) { |
|
397 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); |
|
398 }; |
|
399 } |
|
400 |
|
401 return _typeof(obj); |
|
402 } |
|
403 |
|
404 /***/ }), |
|
405 |
|
406 /***/ 367: |
|
407 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
408 |
|
409 "use strict"; |
|
410 __webpack_require__.r(__webpack_exports__); |
|
411 |
|
412 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules |
|
413 var objectWithoutProperties = __webpack_require__(21); |
|
414 |
|
415 // EXTERNAL MODULE: external {"this":["wp","richText"]} |
|
416 var external_this_wp_richText_ = __webpack_require__(20); |
|
417 |
|
418 // EXTERNAL MODULE: external {"this":["wp","element"]} |
|
419 var external_this_wp_element_ = __webpack_require__(0); |
|
420 |
|
421 // EXTERNAL MODULE: external {"this":["wp","i18n"]} |
|
422 var external_this_wp_i18n_ = __webpack_require__(1); |
|
423 |
|
424 // EXTERNAL MODULE: external {"this":["wp","blockEditor"]} |
|
425 var external_this_wp_blockEditor_ = __webpack_require__(8); |
|
426 |
|
427 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/bold/index.js |
|
428 |
|
429 |
|
430 /** |
|
431 * WordPress dependencies |
|
432 */ |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 var bold_name = 'core/bold'; |
|
438 var bold = { |
|
439 name: bold_name, |
|
440 title: Object(external_this_wp_i18n_["__"])('Bold'), |
|
441 tagName: 'strong', |
|
442 className: null, |
|
443 edit: function edit(_ref) { |
|
444 var isActive = _ref.isActive, |
|
445 value = _ref.value, |
|
446 onChange = _ref.onChange; |
|
447 |
|
448 var onToggle = function onToggle() { |
|
449 return onChange(Object(external_this_wp_richText_["toggleFormat"])(value, { |
|
450 type: bold_name |
|
451 })); |
|
452 }; |
|
453 |
|
454 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { |
|
455 type: "primary", |
|
456 character: "b", |
|
457 onUse: onToggle |
|
458 }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], { |
|
459 name: "bold", |
|
460 icon: "editor-bold", |
|
461 title: Object(external_this_wp_i18n_["__"])('Bold'), |
|
462 onClick: onToggle, |
|
463 isActive: isActive, |
|
464 shortcutType: "primary", |
|
465 shortcutCharacter: "b" |
|
466 }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["UnstableRichTextInputEvent"], { |
|
467 inputType: "formatBold", |
|
468 onInput: onToggle |
|
469 })); |
|
470 } |
|
471 }; |
|
472 |
|
473 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/code/index.js |
|
474 |
|
475 |
|
476 /** |
|
477 * WordPress dependencies |
|
478 */ |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 var code_name = 'core/code'; |
|
484 var code = { |
|
485 name: code_name, |
|
486 title: Object(external_this_wp_i18n_["__"])('Code'), |
|
487 tagName: 'code', |
|
488 className: null, |
|
489 edit: function edit(_ref) { |
|
490 var value = _ref.value, |
|
491 onChange = _ref.onChange, |
|
492 isActive = _ref.isActive; |
|
493 |
|
494 var onToggle = function onToggle() { |
|
495 return onChange(Object(external_this_wp_richText_["toggleFormat"])(value, { |
|
496 type: code_name |
|
497 })); |
|
498 }; |
|
499 |
|
500 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { |
|
501 type: "access", |
|
502 character: "x", |
|
503 onUse: onToggle |
|
504 }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], { |
|
505 icon: "editor-code", |
|
506 title: Object(external_this_wp_i18n_["__"])('Code'), |
|
507 onClick: onToggle, |
|
508 isActive: isActive, |
|
509 shortcutType: "access", |
|
510 shortcutCharacter: "x" |
|
511 })); |
|
512 } |
|
513 }; |
|
514 |
|
515 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js |
|
516 var objectSpread = __webpack_require__(7); |
|
517 |
|
518 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js |
|
519 var classCallCheck = __webpack_require__(10); |
|
520 |
|
521 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js |
|
522 var createClass = __webpack_require__(9); |
|
523 |
|
524 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js |
|
525 var possibleConstructorReturn = __webpack_require__(11); |
|
526 |
|
527 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js |
|
528 var getPrototypeOf = __webpack_require__(12); |
|
529 |
|
530 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules |
|
531 var inherits = __webpack_require__(13); |
|
532 |
|
533 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js |
|
534 var assertThisInitialized = __webpack_require__(3); |
|
535 |
|
536 // EXTERNAL MODULE: external {"this":["wp","components"]} |
|
537 var external_this_wp_components_ = __webpack_require__(4); |
|
538 |
|
539 // EXTERNAL MODULE: external {"this":["wp","keycodes"]} |
|
540 var external_this_wp_keycodes_ = __webpack_require__(18); |
|
541 |
|
542 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/image/index.js |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 /** |
|
553 * WordPress dependencies |
|
554 */ |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 var ALLOWED_MEDIA_TYPES = ['image']; |
|
562 var image_name = 'core/image'; |
|
563 |
|
564 var stopKeyPropagation = function stopKeyPropagation(event) { |
|
565 return event.stopPropagation(); |
|
566 }; |
|
567 |
|
568 var image_image = { |
|
569 name: image_name, |
|
570 title: Object(external_this_wp_i18n_["__"])('Image'), |
|
571 keywords: [Object(external_this_wp_i18n_["__"])('photo'), Object(external_this_wp_i18n_["__"])('media')], |
|
572 object: true, |
|
573 tagName: 'img', |
|
574 className: null, |
|
575 attributes: { |
|
576 className: 'class', |
|
577 style: 'style', |
|
578 url: 'src', |
|
579 alt: 'alt' |
|
580 }, |
|
581 edit: |
|
582 /*#__PURE__*/ |
|
583 function (_Component) { |
|
584 Object(inherits["a" /* default */])(ImageEdit, _Component); |
|
585 |
|
586 function ImageEdit() { |
|
587 var _this; |
|
588 |
|
589 Object(classCallCheck["a" /* default */])(this, ImageEdit); |
|
590 |
|
591 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(ImageEdit).apply(this, arguments)); |
|
592 _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
593 _this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
594 _this.openModal = _this.openModal.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
595 _this.closeModal = _this.closeModal.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
596 _this.state = { |
|
597 modal: false |
|
598 }; |
|
599 return _this; |
|
600 } |
|
601 |
|
602 Object(createClass["a" /* default */])(ImageEdit, [{ |
|
603 key: "onChange", |
|
604 value: function onChange(width) { |
|
605 this.setState({ |
|
606 width: width |
|
607 }); |
|
608 } |
|
609 }, { |
|
610 key: "onKeyDown", |
|
611 value: function onKeyDown(event) { |
|
612 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) { |
|
613 // Stop the key event from propagating up to ObserveTyping.startTypingInTextField. |
|
614 event.stopPropagation(); |
|
615 } |
|
616 } |
|
617 }, { |
|
618 key: "openModal", |
|
619 value: function openModal() { |
|
620 this.setState({ |
|
621 modal: true |
|
622 }); |
|
623 } |
|
624 }, { |
|
625 key: "closeModal", |
|
626 value: function closeModal() { |
|
627 this.setState({ |
|
628 modal: false |
|
629 }); |
|
630 } |
|
631 }, { |
|
632 key: "render", |
|
633 value: function render() { |
|
634 var _this2 = this; |
|
635 |
|
636 var _this$props = this.props, |
|
637 value = _this$props.value, |
|
638 onChange = _this$props.onChange, |
|
639 isObjectActive = _this$props.isObjectActive, |
|
640 activeObjectAttributes = _this$props.activeObjectAttributes; |
|
641 var style = activeObjectAttributes.style; // Rerender PositionedAtSelection when the selection changes or when |
|
642 // the width changes. |
|
643 |
|
644 var key = value.start + style; |
|
645 return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUploadCheck"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], { |
|
646 icon: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { |
|
647 xmlns: "http://www.w3.org/2000/svg", |
|
648 viewBox: "0 0 24 24" |
|
649 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { |
|
650 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" |
|
651 })), |
|
652 title: Object(external_this_wp_i18n_["__"])('Inline Image'), |
|
653 onClick: this.openModal, |
|
654 isActive: isObjectActive |
|
655 }), this.state.modal && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaUpload"], { |
|
656 allowedTypes: ALLOWED_MEDIA_TYPES, |
|
657 onSelect: function onSelect(_ref) { |
|
658 var id = _ref.id, |
|
659 url = _ref.url, |
|
660 alt = _ref.alt, |
|
661 width = _ref.width; |
|
662 |
|
663 _this2.closeModal(); |
|
664 |
|
665 onChange(Object(external_this_wp_richText_["insertObject"])(value, { |
|
666 type: image_name, |
|
667 attributes: { |
|
668 className: "wp-image-".concat(id), |
|
669 style: "width: ".concat(Math.min(width, 150), "px;"), |
|
670 url: url, |
|
671 alt: alt |
|
672 } |
|
673 })); |
|
674 }, |
|
675 onClose: this.closeModal, |
|
676 render: function render(_ref2) { |
|
677 var open = _ref2.open; |
|
678 open(); |
|
679 return null; |
|
680 } |
|
681 }), isObjectActive && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["__unstablePositionedAtSelection"], { |
|
682 key: key |
|
683 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Popover"], { |
|
684 position: "bottom center", |
|
685 focusOnMount: false |
|
686 }, Object(external_this_wp_element_["createElement"])("form", { |
|
687 className: "editor-format-toolbar__image-container-content block-editor-format-toolbar__image-container-content", |
|
688 onKeyPress: stopKeyPropagation, |
|
689 onKeyDown: this.onKeyDown, |
|
690 onSubmit: function onSubmit(event) { |
|
691 var newReplacements = value.replacements.slice(); |
|
692 newReplacements[value.start] = { |
|
693 type: image_name, |
|
694 attributes: Object(objectSpread["a" /* default */])({}, activeObjectAttributes, { |
|
695 style: "width: ".concat(_this2.state.width, "px;") |
|
696 }) |
|
697 }; |
|
698 onChange(Object(objectSpread["a" /* default */])({}, value, { |
|
699 replacements: newReplacements |
|
700 })); |
|
701 event.preventDefault(); |
|
702 } |
|
703 }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { |
|
704 className: "editor-format-toolbar__image-container-value block-editor-format-toolbar__image-container-value", |
|
705 type: "number", |
|
706 label: Object(external_this_wp_i18n_["__"])('Width'), |
|
707 value: this.state.width, |
|
708 min: 1, |
|
709 onChange: this.onChange |
|
710 }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { |
|
711 icon: "editor-break", |
|
712 label: Object(external_this_wp_i18n_["__"])('Apply'), |
|
713 type: "submit" |
|
714 }))))); |
|
715 } |
|
716 }], [{ |
|
717 key: "getDerivedStateFromProps", |
|
718 value: function getDerivedStateFromProps(props, state) { |
|
719 var style = props.activeObjectAttributes.style; |
|
720 |
|
721 if (style === state.previousStyle) { |
|
722 return null; |
|
723 } |
|
724 |
|
725 if (!style) { |
|
726 return { |
|
727 width: undefined, |
|
728 previousStyle: style |
|
729 }; |
|
730 } |
|
731 |
|
732 return { |
|
733 width: style.replace(/\D/g, ''), |
|
734 previousStyle: style |
|
735 }; |
|
736 } |
|
737 }]); |
|
738 |
|
739 return ImageEdit; |
|
740 }(external_this_wp_element_["Component"]) |
|
741 }; |
|
742 |
|
743 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/italic/index.js |
|
744 |
|
745 |
|
746 /** |
|
747 * WordPress dependencies |
|
748 */ |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 var italic_name = 'core/italic'; |
|
754 var italic = { |
|
755 name: italic_name, |
|
756 title: Object(external_this_wp_i18n_["__"])('Italic'), |
|
757 tagName: 'em', |
|
758 className: null, |
|
759 edit: function edit(_ref) { |
|
760 var isActive = _ref.isActive, |
|
761 value = _ref.value, |
|
762 onChange = _ref.onChange; |
|
763 |
|
764 var onToggle = function onToggle() { |
|
765 return onChange(Object(external_this_wp_richText_["toggleFormat"])(value, { |
|
766 type: italic_name |
|
767 })); |
|
768 }; |
|
769 |
|
770 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { |
|
771 type: "primary", |
|
772 character: "i", |
|
773 onUse: onToggle |
|
774 }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], { |
|
775 name: "italic", |
|
776 icon: "editor-italic", |
|
777 title: Object(external_this_wp_i18n_["__"])('Italic'), |
|
778 onClick: onToggle, |
|
779 isActive: isActive, |
|
780 shortcutType: "primary", |
|
781 shortcutCharacter: "i" |
|
782 }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["UnstableRichTextInputEvent"], { |
|
783 inputType: "formatItalic", |
|
784 onInput: onToggle |
|
785 })); |
|
786 } |
|
787 }; |
|
788 |
|
789 // EXTERNAL MODULE: external {"this":["wp","url"]} |
|
790 var external_this_wp_url_ = __webpack_require__(25); |
|
791 |
|
792 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
|
793 var esm_extends = __webpack_require__(19); |
|
794 |
|
795 // EXTERNAL MODULE: ./node_modules/classnames/index.js |
|
796 var classnames = __webpack_require__(16); |
|
797 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
|
798 |
|
799 // EXTERNAL MODULE: external {"this":["wp","dom"]} |
|
800 var external_this_wp_dom_ = __webpack_require__(24); |
|
801 |
|
802 // EXTERNAL MODULE: external "lodash" |
|
803 var external_lodash_ = __webpack_require__(2); |
|
804 |
|
805 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/utils.js |
|
806 /** |
|
807 * External dependencies |
|
808 */ |
|
809 |
|
810 /** |
|
811 * WordPress dependencies |
|
812 */ |
|
813 |
|
814 |
|
815 |
|
816 /** |
|
817 * Check for issues with the provided href. |
|
818 * |
|
819 * @param {string} href The href. |
|
820 * |
|
821 * @return {boolean} Is the href invalid? |
|
822 */ |
|
823 |
|
824 function isValidHref(href) { |
|
825 if (!href) { |
|
826 return false; |
|
827 } |
|
828 |
|
829 var trimmedHref = href.trim(); |
|
830 |
|
831 if (!trimmedHref) { |
|
832 return false; |
|
833 } // Does the href start with something that looks like a URL protocol? |
|
834 |
|
835 |
|
836 if (/^\S+:/.test(trimmedHref)) { |
|
837 var protocol = Object(external_this_wp_url_["getProtocol"])(trimmedHref); |
|
838 |
|
839 if (!Object(external_this_wp_url_["isValidProtocol"])(protocol)) { |
|
840 return false; |
|
841 } // Add some extra checks for http(s) URIs, since these are the most common use-case. |
|
842 // This ensures URIs with an http protocol have exactly two forward slashes following the protocol. |
|
843 |
|
844 |
|
845 if (Object(external_lodash_["startsWith"])(protocol, 'http') && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) { |
|
846 return false; |
|
847 } |
|
848 |
|
849 var authority = Object(external_this_wp_url_["getAuthority"])(trimmedHref); |
|
850 |
|
851 if (!Object(external_this_wp_url_["isValidAuthority"])(authority)) { |
|
852 return false; |
|
853 } |
|
854 |
|
855 var path = Object(external_this_wp_url_["getPath"])(trimmedHref); |
|
856 |
|
857 if (path && !Object(external_this_wp_url_["isValidPath"])(path)) { |
|
858 return false; |
|
859 } |
|
860 |
|
861 var queryString = Object(external_this_wp_url_["getQueryString"])(trimmedHref); |
|
862 |
|
863 if (queryString && !Object(external_this_wp_url_["isValidQueryString"])(queryString)) { |
|
864 return false; |
|
865 } |
|
866 |
|
867 var fragment = Object(external_this_wp_url_["getFragment"])(trimmedHref); |
|
868 |
|
869 if (fragment && !Object(external_this_wp_url_["isValidFragment"])(fragment)) { |
|
870 return false; |
|
871 } |
|
872 } // Validate anchor links. |
|
873 |
|
874 |
|
875 if (Object(external_lodash_["startsWith"])(trimmedHref, '#') && !Object(external_this_wp_url_["isValidFragment"])(trimmedHref)) { |
|
876 return false; |
|
877 } |
|
878 |
|
879 return true; |
|
880 } |
|
881 /** |
|
882 * Generates the format object that will be applied to the link text. |
|
883 * |
|
884 * @param {string} url The href of the link. |
|
885 * @param {boolean} opensInNewWindow Whether this link will open in a new window. |
|
886 * @param {Object} text The text that is being hyperlinked. |
|
887 * |
|
888 * @return {Object} The final format object. |
|
889 */ |
|
890 |
|
891 function createLinkFormat(_ref) { |
|
892 var url = _ref.url, |
|
893 opensInNewWindow = _ref.opensInNewWindow, |
|
894 text = _ref.text; |
|
895 var format = { |
|
896 type: 'core/link', |
|
897 attributes: { |
|
898 url: url |
|
899 } |
|
900 }; |
|
901 |
|
902 if (opensInNewWindow) { |
|
903 // translators: accessibility label for external links, where the argument is the link text |
|
904 var label = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('%s (opens in a new tab)'), text); |
|
905 format.attributes.target = '_blank'; |
|
906 format.attributes.rel = 'noreferrer noopener'; |
|
907 format.attributes['aria-label'] = label; |
|
908 } |
|
909 |
|
910 return format; |
|
911 } |
|
912 |
|
913 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/inline.js |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 /** |
|
925 * External dependencies |
|
926 */ |
|
927 |
|
928 /** |
|
929 * WordPress dependencies |
|
930 */ |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 /** |
|
941 * Internal dependencies |
|
942 */ |
|
943 |
|
944 |
|
945 |
|
946 var inline_stopKeyPropagation = function stopKeyPropagation(event) { |
|
947 return event.stopPropagation(); |
|
948 }; |
|
949 |
|
950 function isShowingInput(props, state) { |
|
951 return props.addingLink || state.editLink; |
|
952 } |
|
953 |
|
954 var inline_LinkEditor = function LinkEditor(_ref) { |
|
955 var value = _ref.value, |
|
956 onChangeInputValue = _ref.onChangeInputValue, |
|
957 onKeyDown = _ref.onKeyDown, |
|
958 submitLink = _ref.submitLink, |
|
959 autocompleteRef = _ref.autocompleteRef; |
|
960 return (// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar |
|
961 |
|
962 /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ |
|
963 Object(external_this_wp_element_["createElement"])("form", { |
|
964 className: "editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content", |
|
965 onKeyPress: inline_stopKeyPropagation, |
|
966 onKeyDown: onKeyDown, |
|
967 onSubmit: submitLink |
|
968 }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["URLInput"], { |
|
969 value: value, |
|
970 onChange: onChangeInputValue, |
|
971 autocompleteRef: autocompleteRef |
|
972 }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { |
|
973 icon: "editor-break", |
|
974 label: Object(external_this_wp_i18n_["__"])('Apply'), |
|
975 type: "submit" |
|
976 })) |
|
977 /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */ |
|
978 |
|
979 ); |
|
980 }; |
|
981 |
|
982 var inline_LinkViewerUrl = function LinkViewerUrl(_ref2) { |
|
983 var url = _ref2.url; |
|
984 var prependedURL = Object(external_this_wp_url_["prependHTTP"])(url); |
|
985 var linkClassName = classnames_default()('editor-format-toolbar__link-container-value block-editor-format-toolbar__link-container-value', { |
|
986 'has-invalid-link': !isValidHref(prependedURL) |
|
987 }); |
|
988 |
|
989 if (!url) { |
|
990 return Object(external_this_wp_element_["createElement"])("span", { |
|
991 className: linkClassName |
|
992 }); |
|
993 } |
|
994 |
|
995 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { |
|
996 className: linkClassName, |
|
997 href: url |
|
998 }, Object(external_this_wp_url_["filterURLForDisplay"])(Object(external_this_wp_url_["safeDecodeURI"])(url))); |
|
999 }; |
|
1000 |
|
1001 var inline_URLPopoverAtLink = function URLPopoverAtLink(_ref3) { |
|
1002 var isActive = _ref3.isActive, |
|
1003 addingLink = _ref3.addingLink, |
|
1004 value = _ref3.value, |
|
1005 props = Object(objectWithoutProperties["a" /* default */])(_ref3, ["isActive", "addingLink", "value"]); |
|
1006 |
|
1007 var anchorRect = Object(external_this_wp_element_["useMemo"])(function () { |
|
1008 var selection = window.getSelection(); |
|
1009 var range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null; |
|
1010 |
|
1011 if (!range) { |
|
1012 return; |
|
1013 } |
|
1014 |
|
1015 if (addingLink) { |
|
1016 return Object(external_this_wp_dom_["getRectangleFromRange"])(range); |
|
1017 } |
|
1018 |
|
1019 var element = range.startContainer; // If the caret is right before the element, select the next element. |
|
1020 |
|
1021 element = element.nextElementSibling || element; |
|
1022 |
|
1023 while (element.nodeType !== window.Node.ELEMENT_NODE) { |
|
1024 element = element.parentNode; |
|
1025 } |
|
1026 |
|
1027 var closest = element.closest('a'); |
|
1028 |
|
1029 if (closest) { |
|
1030 return closest.getBoundingClientRect(); |
|
1031 } |
|
1032 }, [isActive, addingLink, value.start, value.end]); |
|
1033 |
|
1034 if (!anchorRect) { |
|
1035 return null; |
|
1036 } |
|
1037 |
|
1038 return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["URLPopover"], Object(esm_extends["a" /* default */])({ |
|
1039 anchorRect: anchorRect |
|
1040 }, props)); |
|
1041 }; |
|
1042 |
|
1043 var inline_LinkViewer = function LinkViewer(_ref4) { |
|
1044 var url = _ref4.url, |
|
1045 editLink = _ref4.editLink; |
|
1046 return (// Disable reason: KeyPress must be suppressed so the block doesn't hide the toolbar |
|
1047 |
|
1048 /* eslint-disable jsx-a11y/no-static-element-interactions */ |
|
1049 Object(external_this_wp_element_["createElement"])("div", { |
|
1050 className: "editor-format-toolbar__link-container-content block-editor-format-toolbar__link-container-content", |
|
1051 onKeyPress: inline_stopKeyPropagation |
|
1052 }, Object(external_this_wp_element_["createElement"])(inline_LinkViewerUrl, { |
|
1053 url: url |
|
1054 }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], { |
|
1055 icon: "edit", |
|
1056 label: Object(external_this_wp_i18n_["__"])('Edit'), |
|
1057 onClick: editLink |
|
1058 })) |
|
1059 /* eslint-enable jsx-a11y/no-static-element-interactions */ |
|
1060 |
|
1061 ); |
|
1062 }; |
|
1063 |
|
1064 var inline_InlineLinkUI = |
|
1065 /*#__PURE__*/ |
|
1066 function (_Component) { |
|
1067 Object(inherits["a" /* default */])(InlineLinkUI, _Component); |
|
1068 |
|
1069 function InlineLinkUI() { |
|
1070 var _this; |
|
1071 |
|
1072 Object(classCallCheck["a" /* default */])(this, InlineLinkUI); |
|
1073 |
|
1074 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(InlineLinkUI).apply(this, arguments)); |
|
1075 _this.editLink = _this.editLink.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
1076 _this.submitLink = _this.submitLink.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
1077 _this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
1078 _this.onChangeInputValue = _this.onChangeInputValue.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
1079 _this.setLinkTarget = _this.setLinkTarget.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
1080 _this.onClickOutside = _this.onClickOutside.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
1081 _this.resetState = _this.resetState.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
1082 _this.autocompleteRef = Object(external_this_wp_element_["createRef"])(); |
|
1083 _this.state = { |
|
1084 opensInNewWindow: false, |
|
1085 inputValue: '' |
|
1086 }; |
|
1087 return _this; |
|
1088 } |
|
1089 |
|
1090 Object(createClass["a" /* default */])(InlineLinkUI, [{ |
|
1091 key: "onKeyDown", |
|
1092 value: function onKeyDown(event) { |
|
1093 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) { |
|
1094 // Stop the key event from propagating up to ObserveTyping.startTypingInTextField. |
|
1095 event.stopPropagation(); |
|
1096 } |
|
1097 } |
|
1098 }, { |
|
1099 key: "onChangeInputValue", |
|
1100 value: function onChangeInputValue(inputValue) { |
|
1101 this.setState({ |
|
1102 inputValue: inputValue |
|
1103 }); |
|
1104 } |
|
1105 }, { |
|
1106 key: "setLinkTarget", |
|
1107 value: function setLinkTarget(opensInNewWindow) { |
|
1108 var _this$props = this.props, |
|
1109 _this$props$activeAtt = _this$props.activeAttributes.url, |
|
1110 url = _this$props$activeAtt === void 0 ? '' : _this$props$activeAtt, |
|
1111 value = _this$props.value, |
|
1112 onChange = _this$props.onChange; |
|
1113 this.setState({ |
|
1114 opensInNewWindow: opensInNewWindow |
|
1115 }); // Apply now if URL is not being edited. |
|
1116 |
|
1117 if (!isShowingInput(this.props, this.state)) { |
|
1118 var selectedText = Object(external_this_wp_richText_["getTextContent"])(Object(external_this_wp_richText_["slice"])(value)); |
|
1119 onChange(Object(external_this_wp_richText_["applyFormat"])(value, createLinkFormat({ |
|
1120 url: url, |
|
1121 opensInNewWindow: opensInNewWindow, |
|
1122 text: selectedText |
|
1123 }))); |
|
1124 } |
|
1125 } |
|
1126 }, { |
|
1127 key: "editLink", |
|
1128 value: function editLink(event) { |
|
1129 this.setState({ |
|
1130 editLink: true |
|
1131 }); |
|
1132 event.preventDefault(); |
|
1133 } |
|
1134 }, { |
|
1135 key: "submitLink", |
|
1136 value: function submitLink(event) { |
|
1137 var _this$props2 = this.props, |
|
1138 isActive = _this$props2.isActive, |
|
1139 value = _this$props2.value, |
|
1140 onChange = _this$props2.onChange, |
|
1141 speak = _this$props2.speak; |
|
1142 var _this$state = this.state, |
|
1143 inputValue = _this$state.inputValue, |
|
1144 opensInNewWindow = _this$state.opensInNewWindow; |
|
1145 var url = Object(external_this_wp_url_["prependHTTP"])(inputValue); |
|
1146 var selectedText = Object(external_this_wp_richText_["getTextContent"])(Object(external_this_wp_richText_["slice"])(value)); |
|
1147 var format = createLinkFormat({ |
|
1148 url: url, |
|
1149 opensInNewWindow: opensInNewWindow, |
|
1150 text: selectedText |
|
1151 }); |
|
1152 event.preventDefault(); |
|
1153 |
|
1154 if (Object(external_this_wp_richText_["isCollapsed"])(value) && !isActive) { |
|
1155 var toInsert = Object(external_this_wp_richText_["applyFormat"])(Object(external_this_wp_richText_["create"])({ |
|
1156 text: url |
|
1157 }), format, 0, url.length); |
|
1158 onChange(Object(external_this_wp_richText_["insert"])(value, toInsert)); |
|
1159 } else { |
|
1160 onChange(Object(external_this_wp_richText_["applyFormat"])(value, format)); |
|
1161 } |
|
1162 |
|
1163 this.resetState(); |
|
1164 |
|
1165 if (!isValidHref(url)) { |
|
1166 speak(Object(external_this_wp_i18n_["__"])('Warning: the link has been inserted but may have errors. Please test it.'), 'assertive'); |
|
1167 } else if (isActive) { |
|
1168 speak(Object(external_this_wp_i18n_["__"])('Link edited.'), 'assertive'); |
|
1169 } else { |
|
1170 speak(Object(external_this_wp_i18n_["__"])('Link inserted.'), 'assertive'); |
|
1171 } |
|
1172 } |
|
1173 }, { |
|
1174 key: "onClickOutside", |
|
1175 value: function onClickOutside(event) { |
|
1176 // The autocomplete suggestions list renders in a separate popover (in a portal), |
|
1177 // so onClickOutside fails to detect that a click on a suggestion occurred in the |
|
1178 // LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and |
|
1179 // return to avoid the popover being closed. |
|
1180 var autocompleteElement = this.autocompleteRef.current; |
|
1181 |
|
1182 if (autocompleteElement && autocompleteElement.contains(event.target)) { |
|
1183 return; |
|
1184 } |
|
1185 |
|
1186 this.resetState(); |
|
1187 } |
|
1188 }, { |
|
1189 key: "resetState", |
|
1190 value: function resetState() { |
|
1191 this.props.stopAddingLink(); |
|
1192 this.setState({ |
|
1193 editLink: false |
|
1194 }); |
|
1195 } |
|
1196 }, { |
|
1197 key: "render", |
|
1198 value: function render() { |
|
1199 var _this2 = this; |
|
1200 |
|
1201 var _this$props3 = this.props, |
|
1202 isActive = _this$props3.isActive, |
|
1203 url = _this$props3.activeAttributes.url, |
|
1204 addingLink = _this$props3.addingLink, |
|
1205 value = _this$props3.value; |
|
1206 |
|
1207 if (!isActive && !addingLink) { |
|
1208 return null; |
|
1209 } |
|
1210 |
|
1211 var _this$state2 = this.state, |
|
1212 inputValue = _this$state2.inputValue, |
|
1213 opensInNewWindow = _this$state2.opensInNewWindow; |
|
1214 var showInput = isShowingInput(this.props, this.state); |
|
1215 return Object(external_this_wp_element_["createElement"])(inline_URLPopoverAtLink, { |
|
1216 value: value, |
|
1217 isActive: isActive, |
|
1218 addingLink: addingLink, |
|
1219 onClickOutside: this.onClickOutside, |
|
1220 onClose: this.resetState, |
|
1221 focusOnMount: showInput ? 'firstElement' : false, |
|
1222 renderSettings: function renderSettings() { |
|
1223 return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { |
|
1224 label: Object(external_this_wp_i18n_["__"])('Open in New Tab'), |
|
1225 checked: opensInNewWindow, |
|
1226 onChange: _this2.setLinkTarget |
|
1227 }); |
|
1228 } |
|
1229 }, showInput ? Object(external_this_wp_element_["createElement"])(inline_LinkEditor, { |
|
1230 value: inputValue, |
|
1231 onChangeInputValue: this.onChangeInputValue, |
|
1232 onKeyDown: this.onKeyDown, |
|
1233 submitLink: this.submitLink, |
|
1234 autocompleteRef: this.autocompleteRef |
|
1235 }) : Object(external_this_wp_element_["createElement"])(inline_LinkViewer, { |
|
1236 url: url, |
|
1237 editLink: this.editLink |
|
1238 })); |
|
1239 } |
|
1240 }], [{ |
|
1241 key: "getDerivedStateFromProps", |
|
1242 value: function getDerivedStateFromProps(props, state) { |
|
1243 var _props$activeAttribut = props.activeAttributes, |
|
1244 url = _props$activeAttribut.url, |
|
1245 target = _props$activeAttribut.target; |
|
1246 var opensInNewWindow = target === '_blank'; |
|
1247 |
|
1248 if (!isShowingInput(props, state)) { |
|
1249 if (url !== state.inputValue) { |
|
1250 return { |
|
1251 inputValue: url |
|
1252 }; |
|
1253 } |
|
1254 |
|
1255 if (opensInNewWindow !== state.opensInNewWindow) { |
|
1256 return { |
|
1257 opensInNewWindow: opensInNewWindow |
|
1258 }; |
|
1259 } |
|
1260 } |
|
1261 |
|
1262 return null; |
|
1263 } |
|
1264 }]); |
|
1265 |
|
1266 return InlineLinkUI; |
|
1267 }(external_this_wp_element_["Component"]); |
|
1268 |
|
1269 /* harmony default export */ var inline = (Object(external_this_wp_components_["withSpokenMessages"])(inline_InlineLinkUI)); |
|
1270 |
|
1271 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/index.js |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 /** |
|
1281 * WordPress dependencies |
|
1282 */ |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 /** |
|
1290 * Internal dependencies |
|
1291 */ |
|
1292 |
|
1293 |
|
1294 var link_name = 'core/link'; |
|
1295 var link_link = { |
|
1296 name: link_name, |
|
1297 title: Object(external_this_wp_i18n_["__"])('Link'), |
|
1298 tagName: 'a', |
|
1299 className: null, |
|
1300 attributes: { |
|
1301 url: 'href', |
|
1302 target: 'target' |
|
1303 }, |
|
1304 edit: Object(external_this_wp_components_["withSpokenMessages"])( |
|
1305 /*#__PURE__*/ |
|
1306 function (_Component) { |
|
1307 Object(inherits["a" /* default */])(LinkEdit, _Component); |
|
1308 |
|
1309 function LinkEdit() { |
|
1310 var _this; |
|
1311 |
|
1312 Object(classCallCheck["a" /* default */])(this, LinkEdit); |
|
1313 |
|
1314 _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(LinkEdit).apply(this, arguments)); |
|
1315 _this.addLink = _this.addLink.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
1316 _this.stopAddingLink = _this.stopAddingLink.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
1317 _this.onRemoveFormat = _this.onRemoveFormat.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))); |
|
1318 _this.state = { |
|
1319 addingLink: false |
|
1320 }; |
|
1321 return _this; |
|
1322 } |
|
1323 |
|
1324 Object(createClass["a" /* default */])(LinkEdit, [{ |
|
1325 key: "addLink", |
|
1326 value: function addLink() { |
|
1327 var _this$props = this.props, |
|
1328 value = _this$props.value, |
|
1329 onChange = _this$props.onChange; |
|
1330 var text = Object(external_this_wp_richText_["getTextContent"])(Object(external_this_wp_richText_["slice"])(value)); |
|
1331 |
|
1332 if (text && Object(external_this_wp_url_["isURL"])(text)) { |
|
1333 onChange(Object(external_this_wp_richText_["applyFormat"])(value, { |
|
1334 type: link_name, |
|
1335 attributes: { |
|
1336 url: text |
|
1337 } |
|
1338 })); |
|
1339 } else { |
|
1340 this.setState({ |
|
1341 addingLink: true |
|
1342 }); |
|
1343 } |
|
1344 } |
|
1345 }, { |
|
1346 key: "stopAddingLink", |
|
1347 value: function stopAddingLink() { |
|
1348 this.setState({ |
|
1349 addingLink: false |
|
1350 }); |
|
1351 } |
|
1352 }, { |
|
1353 key: "onRemoveFormat", |
|
1354 value: function onRemoveFormat() { |
|
1355 var _this$props2 = this.props, |
|
1356 value = _this$props2.value, |
|
1357 onChange = _this$props2.onChange, |
|
1358 speak = _this$props2.speak; |
|
1359 onChange(Object(external_this_wp_richText_["removeFormat"])(value, link_name)); |
|
1360 speak(Object(external_this_wp_i18n_["__"])('Link removed.'), 'assertive'); |
|
1361 } |
|
1362 }, { |
|
1363 key: "render", |
|
1364 value: function render() { |
|
1365 var _this$props3 = this.props, |
|
1366 isActive = _this$props3.isActive, |
|
1367 activeAttributes = _this$props3.activeAttributes, |
|
1368 value = _this$props3.value, |
|
1369 onChange = _this$props3.onChange; |
|
1370 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { |
|
1371 type: "access", |
|
1372 character: "a", |
|
1373 onUse: this.addLink |
|
1374 }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { |
|
1375 type: "access", |
|
1376 character: "s", |
|
1377 onUse: this.onRemoveFormat |
|
1378 }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { |
|
1379 type: "primary", |
|
1380 character: "k", |
|
1381 onUse: this.addLink |
|
1382 }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { |
|
1383 type: "primaryShift", |
|
1384 character: "k", |
|
1385 onUse: this.onRemoveFormat |
|
1386 }), isActive && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], { |
|
1387 name: "link", |
|
1388 icon: "editor-unlink", |
|
1389 title: Object(external_this_wp_i18n_["__"])('Unlink'), |
|
1390 onClick: this.onRemoveFormat, |
|
1391 isActive: isActive, |
|
1392 shortcutType: "primaryShift", |
|
1393 shortcutCharacter: "k" |
|
1394 }), !isActive && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], { |
|
1395 name: "link", |
|
1396 icon: "admin-links", |
|
1397 title: Object(external_this_wp_i18n_["__"])('Link'), |
|
1398 onClick: this.addLink, |
|
1399 isActive: isActive, |
|
1400 shortcutType: "primary", |
|
1401 shortcutCharacter: "k" |
|
1402 }), Object(external_this_wp_element_["createElement"])(inline, { |
|
1403 addingLink: this.state.addingLink, |
|
1404 stopAddingLink: this.stopAddingLink, |
|
1405 isActive: isActive, |
|
1406 activeAttributes: activeAttributes, |
|
1407 value: value, |
|
1408 onChange: onChange |
|
1409 })); |
|
1410 } |
|
1411 }]); |
|
1412 |
|
1413 return LinkEdit; |
|
1414 }(external_this_wp_element_["Component"])) |
|
1415 }; |
|
1416 |
|
1417 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/strikethrough/index.js |
|
1418 |
|
1419 |
|
1420 /** |
|
1421 * WordPress dependencies |
|
1422 */ |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 var strikethrough_name = 'core/strikethrough'; |
|
1428 var strikethrough = { |
|
1429 name: strikethrough_name, |
|
1430 title: Object(external_this_wp_i18n_["__"])('Strikethrough'), |
|
1431 tagName: 's', |
|
1432 className: null, |
|
1433 edit: function edit(_ref) { |
|
1434 var isActive = _ref.isActive, |
|
1435 value = _ref.value, |
|
1436 onChange = _ref.onChange; |
|
1437 |
|
1438 var onToggle = function onToggle() { |
|
1439 return onChange(Object(external_this_wp_richText_["toggleFormat"])(value, { |
|
1440 type: strikethrough_name |
|
1441 })); |
|
1442 }; |
|
1443 |
|
1444 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { |
|
1445 type: "access", |
|
1446 character: "d", |
|
1447 onUse: onToggle |
|
1448 }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextToolbarButton"], { |
|
1449 icon: "editor-strikethrough", |
|
1450 title: Object(external_this_wp_i18n_["__"])('Strikethrough'), |
|
1451 onClick: onToggle, |
|
1452 isActive: isActive, |
|
1453 shortcutType: "access", |
|
1454 shortcutCharacter: "d" |
|
1455 })); |
|
1456 } |
|
1457 }; |
|
1458 |
|
1459 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/underline/index.js |
|
1460 |
|
1461 |
|
1462 /** |
|
1463 * WordPress dependencies |
|
1464 */ |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 var underline_name = 'core/underline'; |
|
1470 var underline = { |
|
1471 name: underline_name, |
|
1472 title: Object(external_this_wp_i18n_["__"])('Underline'), |
|
1473 tagName: 'span', |
|
1474 className: null, |
|
1475 attributes: { |
|
1476 style: 'style' |
|
1477 }, |
|
1478 edit: function edit(_ref) { |
|
1479 var value = _ref.value, |
|
1480 onChange = _ref.onChange; |
|
1481 |
|
1482 var onToggle = function onToggle() { |
|
1483 onChange(Object(external_this_wp_richText_["toggleFormat"])(value, { |
|
1484 type: underline_name, |
|
1485 attributes: { |
|
1486 style: 'text-decoration: underline;' |
|
1487 } |
|
1488 })); |
|
1489 }; |
|
1490 |
|
1491 return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { |
|
1492 type: "primary", |
|
1493 character: "u", |
|
1494 onUse: onToggle |
|
1495 }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["UnstableRichTextInputEvent"], { |
|
1496 inputType: "formatUnderline", |
|
1497 onInput: onToggle |
|
1498 })); |
|
1499 } |
|
1500 }; |
|
1501 |
|
1502 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/default-formats.js |
|
1503 /** |
|
1504 * Internal dependencies |
|
1505 */ |
|
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 /* harmony default export */ var default_formats = ([bold, code, image_image, italic, link_link, strikethrough, underline]); |
|
1514 |
|
1515 // CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/index.js |
|
1516 |
|
1517 |
|
1518 /** |
|
1519 * WordPress dependencies |
|
1520 */ |
|
1521 |
|
1522 /** |
|
1523 * Internal dependencies |
|
1524 */ |
|
1525 |
|
1526 |
|
1527 default_formats.forEach(function (_ref) { |
|
1528 var name = _ref.name, |
|
1529 settings = Object(objectWithoutProperties["a" /* default */])(_ref, ["name"]); |
|
1530 |
|
1531 return Object(external_this_wp_richText_["registerFormatType"])(name, settings); |
|
1532 }); |
|
1533 |
|
1534 |
|
1535 /***/ }), |
|
1536 |
|
1537 /***/ 4: |
|
1538 /***/ (function(module, exports) { |
|
1539 |
|
1540 (function() { module.exports = this["wp"]["components"]; }()); |
|
1541 |
|
1542 /***/ }), |
|
1543 |
|
1544 /***/ 7: |
|
1545 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1546 |
|
1547 "use strict"; |
|
1548 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; }); |
|
1549 /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); |
|
1550 |
|
1551 function _objectSpread(target) { |
|
1552 for (var i = 1; i < arguments.length; i++) { |
|
1553 var source = arguments[i] != null ? arguments[i] : {}; |
|
1554 var ownKeys = Object.keys(source); |
|
1555 |
|
1556 if (typeof Object.getOwnPropertySymbols === 'function') { |
|
1557 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { |
|
1558 return Object.getOwnPropertyDescriptor(source, sym).enumerable; |
|
1559 })); |
|
1560 } |
|
1561 |
|
1562 ownKeys.forEach(function (key) { |
|
1563 Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); |
|
1564 }); |
|
1565 } |
|
1566 |
|
1567 return target; |
|
1568 } |
|
1569 |
|
1570 /***/ }), |
|
1571 |
|
1572 /***/ 8: |
|
1573 /***/ (function(module, exports) { |
|
1574 |
|
1575 (function() { module.exports = this["wp"]["blockEditor"]; }()); |
|
1576 |
|
1577 /***/ }), |
|
1578 |
|
1579 /***/ 9: |
|
1580 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1581 |
|
1582 "use strict"; |
|
1583 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); |
|
1584 function _defineProperties(target, props) { |
|
1585 for (var i = 0; i < props.length; i++) { |
|
1586 var descriptor = props[i]; |
|
1587 descriptor.enumerable = descriptor.enumerable || false; |
|
1588 descriptor.configurable = true; |
|
1589 if ("value" in descriptor) descriptor.writable = true; |
|
1590 Object.defineProperty(target, descriptor.key, descriptor); |
|
1591 } |
|
1592 } |
|
1593 |
|
1594 function _createClass(Constructor, protoProps, staticProps) { |
|
1595 if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
|
1596 if (staticProps) _defineProperties(Constructor, staticProps); |
|
1597 return Constructor; |
|
1598 } |
|
1599 |
|
1600 /***/ }) |
|
1601 |
|
1602 /******/ }); |