PluginProbe
Gutenberg / 14.5.2
Gutenberg v14.5.2
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | build/format-library/index.js +145 -111 12.6.0 → 14.5.2 View file →
@@ -1,5 +1,5 @@
1 -/******/ (function() { // webpackBootstrap
1 +/******/ (() => { // webpackBootstrap
2 2 /******/ "use strict";
3 3 /******/ // The require scope
4 4 /******/ var __webpack_require__ = {};
5 5 /******/
@@ -4,17 +4,17 @@
4 4 /******/ var __webpack_require__ = {};
5 5 /******/
6 6 /************************************************************************/
7 7 /******/ /* webpack/runtime/make namespace object */
8 -/******/ !function() {
8 +/******/ (() => {
9 9 /******/ // define __esModule on exports
10 -/******/ __webpack_require__.r = function(exports) {
10 +/******/ __webpack_require__.r = (exports) => {
11 11 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
12 12 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
13 13 /******/ }
14 14 /******/ Object.defineProperty(exports, '__esModule', { value: true });
15 15 /******/ };
16 -/******/ }();
16 +/******/ })();
17 17 /******/
18 18 /************************************************************************/
19 19 var __webpack_exports__ = {};
20 20 // ESM COMPAT FLAG
@@ -20,17 +20,17 @@
20 20 // ESM COMPAT FLAG
21 21 __webpack_require__.r(__webpack_exports__);
22 22
23 23 ;// CONCATENATED MODULE: external ["wp","richText"]
24 -var external_wp_richText_namespaceObject = window["wp"]["richText"];
24 +const external_wp_richText_namespaceObject = window["wp"]["richText"];
25 25 ;// CONCATENATED MODULE: external ["wp","element"]
26 -var external_wp_element_namespaceObject = window["wp"]["element"];
26 +const external_wp_element_namespaceObject = window["wp"]["element"];
27 27 ;// CONCATENATED MODULE: external ["wp","i18n"]
28 -var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
28 +const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
29 29 ;// CONCATENATED MODULE: external ["wp","blockEditor"]
30 -var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
30 +const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
31 31 ;// CONCATENATED MODULE: external ["wp","primitives"]
32 -var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
32 +const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
33 33 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-bold.js
34 34
35 35
36 36 /**
@@ -42,10 +42,10 @@
42 42 viewBox: "0 0 24 24"
43 43 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
44 44 d: "M14.7 11.3c1-.6 1.5-1.6 1.5-3 0-2.3-1.3-3.4-4-3.4H7v14h5.8c1.4 0 2.5-.3 3.3-1 .8-.7 1.2-1.7 1.2-2.9.1-1.9-.8-3.1-2.6-3.7zm-5.1-4h2.3c.6 0 1.1.1 1.4.4.3.3.5.7.5 1.2s-.2 1-.5 1.2c-.3.3-.8.4-1.4.4H9.6V7.3zm4.6 9c-.4.3-1 .4-1.7.4H9.6v-3.9h2.9c.7 0 1.3.2 1.7.5.4.3.6.8.6 1.5s-.2 1.2-.6 1.5z"
45 45 }));
46 -/* harmony default export */ var format_bold = (formatBold);
47 -//# sourceMappingURL=format-bold.js.map
46 +/* harmony default export */ const format_bold = (formatBold);
47 +
48 48 ;// CONCATENATED MODULE: ./packages/format-library/build-module/bold/index.js
49 49
50 50
51 51 /**
@@ -105,9 +105,9 @@
105 105 }));
106 106 }
107 107
108 108 };
109 -//# sourceMappingURL=index.js.map
109 +
110 110 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/code.js
111 111
112 112
113 113 /**
@@ -119,10 +119,10 @@
119 119 xmlns: "http://www.w3.org/2000/svg"
120 120 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
121 121 d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"
122 122 }));
123 -/* harmony default export */ var library_code = (code);
124 -//# sourceMappingURL=code.js.map
123 +/* harmony default export */ const library_code = (code);
124 +
125 125 ;// CONCATENATED MODULE: ./packages/format-library/build-module/code/index.js
126 126
127 127
128 128 /**
@@ -191,21 +191,25 @@
191 191 }));
192 192 onFocus();
193 193 }
194 194
195 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
195 + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
196 + type: "access",
197 + character: "x",
198 + onUse: onClick
199 + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
196 200 icon: library_code,
197 201 title: code_title,
198 202 onClick: onClick,
199 203 isActive: isActive,
200 204 role: "menuitemcheckbox"
201 - });
205 + }));
202 206 }
203 207
204 208 };
205 -//# sourceMappingURL=index.js.map
209 +
206 210 ;// CONCATENATED MODULE: external ["wp","components"]
207 -var external_wp_components_namespaceObject = window["wp"]["components"];
211 +const external_wp_components_namespaceObject = window["wp"]["components"];
208 212 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/keyboard-return.js
209 213
210 214
211 215 /**
@@ -217,10 +221,10 @@
217 221 viewBox: "-2 -2 24 24"
218 222 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
219 223 d: "M6.734 16.106l2.176-2.38-1.093-1.028-3.846 4.158 3.846 4.157 1.093-1.027-2.176-2.38h2.811c1.125 0 2.25.03 3.374 0 1.428-.001 3.362-.25 4.963-1.277 1.66-1.065 2.868-2.906 2.868-5.859 0-2.479-1.327-4.896-3.65-5.93-1.82-.813-3.044-.8-4.806-.788l-.567.002v1.5c.184 0 .368 0 .553-.002 1.82-.007 2.704-.014 4.21.657 1.854.827 2.76 2.657 2.76 4.561 0 2.472-.973 3.824-2.178 4.596-1.258.807-2.864 1.04-4.163 1.04h-.02c-1.115.03-2.229 0-3.344 0H6.734z"
220 224 }));
221 -/* harmony default export */ var keyboard_return = (keyboardReturn);
222 -//# sourceMappingURL=keyboard-return.js.map
225 +/* harmony default export */ const keyboard_return = (keyboardReturn);
226 +
223 227 ;// CONCATENATED MODULE: ./packages/format-library/build-module/image/index.js
224 228
225 229
226 230 /**
@@ -263,17 +267,17 @@
263 267 const {
264 268 style
265 269 } = activeObjectAttributes;
266 270 const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(style === null || style === void 0 ? void 0 : style.replace(/\D/g, ''));
267 - const anchorRef = (0,external_wp_richText_namespaceObject.useAnchorRef)({
268 - ref: contentRef,
271 + const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
272 + editableContentElement: contentRef.current,
269 273 value,
270 274 settings: image_image
271 275 });
272 276 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
273 - position: "bottom center",
277 + placement: "bottom",
274 278 focusOnMount: false,
275 - anchorRef: anchorRef,
279 + anchor: popoverAnchor,
276 280 className: "block-editor-format-toolbar__image-popover"
277 281 }, (0,external_wp_element_namespaceObject.createElement)("form", {
278 282 className: "block-editor-format-toolbar__image-container-content",
279 283 onSubmit: event => {
@@ -367,9 +371,9 @@
367 371 activeObjectAttributes: activeObjectAttributes,
368 372 contentRef: contentRef
369 373 }));
370 374 }
371 -//# sourceMappingURL=index.js.map
375 +
372 376 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-italic.js
373 377
374 378
375 379 /**
@@ -381,10 +385,10 @@
381 385 viewBox: "0 0 24 24"
382 386 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
383 387 d: "M12.5 5L10 19h1.9l2.5-14z"
384 388 }));
385 -/* harmony default export */ var format_italic = (formatItalic);
386 -//# sourceMappingURL=format-italic.js.map
389 +/* harmony default export */ const format_italic = (formatItalic);
390 +
387 391 ;// CONCATENATED MODULE: ./packages/format-library/build-module/italic/index.js
388 392
389 393
390 394 /**
@@ -444,13 +448,13 @@
444 448 }));
445 449 }
446 450
447 451 };
448 -//# sourceMappingURL=index.js.map
452 +
449 453 ;// CONCATENATED MODULE: external ["wp","url"]
450 -var external_wp_url_namespaceObject = window["wp"]["url"];
454 +const external_wp_url_namespaceObject = window["wp"]["url"];
451 455 ;// CONCATENATED MODULE: external ["wp","htmlEntities"]
452 -var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
456 +const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
453 457 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/link-off.js
454 458
455 459
456 460 /**
@@ -462,10 +466,10 @@
462 466 viewBox: "0 0 24 24"
463 467 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
464 468 d: "M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z"
465 469 }));
466 -/* harmony default export */ var link_off = (linkOff);
467 -//# sourceMappingURL=link-off.js.map
470 +/* harmony default export */ const link_off = (linkOff);
471 +
468 472 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/link.js
469 473
470 474
471 475 /**
@@ -477,26 +481,19 @@
477 481 viewBox: "0 0 24 24"
478 482 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
479 483 d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z"
480 484 }));
481 -/* harmony default export */ var library_link = (link_link);
482 -//# sourceMappingURL=link.js.map
485 +/* harmony default export */ const library_link = (link_link);
486 +
483 487 ;// CONCATENATED MODULE: external ["wp","a11y"]
484 -var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
488 +const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
485 489 ;// CONCATENATED MODULE: external ["wp","data"]
486 -var external_wp_data_namespaceObject = window["wp"]["data"];
487 -;// CONCATENATED MODULE: external "lodash"
488 -var external_lodash_namespaceObject = window["lodash"];
490 +const external_wp_data_namespaceObject = window["wp"]["data"];
489 491 ;// CONCATENATED MODULE: ./packages/format-library/build-module/link/utils.js
490 492 /**
491 - * External dependencies
492 - */
493 -
494 -/**
495 493 * WordPress dependencies
496 494 */
497 495
498 -
499 496 /**
500 497 * Check for issues with the provided href.
501 498 *
502 499 * @param {string} href The href.
@@ -524,9 +521,9 @@
524 521 } // Add some extra checks for http(s) URIs, since these are the most common use-case.
525 522 // This ensures URIs with an http protocol have exactly two forward slashes following the protocol.
526 523
527 524
528 - if ((0,external_lodash_namespaceObject.startsWith)(protocol, 'http') && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) {
525 + if (protocol.startsWith('http') && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) {
529 526 return false;
530 527 }
531 528
532 529 const authority = (0,external_wp_url_namespaceObject.getAuthority)(trimmedHref);
@@ -554,9 +551,9 @@
554 551 }
555 552 } // Validate anchor links.
556 553
557 554
558 - if ((0,external_lodash_namespaceObject.startsWith)(trimmedHref, '#') && !(0,external_wp_url_namespaceObject.isValidFragment)(trimmedHref)) {
555 + if (trimmedHref.startsWith('#') && !(0,external_wp_url_namespaceObject.isValidFragment)(trimmedHref)) {
559 556 return false;
560 557 }
561 558
562 559 return true;
@@ -611,8 +608,10 @@
611 608
612 609 /* eslint-enable jsdoc/no-undefined-types */
613 610
614 611 function getFormatBoundary(value, format) {
612 + var _newFormats$startInde, _newFormats$endIndex, _newFormats;
613 +
615 614 let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
616 615 let endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
617 616 const EMPTY_BOUNDARIES = {
618 617 start: null,
@@ -629,16 +628,25 @@
629 628 } // Clone formats to avoid modifying source formats.
630 629
631 630
632 631 const newFormats = formats.slice();
633 - const formatAtStart = (0,external_lodash_namespaceObject.find)(newFormats[startIndex], {
634 - type: format.type
632 + const formatAtStart = (_newFormats$startInde = newFormats[startIndex]) === null || _newFormats$startInde === void 0 ? void 0 : _newFormats$startInde.find(_ref2 => {
633 + let {
634 + type
635 + } = _ref2;
636 + return type === format.type;
635 637 });
636 - const formatAtEnd = (0,external_lodash_namespaceObject.find)(newFormats[endIndex], {
637 - type: format.type
638 + const formatAtEnd = (_newFormats$endIndex = newFormats[endIndex]) === null || _newFormats$endIndex === void 0 ? void 0 : _newFormats$endIndex.find(_ref3 => {
639 + let {
640 + type
641 + } = _ref3;
642 + return type === format.type;
638 643 });
639 - const formatAtEndMinusOne = (0,external_lodash_namespaceObject.find)(newFormats[endIndex - 1], {
640 - type: format.type
644 + const formatAtEndMinusOne = (_newFormats = newFormats[endIndex - 1]) === null || _newFormats === void 0 ? void 0 : _newFormats.find(_ref4 => {
645 + let {
646 + type
647 + } = _ref4;
648 + return type === format.type;
641 649 });
642 650
643 651 if (!!formatAtStart) {
644 652 // Set values to conform to "start"
@@ -662,9 +670,9 @@
662 670 const walkingArgs = [newFormats, initialIndex, targetFormat, index]; // Walk the startIndex "backwards" to the leading "edge" of the matching format.
663 671
664 672 startIndex = walkToStart(...walkingArgs); // Walk the endIndex "forwards" until the trailing "edge" of the matching format.
665 673
666 - endIndex = walkToEnd(...walkingArgs); // Safe guard: start index cannot be less than 0
674 + endIndex = walkToEnd(...walkingArgs); // Safe guard: start index cannot be less than 0.
667 675
668 676 startIndex = startIndex < 0 ? 0 : startIndex; // // Return the indicies of the "edges" as the boundaries.
669 677
670 678 return {
@@ -704,14 +712,28 @@
704 712 index = index + inverseDirectionIncrement;
705 713 return index;
706 714 }
707 715
708 -const walkToStart = (0,external_lodash_namespaceObject.partialRight)(walkToBoundary, 'backwards');
709 -const walkToEnd = (0,external_lodash_namespaceObject.partialRight)(walkToBoundary, 'forwards');
710 -//# sourceMappingURL=utils.js.map
716 +const partialRight = function (fn) {
717 + for (var _len = arguments.length, partialArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
718 + partialArgs[_key - 1] = arguments[_key];
719 + }
720 +
721 + return function () {
722 + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
723 + args[_key2] = arguments[_key2];
724 + }
725 +
726 + return fn(...args, ...partialArgs);
727 + };
728 +};
729 +
730 +const walkToStart = partialRight(walkToBoundary, 'backwards');
731 +const walkToEnd = partialRight(walkToBoundary, 'forwards');
732 +
711 733 ;// CONCATENATED MODULE: ./packages/format-library/build-module/link/use-link-instance-key.js
712 734 // Weakly referenced map allows unused ids to be garbage collected.
713 -const weakMap = new WeakMap(); // Incrementing zero-based ID value
735 +const weakMap = new WeakMap(); // Incrementing zero-based ID value.
714 736
715 737 let id = -1;
716 738 const prefix = 'link-control-instance';
717 739
@@ -739,10 +761,10 @@
739 761 weakMap.set(instance, id);
740 762 return getKey(id);
741 763 }
742 764
743 -/* harmony default export */ var use_link_instance_key = (useLinkInstanceKey);
744 -//# sourceMappingURL=use-link-instance-key.js.map
765 +/* harmony default export */ const use_link_instance_key = (useLinkInstanceKey);
766 +
745 767 ;// CONCATENATED MODULE: ./packages/format-library/build-module/link/inline.js
746 768
747 769
748 770 /**
@@ -854,13 +876,13 @@
854 876 text: newText
855 877 }), linkFormat, 0, newText.length);
856 878 onChange((0,external_wp_richText_namespaceObject.insert)(value, toInsert));
857 879 } else {
858 - // Scenario: we have any active text selection or an active format
880 + // Scenario: we have any active text selection or an active format.
859 881 let newValue;
860 882
861 883 if (newText === richTextText) {
862 - // If we're not updating the text then ignore
884 + // If we're not updating the text then ignore.
863 885 newValue = (0,external_wp_richText_namespaceObject.applyFormat)(value, linkFormat);
864 886 } else {
865 887 // Create new RichText value for the new text in order that we
866 888 // can apply formats to it.
@@ -898,10 +920,10 @@
898 920 speak((0,external_wp_i18n_namespaceObject.__)('Link inserted.'), 'assertive');
899 921 }
900 922 }
901 923
902 - const anchorRef = (0,external_wp_richText_namespaceObject.useAnchorRef)({
903 - ref: contentRef,
924 + const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
925 + editableContentElement: contentRef.current,
904 926 value,
905 927 settings: build_module_link_link
906 928 }); // Generate a string based key that is unique to this anchor reference.
907 929 // This is used to force re-mount the LinkControl component to avoid
@@ -907,9 +929,9 @@
907 929 // This is used to force re-mount the LinkControl component to avoid
908 930 // potential stale state bugs caused by the component not being remounted
909 931 // See https://github.com/WordPress/gutenberg/pull/34742.
910 932
911 - const forceRemountKey = use_link_instance_key(anchorRef); // The focusOnMount prop shouldn't evolve during render of a Popover
933 + const forceRemountKey = use_link_instance_key(popoverAnchor); // The focusOnMount prop shouldn't evolve during render of a Popover
912 934 // otherwise it causes a render of the content.
913 935
914 936 const focusOnMount = (0,external_wp_element_namespaceObject.useRef)(addingLink ? 'firstElement' : false);
915 937
@@ -935,12 +957,13 @@
935 957 });
936 958 }
937 959
938 960 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
939 - anchorRef: anchorRef,
961 + anchor: popoverAnchor,
940 962 focusOnMount: focusOnMount.current,
941 963 onClose: stopAddingLink,
942 - position: "bottom center"
964 + placement: "bottom",
965 + shift: true
943 966 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, {
944 967 key: forceRemountKey,
945 968 value: linkValue,
946 969 onChange: onChangeLink,
@@ -974,10 +997,10 @@
974 997
975 998 return (0,external_wp_richText_namespaceObject.slice)(value, textStart, textEnd);
976 999 }
977 1000
978 -/* harmony default export */ var inline = ((0,external_wp_components_namespaceObject.withSpokenMessages)(InlineLinkUI));
979 -//# sourceMappingURL=inline.js.map
1001 +/* harmony default export */ const inline = ((0,external_wp_components_namespaceObject.withSpokenMessages)(InlineLinkUI));
1002 +
980 1003 ;// CONCATENATED MODULE: ./packages/format-library/build-module/link/index.js
981 1004
982 1005
983 1006 /**
@@ -1100,9 +1123,9 @@
1100 1123 if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) {
1101 1124 return value;
1102 1125 }
1103 1126
1104 - const pastedText = (html || plainText).replace(/<[^>]+>/g, '').trim(); // A URL was pasted, turn the selection into a link
1127 + const pastedText = (html || plainText).replace(/<[^>]+>/g, '').trim(); // A URL was pasted, turn the selection into a link.
1105 1128
1106 1129 if (!(0,external_wp_url_namespaceObject.isURL)(pastedText)) {
1107 1130 return value;
1108 1131 } // Allows us to ask for this information when we get a report.
@@ -1118,9 +1141,9 @@
1118 1141 },
1119 1142
1120 1143 edit: link_Edit
1121 1144 };
1122 -//# sourceMappingURL=index.js.map
1145 +
1123 1146 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-strikethrough.js
1124 1147
1125 1148
1126 1149 /**
@@ -1132,10 +1155,10 @@
1132 1155 viewBox: "0 0 24 24"
1133 1156 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1134 1157 d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z"
1135 1158 }));
1136 -/* harmony default export */ var format_strikethrough = (formatStrikethrough);
1137 -//# sourceMappingURL=format-strikethrough.js.map
1159 +/* harmony default export */ const format_strikethrough = (formatStrikethrough);
1160 +
1138 1161 ;// CONCATENATED MODULE: ./packages/format-library/build-module/strikethrough/index.js
1139 1162
1140 1163
1141 1164 /**
@@ -1170,19 +1193,23 @@
1170 1193 }));
1171 1194 onFocus();
1172 1195 }
1173 1196
1174 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1197 + return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
1198 + type: "access",
1199 + character: "d",
1200 + onUse: onClick
1201 + }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1175 1202 icon: format_strikethrough,
1176 1203 title: strikethrough_title,
1177 1204 onClick: onClick,
1178 1205 isActive: isActive,
1179 1206 role: "menuitemcheckbox"
1180 - });
1207 + }));
1181 1208 }
1182 1209
1183 1210 };
1184 -//# sourceMappingURL=index.js.map
1211 +
1185 1212 ;// CONCATENATED MODULE: ./packages/format-library/build-module/underline/index.js
1186 1213
1187 1214
1188 1215 /**
@@ -1230,9 +1257,9 @@
1230 1257 }));
1231 1258 }
1232 1259
1233 1260 };
1234 -//# sourceMappingURL=index.js.map
1261 +
1235 1262 ;// CONCATENATED MODULE: ./packages/icons/build-module/icon/index.js
1236 1263 /**
1237 1264 * WordPress dependencies
1238 1265 */
@@ -1261,10 +1288,10 @@
1261 1288 ...props
1262 1289 });
1263 1290 }
1264 1291
1265 -/* harmony default export */ var icon = (Icon);
1266 -//# sourceMappingURL=index.js.map
1292 +/* harmony default export */ const icon = (Icon);
1293 +
1267 1294 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/text-color.js
1268 1295
1269 1296
1270 1297 /**
@@ -1276,17 +1303,28 @@
1276 1303 viewBox: "0 0 24 24"
1277 1304 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1278 1305 d: "M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z"
1279 1306 }));
1280 -/* harmony default export */ var text_color = (textColor);
1281 -//# sourceMappingURL=text-color.js.map
1282 -;// CONCATENATED MODULE: ./packages/format-library/build-module/text-color/inline.js
1307 +/* harmony default export */ const text_color = (textColor);
1283 1308
1309 +;// CONCATENATED MODULE: ./packages/icons/build-module/library/color.js
1284 1310
1311 +
1285 1312 /**
1286 - * External dependencies
1313 + * WordPress dependencies
1287 1314 */
1288 1315
1316 +const color = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1317 + viewBox: "0 0 24 24",
1318 + xmlns: "http://www.w3.org/2000/svg"
1319 +}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1320 + d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"
1321 +}));
1322 +/* harmony default export */ const library_color = (color);
1323 +
1324 +;// CONCATENATED MODULE: ./packages/format-library/build-module/text-color/inline.js
1325 +
1326 +
1289 1327 /**
1290 1328 * WordPress dependencies
1291 1329 */
1292 1330
@@ -1294,9 +1332,8 @@
1294 1332
1295 1333
1296 1334
1297 1335
1298 -
1299 1336 /**
1300 1337 * Internal dependencies
1301 1338 */
1302 1339
@@ -1389,12 +1426,14 @@
1389 1426 value,
1390 1427 onChange
1391 1428 } = _ref;
1392 1429 const colors = (0,external_wp_data_namespaceObject.useSelect)(select => {
1430 + var _getSettings$colors;
1431 +
1393 1432 const {
1394 1433 getSettings
1395 1434 } = select(external_wp_blockEditor_namespaceObject.store);
1396 - return (0,external_lodash_namespaceObject.get)(getSettings(), ['colors'], []);
1435 + return (_getSettings$colors = getSettings().colors) !== null && _getSettings$colors !== void 0 ? _getSettings$colors : [];
1397 1436 }, []);
1398 1437 const onColorChange = (0,external_wp_element_namespaceObject.useCallback)(color => {
1399 1438 onChange(setColors(value, name, colors, {
1400 1439 [property]: color
@@ -1415,17 +1454,17 @@
1415 1454 onClose,
1416 1455 contentRef
1417 1456 } = _ref2;
1418 1457
1419 - /*
1458 + /*
1420 1459 As you change the text color by typing a HEX value into a field,
1421 1460 the return value of document.getSelection jumps to the field you're editing,
1422 - not the highlighted text. Given that useAnchorRef uses document.getSelection,
1461 + not the highlighted text. Given that useAnchor uses document.getSelection,
1423 1462 it will return null, since it can't find the <mark> element within the HEX input.
1424 1463 This caches the last truthy value of the selection anchor reference.
1425 1464 */
1426 - const anchorRef = (0,external_wp_blockEditor_namespaceObject.useCachedTruthy)((0,external_wp_richText_namespaceObject.useAnchorRef)({
1427 - ref: contentRef,
1465 + const popoverAnchor = (0,external_wp_blockEditor_namespaceObject.useCachedTruthy)((0,external_wp_richText_namespaceObject.useAnchor)({
1466 + editableContentElement: contentRef.current,
1428 1467 value,
1429 1468 settings: text_color_textColor
1430 1469 }));
1431 1470 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
@@ -1430,9 +1469,9 @@
1430 1469 }));
1431 1470 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
1432 1471 onClose: onClose,
1433 1472 className: "components-inline-color-popover",
1434 - anchorRef: anchorRef
1473 + anchor: popoverAnchor
1435 1474 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
1436 1475 tabs: [{
1437 1476 name: 'color',
1438 1477 title: (0,external_wp_i18n_namespaceObject.__)('Text')
@@ -1446,17 +1485,13 @@
1446 1485 value: value,
1447 1486 onChange: onChange
1448 1487 })));
1449 1488 }
1450 -//# sourceMappingURL=inline.js.map
1489 +
1451 1490 ;// CONCATENATED MODULE: ./packages/format-library/build-module/text-color/index.js
1452 1491
1453 1492
1454 1493 /**
1455 - * External dependencies
1456 - */
1457 -
1458 -/**
1459 1494 * WordPress dependencies
1460 1495 */
1461 1496
1462 1497
@@ -1462,9 +1497,8 @@
1462 1497
1463 1498
1464 1499
1465 1500
1466 -
1467 1501 /**
1468 1502 * Internal dependencies
1469 1503 */
1470 1504
@@ -1522,9 +1556,9 @@
1522 1556 const [isAddingColor, setIsAddingColor] = (0,external_wp_element_namespaceObject.useState)(false);
1523 1557 const enableIsAddingColor = (0,external_wp_element_namespaceObject.useCallback)(() => setIsAddingColor(true), [setIsAddingColor]);
1524 1558 const disableIsAddingColor = (0,external_wp_element_namespaceObject.useCallback)(() => setIsAddingColor(false), [setIsAddingColor]);
1525 1559 const colorIndicatorStyle = (0,external_wp_element_namespaceObject.useMemo)(() => fillComputedColors(contentRef.current, getActiveColors(value, text_color_name, colors)), [value, colors]);
1526 - const hasColorsToChoose = !(0,external_lodash_namespaceObject.isEmpty)(colors) || !allowCustomControl;
1560 + const hasColorsToChoose = colors.length || !allowCustomControl;
1527 1561
1528 1562 if (!hasColorsToChoose && !isActive) {
1529 1563 return null;
1530 1564 }
@@ -1532,12 +1566,12 @@
1532 1566 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
1533 1567 className: "format-library-text-color-button",
1534 1568 isActive: isActive,
1535 1569 icon: (0,external_wp_element_namespaceObject.createElement)(icon, {
1536 - icon: text_color,
1570 + icon: Object.keys(activeAttributes).length ? text_color : library_color,
1537 1571 style: colorIndicatorStyle
1538 1572 }),
1539 - title: text_color_title // If has no colors to choose but a color is active remove the color onClick
1573 + title: text_color_title // If has no colors to choose but a color is active remove the color onClick.
1540 1574 ,
1541 1575 onClick: hasColorsToChoose ? enableIsAddingColor : () => onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, text_color_name)),
1542 1576 role: "menuitemcheckbox"
1543 1577 }), isAddingColor && (0,external_wp_element_namespaceObject.createElement)(InlineColorUI, {
@@ -1569,9 +1603,9 @@
1569 1603 *
1570 1604 * @see https://github.com/WordPress/gutenberg/pull/35516
1571 1605 */
1572 1606 __unstableFilterAttributeValue(key, value) {
1573 - if (key !== 'style') return value; // We should not add a background-color if it's already set
1607 + if (key !== 'style') return value; // We should not add a background-color if it's already set.
1574 1608
1575 1609 if (value && value.includes('background-color')) return value;
1576 1610 const addedCSS = ['background-color', transparentValue].join(':'); // Prepend `addedCSS` to avoid a double `;;` as any the existing CSS
1577 1611 // rules will already include a `;`.
@@ -1580,9 +1614,9 @@
1580 1614 },
1581 1615
1582 1616 edit: TextColorEdit
1583 1617 };
1584 -//# sourceMappingURL=index.js.map
1618 +
1585 1619 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/subscript.js
1586 1620
1587 1621
1588 1622 /**
@@ -1594,10 +1628,10 @@
1594 1628 viewBox: "0 0 24 24"
1595 1629 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1596 1630 d: "M16.9 18.3l.8-1.2c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.1-.3-.4-.5-.6-.7-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.2 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3L15 19.4h4.3v-1.2h-2.4zM14.1 7.2h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"
1597 1631 }));
1598 -/* harmony default export */ var library_subscript = (subscript);
1599 -//# sourceMappingURL=subscript.js.map
1632 +/* harmony default export */ const library_subscript = (subscript);
1633 +
1600 1634 ;// CONCATENATED MODULE: ./packages/format-library/build-module/subscript/index.js
1601 1635
1602 1636
1603 1637 /**
@@ -1646,9 +1680,9 @@
1646 1680 });
1647 1681 }
1648 1682
1649 1683 };
1650 -//# sourceMappingURL=index.js.map
1684 +
1651 1685 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/superscript.js
1652 1686
1653 1687
1654 1688 /**
@@ -1660,10 +1694,10 @@
1660 1694 viewBox: "0 0 24 24"
1661 1695 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1662 1696 d: "M16.9 10.3l.8-1.3c.4-.6.7-1.2.9-1.6.2-.4.3-.8.3-1.2 0-.3-.1-.7-.2-1-.2-.2-.4-.4-.7-.6-.3-.2-.6-.3-1-.3s-.8.1-1.1.2c-.3.1-.7.3-1 .6l.1 1.3c.3-.3.5-.5.8-.6s.6-.2.9-.2c.3 0 .5.1.7.2.2.2.2.4.2.7 0 .3-.1.5-.2.8-.1.3-.4.7-.8 1.3l-1.8 2.8h4.3v-1.2h-2.2zm-2.8-3.1h-2L9.5 11 6.9 7.2h-2l3.6 5.3L4.7 18h2l2.7-4 2.7 4h2l-3.8-5.5 3.8-5.3z"
1663 1697 }));
1664 -/* harmony default export */ var library_superscript = (superscript);
1665 -//# sourceMappingURL=superscript.js.map
1698 +/* harmony default export */ const library_superscript = (superscript);
1699 +
1666 1700 ;// CONCATENATED MODULE: ./packages/format-library/build-module/superscript/index.js
1667 1701
1668 1702
1669 1703 /**
@@ -1712,9 +1746,9 @@
1712 1746 });
1713 1747 }
1714 1748
1715 1749 };
1716 -//# sourceMappingURL=index.js.map
1750 +
1717 1751 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/button.js
1718 1752
1719 1753
1720 1754 /**
@@ -1726,10 +1760,10 @@
1726 1760 xmlns: "http://www.w3.org/2000/svg"
1727 1761 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1728 1762 d: "M19 6.5H5c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v7zM8 12.8h8v-1.5H8v1.5z"
1729 1763 }));
1730 -/* harmony default export */ var library_button = (button_button);
1731 -//# sourceMappingURL=button.js.map
1764 +/* harmony default export */ const library_button = (button_button);
1765 +
1732 1766 ;// CONCATENATED MODULE: ./packages/format-library/build-module/keyboard/index.js
1733 1767
1734 1768
1735 1769 /**
@@ -1778,9 +1812,9 @@
1778 1812 });
1779 1813 }
1780 1814
1781 1815 };
1782 -//# sourceMappingURL=index.js.map
1816 +
1783 1817 ;// CONCATENATED MODULE: ./packages/format-library/build-module/default-formats.js
1784 1818 /**
1785 1819 * Internal dependencies
1786 1820 */
@@ -1794,10 +1828,10 @@
1794 1828
1795 1829
1796 1830
1797 1831
1798 -/* harmony default export */ var default_formats = ([bold, code_code, image_image, italic, build_module_link_link, strikethrough, underline, text_color_textColor, subscript_subscript, superscript_superscript, keyboard]);
1799 -//# sourceMappingURL=default-formats.js.map
1832 +/* harmony default export */ const default_formats = ([bold, code_code, image_image, italic, build_module_link_link, strikethrough, underline, text_color_textColor, subscript_subscript, superscript_superscript, keyboard]);
1833 +
1800 1834 ;// CONCATENATED MODULE: ./packages/format-library/build-module/index.js
1801 1835 /**
1802 1836 * WordPress dependencies
1803 1837 */
@@ -1813,8 +1847,8 @@
1813 1847 ...settings
1814 1848 } = _ref;
1815 1849 return (0,external_wp_richText_namespaceObject.registerFormatType)(name, settings);
1816 1850 });
1817 -//# sourceMappingURL=index.js.map
1851 +
1818 1852 (window.wp = window.wp || {}).formatLibrary = __webpack_exports__;
1819 1853 /******/ })()
1820 1854 ;