[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ "use strict"; 3 /******/ // The require scope 4 /******/ var __webpack_require__ = {}; 5 /******/ 6 /************************************************************************/ 7 /******/ /* webpack/runtime/make namespace object */ 8 /******/ (() => { 9 /******/ // define __esModule on exports 10 /******/ __webpack_require__.r = (exports) => { 11 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 12 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 13 /******/ } 14 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 15 /******/ }; 16 /******/ })(); 17 /******/ 18 /************************************************************************/ 19 var __webpack_exports__ = {}; 20 // ESM COMPAT FLAG 21 __webpack_require__.r(__webpack_exports__); 22 23 ;// CONCATENATED MODULE: external ["wp","richText"] 24 const external_wp_richText_namespaceObject = window["wp"]["richText"]; 25 ;// CONCATENATED MODULE: external ["wp","i18n"] 26 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 27 ;// CONCATENATED MODULE: external ["wp","blockEditor"] 28 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 29 ;// CONCATENATED MODULE: external ["wp","primitives"] 30 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 31 ;// CONCATENATED MODULE: external "ReactJSXRuntime" 32 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 33 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-bold.js 34 /** 35 * WordPress dependencies 36 */ 37 38 39 const formatBold = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 40 xmlns: "http://www.w3.org/2000/svg", 41 viewBox: "0 0 24 24", 42 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 43 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" 44 }) 45 }); 46 /* harmony default export */ const format_bold = (formatBold); 47 48 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/bold/index.js 49 /** 50 * WordPress dependencies 51 */ 52 53 54 55 56 57 58 59 const bold_name = 'core/bold'; 60 const title = (0,external_wp_i18n_namespaceObject.__)('Bold'); 61 const bold = { 62 name: bold_name, 63 title, 64 tagName: 'strong', 65 className: null, 66 edit({ 67 isActive, 68 value, 69 onChange, 70 onFocus 71 }) { 72 function onToggle() { 73 onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, { 74 type: bold_name, 75 title 76 })); 77 } 78 function onClick() { 79 onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, { 80 type: bold_name 81 })); 82 onFocus(); 83 } 84 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 85 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, { 86 type: "primary", 87 character: "b", 88 onUse: onToggle 89 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 90 name: "bold", 91 icon: format_bold, 92 title: title, 93 onClick: onClick, 94 isActive: isActive, 95 shortcutType: "primary", 96 shortcutCharacter: "b" 97 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, { 98 inputType: "formatBold", 99 onInput: onToggle 100 })] 101 }); 102 } 103 }; 104 105 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/code.js 106 /** 107 * WordPress dependencies 108 */ 109 110 111 const code = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 112 viewBox: "0 0 24 24", 113 xmlns: "http://www.w3.org/2000/svg", 114 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 115 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" 116 }) 117 }); 118 /* harmony default export */ const library_code = (code); 119 120 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/code/index.js 121 /** 122 * WordPress dependencies 123 */ 124 125 126 127 128 129 130 131 const code_name = 'core/code'; 132 const code_title = (0,external_wp_i18n_namespaceObject.__)('Inline code'); 133 const code_code = { 134 name: code_name, 135 title: code_title, 136 tagName: 'code', 137 className: null, 138 __unstableInputRule(value) { 139 const BACKTICK = '`'; 140 const { 141 start, 142 text 143 } = value; 144 const characterBefore = text[start - 1]; 145 146 // Quick check the text for the necessary character. 147 if (characterBefore !== BACKTICK) { 148 return value; 149 } 150 if (start - 2 < 0) { 151 return value; 152 } 153 const indexBefore = text.lastIndexOf(BACKTICK, start - 2); 154 if (indexBefore === -1) { 155 return value; 156 } 157 const startIndex = indexBefore; 158 const endIndex = start - 2; 159 if (startIndex === endIndex) { 160 return value; 161 } 162 value = (0,external_wp_richText_namespaceObject.remove)(value, startIndex, startIndex + 1); 163 value = (0,external_wp_richText_namespaceObject.remove)(value, endIndex, endIndex + 1); 164 value = (0,external_wp_richText_namespaceObject.applyFormat)(value, { 165 type: code_name 166 }, startIndex, endIndex); 167 return value; 168 }, 169 edit({ 170 value, 171 onChange, 172 onFocus, 173 isActive 174 }) { 175 function onClick() { 176 onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, { 177 type: code_name, 178 title: code_title 179 })); 180 onFocus(); 181 } 182 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 183 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, { 184 type: "access", 185 character: "x", 186 onUse: onClick 187 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 188 icon: library_code, 189 title: code_title, 190 onClick: onClick, 191 isActive: isActive, 192 role: "menuitemcheckbox" 193 })] 194 }); 195 } 196 }; 197 198 ;// CONCATENATED MODULE: external ["wp","components"] 199 const external_wp_components_namespaceObject = window["wp"]["components"]; 200 ;// CONCATENATED MODULE: external ["wp","element"] 201 const external_wp_element_namespaceObject = window["wp"]["element"]; 202 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/image/index.js 203 /** 204 * WordPress dependencies 205 */ 206 207 208 209 210 211 212 213 214 const ALLOWED_MEDIA_TYPES = ['image']; 215 const image_name = 'core/image'; 216 const image_title = (0,external_wp_i18n_namespaceObject.__)('Inline image'); 217 const image_image = { 218 name: image_name, 219 title: image_title, 220 keywords: [(0,external_wp_i18n_namespaceObject.__)('photo'), (0,external_wp_i18n_namespaceObject.__)('media')], 221 object: true, 222 tagName: 'img', 223 className: null, 224 attributes: { 225 className: 'class', 226 style: 'style', 227 url: 'src', 228 alt: 'alt' 229 }, 230 edit: Edit 231 }; 232 function InlineUI({ 233 value, 234 onChange, 235 activeObjectAttributes, 236 contentRef 237 }) { 238 const { 239 style, 240 alt 241 } = activeObjectAttributes; 242 const width = style?.replace(/\D/g, ''); 243 const [editedWidth, setEditedWidth] = (0,external_wp_element_namespaceObject.useState)(width); 244 const [editedAlt, setEditedAlt] = (0,external_wp_element_namespaceObject.useState)(alt); 245 const hasChanged = editedWidth !== width || editedAlt !== alt; 246 const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({ 247 editableContentElement: contentRef.current, 248 settings: image_image 249 }); 250 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { 251 placement: "bottom", 252 focusOnMount: false, 253 anchor: popoverAnchor, 254 className: "block-editor-format-toolbar__image-popover", 255 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 256 className: "block-editor-format-toolbar__image-container-content", 257 onSubmit: event => { 258 const newReplacements = value.replacements.slice(); 259 newReplacements[value.start] = { 260 type: image_name, 261 attributes: { 262 ...activeObjectAttributes, 263 style: width ? `width: $editedWidth}px;` : '', 264 alt: editedAlt 265 } 266 }; 267 onChange({ 268 ...value, 269 replacements: newReplacements 270 }); 271 event.preventDefault(); 272 }, 273 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 274 spacing: 4, 275 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalNumberControl, { 276 __next40pxDefaultSize: true, 277 label: (0,external_wp_i18n_namespaceObject.__)('Width'), 278 value: editedWidth, 279 min: 1, 280 onChange: newWidth => { 281 setEditedWidth(newWidth); 282 } 283 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextareaControl, { 284 label: (0,external_wp_i18n_namespaceObject.__)('Alternative text'), 285 __nextHasNoMarginBottom: true, 286 value: editedAlt, 287 onChange: newAlt => { 288 setEditedAlt(newAlt); 289 }, 290 help: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 291 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 292 href: 293 // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. 294 (0,external_wp_i18n_namespaceObject.__)('https://www.w3.org/WAI/tutorials/images/decision-tree/'), 295 children: (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the image.') 296 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("br", {}), (0,external_wp_i18n_namespaceObject.__)('Leave empty if decorative.')] 297 }) 298 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 299 justify: "right", 300 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 301 disabled: !hasChanged, 302 accessibleWhenDisabled: true, 303 variant: "primary", 304 type: "submit", 305 size: "compact", 306 children: (0,external_wp_i18n_namespaceObject.__)('Apply') 307 }) 308 })] 309 }) 310 }) 311 }); 312 } 313 function Edit({ 314 value, 315 onChange, 316 onFocus, 317 isObjectActive, 318 activeObjectAttributes, 319 contentRef 320 }) { 321 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, { 322 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.MediaUpload, { 323 allowedTypes: ALLOWED_MEDIA_TYPES, 324 onSelect: ({ 325 id, 326 url, 327 alt, 328 width: imgWidth 329 }) => { 330 onChange((0,external_wp_richText_namespaceObject.insertObject)(value, { 331 type: image_name, 332 attributes: { 333 className: `wp-image-$id}`, 334 style: `width: $Math.min(imgWidth, 150)}px;`, 335 url, 336 alt 337 } 338 })); 339 onFocus(); 340 }, 341 render: ({ 342 open 343 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 344 icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SVG, { 345 xmlns: "http://www.w3.org/2000/svg", 346 viewBox: "0 0 24 24", 347 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Path, { 348 d: "M4 18.5h16V17H4v1.5zM16 13v1.5h4V13h-4zM5.1 15h7.8c.6 0 1.1-.5 1.1-1.1V6.1c0-.6-.5-1.1-1.1-1.1H5.1C4.5 5 4 5.5 4 6.1v7.8c0 .6.5 1.1 1.1 1.1zm.4-8.5h7V10l-1-1c-.3-.3-.8-.3-1 0l-1.6 1.5-1.2-.7c-.3-.2-.6-.2-.9 0l-1.3 1V6.5zm0 6.1l1.8-1.3 1.3.8c.3.2.7.2.9-.1l1.5-1.4 1.5 1.4v1.5h-7v-.9z" 349 }) 350 }), 351 title: image_title, 352 onClick: open, 353 isActive: isObjectActive 354 }) 355 }), isObjectActive && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineUI, { 356 value: value, 357 onChange: onChange, 358 activeObjectAttributes: activeObjectAttributes, 359 contentRef: contentRef 360 })] 361 }); 362 } 363 364 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-italic.js 365 /** 366 * WordPress dependencies 367 */ 368 369 370 const formatItalic = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 371 xmlns: "http://www.w3.org/2000/svg", 372 viewBox: "0 0 24 24", 373 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 374 d: "M12.5 5L10 19h1.9l2.5-14z" 375 }) 376 }); 377 /* harmony default export */ const format_italic = (formatItalic); 378 379 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/italic/index.js 380 /** 381 * WordPress dependencies 382 */ 383 384 385 386 387 388 389 390 const italic_name = 'core/italic'; 391 const italic_title = (0,external_wp_i18n_namespaceObject.__)('Italic'); 392 const italic = { 393 name: italic_name, 394 title: italic_title, 395 tagName: 'em', 396 className: null, 397 edit({ 398 isActive, 399 value, 400 onChange, 401 onFocus 402 }) { 403 function onToggle() { 404 onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, { 405 type: italic_name, 406 title: italic_title 407 })); 408 } 409 function onClick() { 410 onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, { 411 type: italic_name 412 })); 413 onFocus(); 414 } 415 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 416 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, { 417 type: "primary", 418 character: "i", 419 onUse: onToggle 420 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 421 name: "italic", 422 icon: format_italic, 423 title: italic_title, 424 onClick: onClick, 425 isActive: isActive, 426 shortcutType: "primary", 427 shortcutCharacter: "i" 428 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, { 429 inputType: "formatItalic", 430 onInput: onToggle 431 })] 432 }); 433 } 434 }; 435 436 ;// CONCATENATED MODULE: external ["wp","url"] 437 const external_wp_url_namespaceObject = window["wp"]["url"]; 438 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] 439 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 440 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js 441 /** 442 * WordPress dependencies 443 */ 444 445 446 const link_link = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 447 xmlns: "http://www.w3.org/2000/svg", 448 viewBox: "0 0 24 24", 449 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 450 d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" 451 }) 452 }); 453 /* harmony default export */ const library_link = (link_link); 454 455 ;// CONCATENATED MODULE: external ["wp","a11y"] 456 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 457 ;// CONCATENATED MODULE: external ["wp","data"] 458 const external_wp_data_namespaceObject = window["wp"]["data"]; 459 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/utils.js 460 /** 461 * WordPress dependencies 462 */ 463 464 465 /** 466 * Check for issues with the provided href. 467 * 468 * @param {string} href The href. 469 * 470 * @return {boolean} Is the href invalid? 471 */ 472 function isValidHref(href) { 473 if (!href) { 474 return false; 475 } 476 const trimmedHref = href.trim(); 477 if (!trimmedHref) { 478 return false; 479 } 480 481 // Does the href start with something that looks like a URL protocol? 482 if (/^\S+:/.test(trimmedHref)) { 483 const protocol = (0,external_wp_url_namespaceObject.getProtocol)(trimmedHref); 484 if (!(0,external_wp_url_namespaceObject.isValidProtocol)(protocol)) { 485 return false; 486 } 487 488 // Add some extra checks for http(s) URIs, since these are the most common use-case. 489 // This ensures URIs with an http protocol have exactly two forward slashes following the protocol. 490 if (protocol.startsWith('http') && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) { 491 return false; 492 } 493 const authority = (0,external_wp_url_namespaceObject.getAuthority)(trimmedHref); 494 if (!(0,external_wp_url_namespaceObject.isValidAuthority)(authority)) { 495 return false; 496 } 497 const path = (0,external_wp_url_namespaceObject.getPath)(trimmedHref); 498 if (path && !(0,external_wp_url_namespaceObject.isValidPath)(path)) { 499 return false; 500 } 501 const queryString = (0,external_wp_url_namespaceObject.getQueryString)(trimmedHref); 502 if (queryString && !(0,external_wp_url_namespaceObject.isValidQueryString)(queryString)) { 503 return false; 504 } 505 const fragment = (0,external_wp_url_namespaceObject.getFragment)(trimmedHref); 506 if (fragment && !(0,external_wp_url_namespaceObject.isValidFragment)(fragment)) { 507 return false; 508 } 509 } 510 511 // Validate anchor links. 512 if (trimmedHref.startsWith('#') && !(0,external_wp_url_namespaceObject.isValidFragment)(trimmedHref)) { 513 return false; 514 } 515 return true; 516 } 517 518 /** 519 * Generates the format object that will be applied to the link text. 520 * 521 * @param {Object} options 522 * @param {string} options.url The href of the link. 523 * @param {string} options.type The type of the link. 524 * @param {string} options.id The ID of the link. 525 * @param {boolean} options.opensInNewWindow Whether this link will open in a new window. 526 * @param {boolean} options.nofollow Whether this link is marked as no follow relationship. 527 * @return {Object} The final format object. 528 */ 529 function createLinkFormat({ 530 url, 531 type, 532 id, 533 opensInNewWindow, 534 nofollow 535 }) { 536 const format = { 537 type: 'core/link', 538 attributes: { 539 url 540 } 541 }; 542 if (type) { 543 format.attributes.type = type; 544 } 545 if (id) { 546 format.attributes.id = id; 547 } 548 if (opensInNewWindow) { 549 format.attributes.target = '_blank'; 550 format.attributes.rel = format.attributes.rel ? format.attributes.rel + ' noreferrer noopener' : 'noreferrer noopener'; 551 } 552 if (nofollow) { 553 format.attributes.rel = format.attributes.rel ? format.attributes.rel + ' nofollow' : 'nofollow'; 554 } 555 return format; 556 } 557 558 /* eslint-disable jsdoc/no-undefined-types */ 559 /** 560 * Get the start and end boundaries of a given format from a rich text value. 561 * 562 * 563 * @param {RichTextValue} value the rich text value to interrogate. 564 * @param {string} format the identifier for the target format (e.g. `core/link`, `core/bold`). 565 * @param {number?} startIndex optional startIndex to seek from. 566 * @param {number?} endIndex optional endIndex to seek from. 567 * @return {Object} object containing start and end values for the given format. 568 */ 569 /* eslint-enable jsdoc/no-undefined-types */ 570 function getFormatBoundary(value, format, startIndex = value.start, endIndex = value.end) { 571 const EMPTY_BOUNDARIES = { 572 start: null, 573 end: null 574 }; 575 const { 576 formats 577 } = value; 578 let targetFormat; 579 let initialIndex; 580 if (!formats?.length) { 581 return EMPTY_BOUNDARIES; 582 } 583 584 // Clone formats to avoid modifying source formats. 585 const newFormats = formats.slice(); 586 const formatAtStart = newFormats[startIndex]?.find(({ 587 type 588 }) => type === format.type); 589 const formatAtEnd = newFormats[endIndex]?.find(({ 590 type 591 }) => type === format.type); 592 const formatAtEndMinusOne = newFormats[endIndex - 1]?.find(({ 593 type 594 }) => type === format.type); 595 if (!!formatAtStart) { 596 // Set values to conform to "start" 597 targetFormat = formatAtStart; 598 initialIndex = startIndex; 599 } else if (!!formatAtEnd) { 600 // Set values to conform to "end" 601 targetFormat = formatAtEnd; 602 initialIndex = endIndex; 603 } else if (!!formatAtEndMinusOne) { 604 // This is an edge case which will occur if you create a format, then place 605 // the caret just before the format and hit the back ARROW key. The resulting 606 // value object will have start and end +1 beyond the edge of the format boundary. 607 targetFormat = formatAtEndMinusOne; 608 initialIndex = endIndex - 1; 609 } else { 610 return EMPTY_BOUNDARIES; 611 } 612 const index = newFormats[initialIndex].indexOf(targetFormat); 613 const walkingArgs = [newFormats, initialIndex, targetFormat, index]; 614 615 // Walk the startIndex "backwards" to the leading "edge" of the matching format. 616 startIndex = walkToStart(...walkingArgs); 617 618 // Walk the endIndex "forwards" until the trailing "edge" of the matching format. 619 endIndex = walkToEnd(...walkingArgs); 620 621 // Safe guard: start index cannot be less than 0. 622 startIndex = startIndex < 0 ? 0 : startIndex; 623 624 // // Return the indicies of the "edges" as the boundaries. 625 return { 626 start: startIndex, 627 end: endIndex 628 }; 629 } 630 631 /** 632 * Walks forwards/backwards towards the boundary of a given format within an 633 * array of format objects. Returns the index of the boundary. 634 * 635 * @param {Array} formats the formats to search for the given format type. 636 * @param {number} initialIndex the starting index from which to walk. 637 * @param {Object} targetFormatRef a reference to the format type object being sought. 638 * @param {number} formatIndex the index at which we expect the target format object to be. 639 * @param {string} direction either 'forwards' or 'backwards' to indicate the direction. 640 * @return {number} the index of the boundary of the given format. 641 */ 642 function walkToBoundary(formats, initialIndex, targetFormatRef, formatIndex, direction) { 643 let index = initialIndex; 644 const directions = { 645 forwards: 1, 646 backwards: -1 647 }; 648 const directionIncrement = directions[direction] || 1; // invalid direction arg default to forwards 649 const inverseDirectionIncrement = directionIncrement * -1; 650 while (formats[index] && formats[index][formatIndex] === targetFormatRef) { 651 // Increment/decrement in the direction of operation. 652 index = index + directionIncrement; 653 } 654 655 // Restore by one in inverse direction of operation 656 // to avoid out of bounds. 657 index = index + inverseDirectionIncrement; 658 return index; 659 } 660 const partialRight = (fn, ...partialArgs) => (...args) => fn(...args, ...partialArgs); 661 const walkToStart = partialRight(walkToBoundary, 'backwards'); 662 const walkToEnd = partialRight(walkToBoundary, 'forwards'); 663 664 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/inline.js 665 /** 666 * WordPress dependencies 667 */ 668 669 670 671 672 673 674 675 676 677 /** 678 * Internal dependencies 679 */ 680 681 682 683 const LINK_SETTINGS = [...external_wp_blockEditor_namespaceObject.__experimentalLinkControl.DEFAULT_LINK_SETTINGS, { 684 id: 'nofollow', 685 title: (0,external_wp_i18n_namespaceObject.__)('Mark as nofollow') 686 }]; 687 function InlineLinkUI({ 688 isActive, 689 activeAttributes, 690 value, 691 onChange, 692 onFocusOutside, 693 stopAddingLink, 694 contentRef, 695 focusOnMount 696 }) { 697 const richLinkTextValue = getRichTextValueFromSelection(value, isActive); 698 699 // Get the text content minus any HTML tags. 700 const richTextText = richLinkTextValue.text; 701 const { 702 selectionChange 703 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 704 const { 705 createPageEntity, 706 userCanCreatePages, 707 selectionStart 708 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 709 const { 710 getSettings, 711 getSelectionStart 712 } = select(external_wp_blockEditor_namespaceObject.store); 713 const _settings = getSettings(); 714 return { 715 createPageEntity: _settings.__experimentalCreatePageEntity, 716 userCanCreatePages: _settings.__experimentalUserCanCreatePages, 717 selectionStart: getSelectionStart() 718 }; 719 }, []); 720 const linkValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 721 url: activeAttributes.url, 722 type: activeAttributes.type, 723 id: activeAttributes.id, 724 opensInNewTab: activeAttributes.target === '_blank', 725 nofollow: activeAttributes.rel?.includes('nofollow'), 726 title: richTextText 727 }), [activeAttributes.id, activeAttributes.rel, activeAttributes.target, activeAttributes.type, activeAttributes.url, richTextText]); 728 function removeLink() { 729 const newValue = (0,external_wp_richText_namespaceObject.removeFormat)(value, 'core/link'); 730 onChange(newValue); 731 stopAddingLink(); 732 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive'); 733 } 734 function onChangeLink(nextValue) { 735 const hasLink = linkValue?.url; 736 const isNewLink = !hasLink; 737 738 // Merge the next value with the current link value. 739 nextValue = { 740 ...linkValue, 741 ...nextValue 742 }; 743 const newUrl = (0,external_wp_url_namespaceObject.prependHTTP)(nextValue.url); 744 const linkFormat = createLinkFormat({ 745 url: newUrl, 746 type: nextValue.type, 747 id: nextValue.id !== undefined && nextValue.id !== null ? String(nextValue.id) : undefined, 748 opensInNewWindow: nextValue.opensInNewTab, 749 nofollow: nextValue.nofollow 750 }); 751 const newText = nextValue.title || newUrl; 752 753 // Scenario: we have any active text selection or an active format. 754 let newValue; 755 if ((0,external_wp_richText_namespaceObject.isCollapsed)(value) && !isActive) { 756 // Scenario: we don't have any actively selected text or formats. 757 const inserted = (0,external_wp_richText_namespaceObject.insert)(value, newText); 758 newValue = (0,external_wp_richText_namespaceObject.applyFormat)(inserted, linkFormat, value.start, value.start + newText.length); 759 onChange(newValue); 760 761 // Close the Link UI. 762 stopAddingLink(); 763 764 // Move the selection to the end of the inserted link outside of the format boundary 765 // so the user can continue typing after the link. 766 selectionChange({ 767 clientId: selectionStart.clientId, 768 identifier: selectionStart.attributeKey, 769 start: value.start + newText.length + 1 770 }); 771 return; 772 } else if (newText === richTextText) { 773 newValue = (0,external_wp_richText_namespaceObject.applyFormat)(value, linkFormat); 774 } else { 775 // Scenario: Editing an existing link. 776 777 // Create new RichText value for the new text in order that we 778 // can apply formats to it. 779 newValue = (0,external_wp_richText_namespaceObject.create)({ 780 text: newText 781 }); 782 // Apply the new Link format to this new text value. 783 newValue = (0,external_wp_richText_namespaceObject.applyFormat)(newValue, linkFormat, 0, newText.length); 784 785 // Get the boundaries of the active link format. 786 const boundary = getFormatBoundary(value, { 787 type: 'core/link' 788 }); 789 790 // Split the value at the start of the active link format. 791 // Passing "start" as the 3rd parameter is required to ensure 792 // the second half of the split value is split at the format's 793 // start boundary and avoids relying on the value's "end" property 794 // which may not correspond correctly. 795 const [valBefore, valAfter] = (0,external_wp_richText_namespaceObject.split)(value, boundary.start, boundary.start); 796 797 // Update the original (full) RichTextValue replacing the 798 // target text with the *new* RichTextValue containing: 799 // 1. The new text content. 800 // 2. The new link format. 801 // As "replace" will operate on the first match only, it is 802 // run only against the second half of the value which was 803 // split at the active format's boundary. This avoids a bug 804 // with incorrectly targetted replacements. 805 // See: https://github.com/WordPress/gutenberg/issues/41771. 806 // Note original formats will be lost when applying this change. 807 // That is expected behaviour. 808 // See: https://github.com/WordPress/gutenberg/pull/33849#issuecomment-936134179. 809 const newValAfter = (0,external_wp_richText_namespaceObject.replace)(valAfter, richTextText, newValue); 810 newValue = (0,external_wp_richText_namespaceObject.concat)(valBefore, newValAfter); 811 } 812 onChange(newValue); 813 814 // Focus should only be returned to the rich text on submit if this link is not 815 // being created for the first time. If it is then focus should remain within the 816 // Link UI because it should remain open for the user to modify the link they have 817 // just created. 818 if (!isNewLink) { 819 stopAddingLink(); 820 } 821 if (!isValidHref(newUrl)) { 822 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Warning: the link has been inserted but may have errors. Please test it.'), 'assertive'); 823 } else if (isActive) { 824 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link edited.'), 'assertive'); 825 } else { 826 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link inserted.'), 'assertive'); 827 } 828 } 829 const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({ 830 editableContentElement: contentRef.current, 831 settings: { 832 ...build_module_link_link, 833 isActive 834 } 835 }); 836 async function handleCreate(pageTitle) { 837 const page = await createPageEntity({ 838 title: pageTitle, 839 status: 'draft' 840 }); 841 return { 842 id: page.id, 843 type: page.type, 844 title: page.title.rendered, 845 url: page.link, 846 kind: 'post-type' 847 }; 848 } 849 function createButtonText(searchTerm) { 850 return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: search term. */ 851 (0,external_wp_i18n_namespaceObject.__)('Create page: <mark>%s</mark>'), searchTerm), { 852 mark: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("mark", {}) 853 }); 854 } 855 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { 856 anchor: popoverAnchor, 857 animate: false, 858 onClose: stopAddingLink, 859 onFocusOutside: onFocusOutside, 860 placement: "bottom", 861 offset: 8, 862 shift: true, 863 focusOnMount: focusOnMount, 864 constrainTabbing: true, 865 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, { 866 value: linkValue, 867 onChange: onChangeLink, 868 onRemove: removeLink, 869 hasRichPreviews: true, 870 createSuggestion: createPageEntity && handleCreate, 871 withCreateSuggestion: userCanCreatePages, 872 createSuggestionButtonText: createButtonText, 873 hasTextControl: true, 874 settings: LINK_SETTINGS, 875 showInitialSuggestions: true, 876 suggestionsQuery: { 877 // always show Pages as initial suggestions 878 initialSuggestionsSearchOptions: { 879 type: 'post', 880 subtype: 'page', 881 perPage: 20 882 } 883 } 884 }) 885 }); 886 } 887 function getRichTextValueFromSelection(value, isActive) { 888 // Default to the selection ranges on the RichTextValue object. 889 let textStart = value.start; 890 let textEnd = value.end; 891 892 // If the format is currently active then the rich text value 893 // should always be taken from the bounds of the active format 894 // and not the selected text. 895 if (isActive) { 896 const boundary = getFormatBoundary(value, { 897 type: 'core/link' 898 }); 899 textStart = boundary.start; 900 901 // Text *selection* always extends +1 beyond the edge of the format. 902 // We account for that here. 903 textEnd = boundary.end + 1; 904 } 905 906 // Get a RichTextValue containing the selected text content. 907 return (0,external_wp_richText_namespaceObject.slice)(value, textStart, textEnd); 908 } 909 /* harmony default export */ const inline = (InlineLinkUI); 910 911 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/index.js 912 /** 913 * WordPress dependencies 914 */ 915 916 917 918 919 920 921 922 923 924 /** 925 * Internal dependencies 926 */ 927 928 929 930 931 932 const link_name = 'core/link'; 933 const link_title = (0,external_wp_i18n_namespaceObject.__)('Link'); 934 function link_Edit({ 935 isActive, 936 activeAttributes, 937 value, 938 onChange, 939 onFocus, 940 contentRef 941 }) { 942 const [addingLink, setAddingLink] = (0,external_wp_element_namespaceObject.useState)(false); 943 944 // We only need to store the button element that opened the popover. We can ignore the other states, as they will be handled by the onFocus prop to return to the rich text field. 945 const [openedBy, setOpenedBy] = (0,external_wp_element_namespaceObject.useState)(null); 946 (0,external_wp_element_namespaceObject.useEffect)(() => { 947 // When the link becomes inactive (i.e. isActive is false), reset the editingLink state 948 // and the creatingLink state. This means that if the Link UI is displayed and the link 949 // becomes inactive (e.g. used arrow keys to move cursor outside of link bounds), the UI will close. 950 if (!isActive) { 951 setAddingLink(false); 952 } 953 }, [isActive]); 954 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { 955 const editableContentElement = contentRef.current; 956 if (!editableContentElement) { 957 return; 958 } 959 function handleClick(event) { 960 // There is a situation whereby there is an existing link in the rich text 961 // and the user clicks on the leftmost edge of that link and fails to activate 962 // the link format, but the click event still fires on the `<a>` element. 963 // This causes the `editingLink` state to be set to `true` and the link UI 964 // to be rendered in "creating" mode. We need to check isActive to see if 965 // we have an active link format. 966 const link = event.target.closest('[contenteditable] a'); 967 if (!link || 968 // other formats (e.g. bold) may be nested within the link. 969 !isActive) { 970 return; 971 } 972 setAddingLink(true); 973 setOpenedBy({ 974 el: link, 975 action: 'click' 976 }); 977 } 978 editableContentElement.addEventListener('click', handleClick); 979 return () => { 980 editableContentElement.removeEventListener('click', handleClick); 981 }; 982 }, [contentRef, isActive]); 983 function addLink(target) { 984 const text = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(value)); 985 if (!isActive && text && (0,external_wp_url_namespaceObject.isURL)(text) && isValidHref(text)) { 986 onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, { 987 type: link_name, 988 attributes: { 989 url: text 990 } 991 })); 992 } else if (!isActive && text && (0,external_wp_url_namespaceObject.isEmail)(text)) { 993 onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, { 994 type: link_name, 995 attributes: { 996 url: `mailto:$text}` 997 } 998 })); 999 } else if (!isActive && text && (0,external_wp_url_namespaceObject.isPhoneNumber)(text)) { 1000 onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, { 1001 type: link_name, 1002 attributes: { 1003 url: `tel:$text.replace(/\D/g, '')}` 1004 } 1005 })); 1006 } else { 1007 if (target) { 1008 setOpenedBy({ 1009 el: target, 1010 action: null // We don't need to distinguish between click or keyboard here 1011 }); 1012 } 1013 setAddingLink(true); 1014 } 1015 } 1016 1017 /** 1018 * Runs when the popover is closed via escape keypress, unlinking the selected text, 1019 * but _not_ on a click outside the popover. onFocusOutside handles that. 1020 */ 1021 function stopAddingLink() { 1022 // Don't let the click handler on the toolbar button trigger again. 1023 1024 // There are two places for us to return focus to on Escape keypress: 1025 // 1. The rich text field. 1026 // 2. The toolbar button. 1027 1028 // The toolbar button is the only one we need to handle returning focus to. 1029 // Otherwise, we rely on the passed in onFocus to return focus to the rich text field. 1030 1031 // Close the popover 1032 setAddingLink(false); 1033 1034 // Return focus to the toolbar button or the rich text field 1035 if (openedBy?.el?.tagName === 'BUTTON') { 1036 openedBy.el.focus(); 1037 } else { 1038 onFocus(); 1039 } 1040 // Remove the openedBy state 1041 setOpenedBy(null); 1042 } 1043 1044 // Test for this: 1045 // 1. Click on the link button 1046 // 2. Click the Options button in the top right of header 1047 // 3. Focus should be in the dropdown of the Options button 1048 // 4. Press Escape 1049 // 5. Focus should be on the Options button 1050 function onFocusOutside() { 1051 setAddingLink(false); 1052 setOpenedBy(null); 1053 } 1054 function onRemoveFormat() { 1055 onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, link_name)); 1056 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive'); 1057 } 1058 1059 // Only autofocus if we have clicked a link within the editor 1060 const shouldAutoFocus = !(openedBy?.el?.tagName === 'A' && openedBy?.action === 'click'); 1061 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 1062 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, { 1063 type: "primary", 1064 character: "k", 1065 onUse: addLink 1066 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, { 1067 type: "primaryShift", 1068 character: "k", 1069 onUse: onRemoveFormat 1070 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 1071 name: "link", 1072 icon: library_link, 1073 title: isActive ? (0,external_wp_i18n_namespaceObject.__)('Link') : link_title, 1074 onClick: event => { 1075 addLink(event.currentTarget); 1076 }, 1077 isActive: isActive || addingLink, 1078 shortcutType: "primary", 1079 shortcutCharacter: "k", 1080 "aria-haspopup": "true", 1081 "aria-expanded": addingLink 1082 }), addingLink && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inline, { 1083 stopAddingLink: stopAddingLink, 1084 onFocusOutside: onFocusOutside, 1085 isActive: isActive, 1086 activeAttributes: activeAttributes, 1087 value: value, 1088 onChange: onChange, 1089 contentRef: contentRef, 1090 focusOnMount: shouldAutoFocus ? 'firstElement' : false 1091 })] 1092 }); 1093 } 1094 const build_module_link_link = { 1095 name: link_name, 1096 title: link_title, 1097 tagName: 'a', 1098 className: null, 1099 attributes: { 1100 url: 'href', 1101 type: 'data-type', 1102 id: 'data-id', 1103 _id: 'id', 1104 target: 'target', 1105 rel: 'rel' 1106 }, 1107 __unstablePasteRule(value, { 1108 html, 1109 plainText 1110 }) { 1111 const pastedText = (html || plainText).replace(/<[^>]+>/g, '').trim(); 1112 1113 // A URL was pasted, turn the selection into a link. 1114 // For the link pasting feature, allow only http(s) protocols. 1115 if (!(0,external_wp_url_namespaceObject.isURL)(pastedText) || !/^https?:/.test(pastedText)) { 1116 return value; 1117 } 1118 1119 // Allows us to ask for this information when we get a report. 1120 window.console.log('Created link:\n\n', pastedText); 1121 const format = { 1122 type: link_name, 1123 attributes: { 1124 url: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(pastedText) 1125 } 1126 }; 1127 if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) { 1128 return (0,external_wp_richText_namespaceObject.insert)(value, (0,external_wp_richText_namespaceObject.applyFormat)((0,external_wp_richText_namespaceObject.create)({ 1129 text: plainText 1130 }), format, 0, plainText.length)); 1131 } 1132 return (0,external_wp_richText_namespaceObject.applyFormat)(value, format); 1133 }, 1134 edit: link_Edit 1135 }; 1136 1137 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js 1138 /** 1139 * WordPress dependencies 1140 */ 1141 1142 1143 const formatStrikethrough = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 1144 xmlns: "http://www.w3.org/2000/svg", 1145 viewBox: "0 0 24 24", 1146 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 1147 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" 1148 }) 1149 }); 1150 /* harmony default export */ const format_strikethrough = (formatStrikethrough); 1151 1152 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/strikethrough/index.js 1153 /** 1154 * WordPress dependencies 1155 */ 1156 1157 1158 1159 1160 1161 1162 1163 const strikethrough_name = 'core/strikethrough'; 1164 const strikethrough_title = (0,external_wp_i18n_namespaceObject.__)('Strikethrough'); 1165 const strikethrough = { 1166 name: strikethrough_name, 1167 title: strikethrough_title, 1168 tagName: 's', 1169 className: null, 1170 edit({ 1171 isActive, 1172 value, 1173 onChange, 1174 onFocus 1175 }) { 1176 function onClick() { 1177 onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, { 1178 type: strikethrough_name, 1179 title: strikethrough_title 1180 })); 1181 onFocus(); 1182 } 1183 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 1184 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, { 1185 type: "access", 1186 character: "d", 1187 onUse: onClick 1188 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 1189 icon: format_strikethrough, 1190 title: strikethrough_title, 1191 onClick: onClick, 1192 isActive: isActive, 1193 role: "menuitemcheckbox" 1194 })] 1195 }); 1196 } 1197 }; 1198 1199 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/underline/index.js 1200 /** 1201 * WordPress dependencies 1202 */ 1203 1204 1205 1206 1207 1208 1209 const underline_name = 'core/underline'; 1210 const underline_title = (0,external_wp_i18n_namespaceObject.__)('Underline'); 1211 const underline = { 1212 name: underline_name, 1213 title: underline_title, 1214 tagName: 'span', 1215 className: null, 1216 attributes: { 1217 style: 'style' 1218 }, 1219 edit({ 1220 value, 1221 onChange 1222 }) { 1223 const onToggle = () => { 1224 onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, { 1225 type: underline_name, 1226 attributes: { 1227 style: 'text-decoration: underline;' 1228 }, 1229 title: underline_title 1230 })); 1231 }; 1232 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 1233 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, { 1234 type: "primary", 1235 character: "u", 1236 onUse: onToggle 1237 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, { 1238 inputType: "formatUnderline", 1239 onInput: onToggle 1240 })] 1241 }); 1242 } 1243 }; 1244 1245 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js 1246 /** 1247 * WordPress dependencies 1248 */ 1249 1250 1251 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 1252 1253 /** 1254 * Return an SVG icon. 1255 * 1256 * @param {IconProps} props icon is the SVG component to render 1257 * size is a number specifiying the icon size in pixels 1258 * Other props will be passed to wrapped SVG component 1259 * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. 1260 * 1261 * @return {JSX.Element} Icon component 1262 */ 1263 function Icon({ 1264 icon, 1265 size = 24, 1266 ...props 1267 }, ref) { 1268 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 1269 width: size, 1270 height: size, 1271 ...props, 1272 ref 1273 }); 1274 } 1275 /* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); 1276 1277 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/text-color.js 1278 /** 1279 * WordPress dependencies 1280 */ 1281 1282 1283 const textColor = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 1284 xmlns: "http://www.w3.org/2000/svg", 1285 viewBox: "0 0 24 24", 1286 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 1287 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" 1288 }) 1289 }); 1290 /* harmony default export */ const text_color = (textColor); 1291 1292 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/color.js 1293 /** 1294 * WordPress dependencies 1295 */ 1296 1297 1298 const color = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 1299 viewBox: "0 0 24 24", 1300 xmlns: "http://www.w3.org/2000/svg", 1301 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 1302 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" 1303 }) 1304 }); 1305 /* harmony default export */ const library_color = (color); 1306 1307 ;// CONCATENATED MODULE: external ["wp","privateApis"] 1308 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 1309 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/lock-unlock.js 1310 /** 1311 * WordPress dependencies 1312 */ 1313 1314 const { 1315 lock, 1316 unlock 1317 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/format-library'); 1318 1319 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/text-color/inline.js 1320 /** 1321 * WordPress dependencies 1322 */ 1323 1324 1325 1326 1327 1328 1329 1330 /** 1331 * Internal dependencies 1332 */ 1333 1334 1335 1336 1337 const { 1338 Tabs 1339 } = unlock(external_wp_components_namespaceObject.privateApis); 1340 const TABS = [{ 1341 name: 'color', 1342 title: (0,external_wp_i18n_namespaceObject.__)('Text') 1343 }, { 1344 name: 'backgroundColor', 1345 title: (0,external_wp_i18n_namespaceObject.__)('Background') 1346 }]; 1347 function parseCSS(css = '') { 1348 return css.split(';').reduce((accumulator, rule) => { 1349 if (rule) { 1350 const [property, value] = rule.split(':'); 1351 if (property === 'color') { 1352 accumulator.color = value; 1353 } 1354 if (property === 'background-color' && value !== transparentValue) { 1355 accumulator.backgroundColor = value; 1356 } 1357 } 1358 return accumulator; 1359 }, {}); 1360 } 1361 function parseClassName(className = '', colorSettings) { 1362 return className.split(' ').reduce((accumulator, name) => { 1363 // `colorSlug` could contain dashes, so simply match the start and end. 1364 if (name.startsWith('has-') && name.endsWith('-color')) { 1365 const colorSlug = name.replace(/^has-/, '').replace(/-color$/, ''); 1366 const colorObject = (0,external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues)(colorSettings, colorSlug); 1367 accumulator.color = colorObject.color; 1368 } 1369 return accumulator; 1370 }, {}); 1371 } 1372 function getActiveColors(value, name, colorSettings) { 1373 const activeColorFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name); 1374 if (!activeColorFormat) { 1375 return {}; 1376 } 1377 return { 1378 ...parseCSS(activeColorFormat.attributes.style), 1379 ...parseClassName(activeColorFormat.attributes.class, colorSettings) 1380 }; 1381 } 1382 function setColors(value, name, colorSettings, colors) { 1383 const { 1384 color, 1385 backgroundColor 1386 } = { 1387 ...getActiveColors(value, name, colorSettings), 1388 ...colors 1389 }; 1390 if (!color && !backgroundColor) { 1391 return (0,external_wp_richText_namespaceObject.removeFormat)(value, name); 1392 } 1393 const styles = []; 1394 const classNames = []; 1395 const attributes = {}; 1396 if (backgroundColor) { 1397 styles.push(['background-color', backgroundColor].join(':')); 1398 } else { 1399 // Override default browser color for mark element. 1400 styles.push(['background-color', transparentValue].join(':')); 1401 } 1402 if (color) { 1403 const colorObject = (0,external_wp_blockEditor_namespaceObject.getColorObjectByColorValue)(colorSettings, color); 1404 if (colorObject) { 1405 classNames.push((0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', colorObject.slug)); 1406 } else { 1407 styles.push(['color', color].join(':')); 1408 } 1409 } 1410 if (styles.length) { 1411 attributes.style = styles.join(';'); 1412 } 1413 if (classNames.length) { 1414 attributes.class = classNames.join(' '); 1415 } 1416 return (0,external_wp_richText_namespaceObject.applyFormat)(value, { 1417 type: name, 1418 attributes 1419 }); 1420 } 1421 function ColorPicker({ 1422 name, 1423 property, 1424 value, 1425 onChange 1426 }) { 1427 const colors = (0,external_wp_data_namespaceObject.useSelect)(select => { 1428 var _getSettings$colors; 1429 const { 1430 getSettings 1431 } = select(external_wp_blockEditor_namespaceObject.store); 1432 return (_getSettings$colors = getSettings().colors) !== null && _getSettings$colors !== void 0 ? _getSettings$colors : []; 1433 }, []); 1434 const activeColors = (0,external_wp_element_namespaceObject.useMemo)(() => getActiveColors(value, name, colors), [name, value, colors]); 1435 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.ColorPalette, { 1436 value: activeColors[property], 1437 onChange: color => { 1438 onChange(setColors(value, name, colors, { 1439 [property]: color 1440 })); 1441 } 1442 }); 1443 } 1444 function InlineColorUI({ 1445 name, 1446 value, 1447 onChange, 1448 onClose, 1449 contentRef, 1450 isActive 1451 }) { 1452 const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({ 1453 editableContentElement: contentRef.current, 1454 settings: { 1455 ...text_color_textColor, 1456 isActive 1457 } 1458 }); 1459 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { 1460 onClose: onClose, 1461 className: "format-library__inline-color-popover", 1462 anchor: popoverAnchor, 1463 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Tabs, { 1464 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabList, { 1465 children: TABS.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.Tab, { 1466 tabId: tab.name, 1467 children: tab.title 1468 }, tab.name)) 1469 }), TABS.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Tabs.TabPanel, { 1470 tabId: tab.name, 1471 focusable: false, 1472 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPicker, { 1473 name: name, 1474 property: tab.name, 1475 value: value, 1476 onChange: onChange 1477 }) 1478 }, tab.name))] 1479 }) 1480 }); 1481 } 1482 1483 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/text-color/index.js 1484 /** 1485 * WordPress dependencies 1486 */ 1487 1488 1489 1490 1491 1492 1493 /** 1494 * Internal dependencies 1495 */ 1496 1497 1498 1499 1500 const transparentValue = 'rgba(0, 0, 0, 0)'; 1501 const text_color_name = 'core/text-color'; 1502 const text_color_title = (0,external_wp_i18n_namespaceObject.__)('Highlight'); 1503 const EMPTY_ARRAY = []; 1504 function getComputedStyleProperty(element, property) { 1505 const { 1506 ownerDocument 1507 } = element; 1508 const { 1509 defaultView 1510 } = ownerDocument; 1511 const style = defaultView.getComputedStyle(element); 1512 const value = style.getPropertyValue(property); 1513 if (property === 'background-color' && value === transparentValue && element.parentElement) { 1514 return getComputedStyleProperty(element.parentElement, property); 1515 } 1516 return value; 1517 } 1518 function fillComputedColors(element, { 1519 color, 1520 backgroundColor 1521 }) { 1522 if (!color && !backgroundColor) { 1523 return; 1524 } 1525 return { 1526 color: color || getComputedStyleProperty(element, 'color'), 1527 backgroundColor: backgroundColor === transparentValue ? getComputedStyleProperty(element, 'background-color') : backgroundColor 1528 }; 1529 } 1530 function TextColorEdit({ 1531 value, 1532 onChange, 1533 isActive, 1534 activeAttributes, 1535 contentRef 1536 }) { 1537 const [allowCustomControl, colors = EMPTY_ARRAY] = (0,external_wp_blockEditor_namespaceObject.useSettings)('color.custom', 'color.palette'); 1538 const [isAddingColor, setIsAddingColor] = (0,external_wp_element_namespaceObject.useState)(false); 1539 const colorIndicatorStyle = (0,external_wp_element_namespaceObject.useMemo)(() => fillComputedColors(contentRef.current, getActiveColors(value, text_color_name, colors)), [contentRef, value, colors]); 1540 const hasColorsToChoose = colors.length || !allowCustomControl; 1541 if (!hasColorsToChoose && !isActive) { 1542 return null; 1543 } 1544 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 1545 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 1546 className: "format-library-text-color-button", 1547 isActive: isActive, 1548 icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(icon, { 1549 icon: Object.keys(activeAttributes).length ? text_color : library_color, 1550 style: colorIndicatorStyle 1551 }), 1552 title: text_color_title 1553 // If has no colors to choose but a color is active remove the color onClick. 1554 , 1555 onClick: hasColorsToChoose ? () => setIsAddingColor(true) : () => onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, text_color_name)), 1556 role: "menuitemcheckbox" 1557 }), isAddingColor && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineColorUI, { 1558 name: text_color_name, 1559 onClose: () => setIsAddingColor(false), 1560 activeAttributes: activeAttributes, 1561 value: value, 1562 onChange: onChange, 1563 contentRef: contentRef, 1564 isActive: isActive 1565 })] 1566 }); 1567 } 1568 const text_color_textColor = { 1569 name: text_color_name, 1570 title: text_color_title, 1571 tagName: 'mark', 1572 className: 'has-inline-color', 1573 attributes: { 1574 style: 'style', 1575 class: 'class' 1576 }, 1577 edit: TextColorEdit 1578 }; 1579 1580 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/subscript.js 1581 /** 1582 * WordPress dependencies 1583 */ 1584 1585 1586 const subscript = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 1587 xmlns: "http://www.w3.org/2000/svg", 1588 viewBox: "0 0 24 24", 1589 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 1590 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" 1591 }) 1592 }); 1593 /* harmony default export */ const library_subscript = (subscript); 1594 1595 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/subscript/index.js 1596 /** 1597 * WordPress dependencies 1598 */ 1599 1600 1601 1602 1603 1604 const subscript_name = 'core/subscript'; 1605 const subscript_title = (0,external_wp_i18n_namespaceObject.__)('Subscript'); 1606 const subscript_subscript = { 1607 name: subscript_name, 1608 title: subscript_title, 1609 tagName: 'sub', 1610 className: null, 1611 edit({ 1612 isActive, 1613 value, 1614 onChange, 1615 onFocus 1616 }) { 1617 function onToggle() { 1618 onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, { 1619 type: subscript_name, 1620 title: subscript_title 1621 })); 1622 } 1623 function onClick() { 1624 onToggle(); 1625 onFocus(); 1626 } 1627 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 1628 icon: library_subscript, 1629 title: subscript_title, 1630 onClick: onClick, 1631 isActive: isActive, 1632 role: "menuitemcheckbox" 1633 }); 1634 } 1635 }; 1636 1637 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/superscript.js 1638 /** 1639 * WordPress dependencies 1640 */ 1641 1642 1643 const superscript = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 1644 xmlns: "http://www.w3.org/2000/svg", 1645 viewBox: "0 0 24 24", 1646 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 1647 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" 1648 }) 1649 }); 1650 /* harmony default export */ const library_superscript = (superscript); 1651 1652 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/superscript/index.js 1653 /** 1654 * WordPress dependencies 1655 */ 1656 1657 1658 1659 1660 1661 const superscript_name = 'core/superscript'; 1662 const superscript_title = (0,external_wp_i18n_namespaceObject.__)('Superscript'); 1663 const superscript_superscript = { 1664 name: superscript_name, 1665 title: superscript_title, 1666 tagName: 'sup', 1667 className: null, 1668 edit({ 1669 isActive, 1670 value, 1671 onChange, 1672 onFocus 1673 }) { 1674 function onToggle() { 1675 onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, { 1676 type: superscript_name, 1677 title: superscript_title 1678 })); 1679 } 1680 function onClick() { 1681 onToggle(); 1682 onFocus(); 1683 } 1684 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 1685 icon: library_superscript, 1686 title: superscript_title, 1687 onClick: onClick, 1688 isActive: isActive, 1689 role: "menuitemcheckbox" 1690 }); 1691 } 1692 }; 1693 1694 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/button.js 1695 /** 1696 * WordPress dependencies 1697 */ 1698 1699 1700 const button_button = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 1701 viewBox: "0 0 24 24", 1702 xmlns: "http://www.w3.org/2000/svg", 1703 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 1704 d: "M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z" 1705 }) 1706 }); 1707 /* harmony default export */ const library_button = (button_button); 1708 1709 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/keyboard/index.js 1710 /** 1711 * WordPress dependencies 1712 */ 1713 1714 1715 1716 1717 1718 const keyboard_name = 'core/keyboard'; 1719 const keyboard_title = (0,external_wp_i18n_namespaceObject.__)('Keyboard input'); 1720 const keyboard = { 1721 name: keyboard_name, 1722 title: keyboard_title, 1723 tagName: 'kbd', 1724 className: null, 1725 edit({ 1726 isActive, 1727 value, 1728 onChange, 1729 onFocus 1730 }) { 1731 function onToggle() { 1732 onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, { 1733 type: keyboard_name, 1734 title: keyboard_title 1735 })); 1736 } 1737 function onClick() { 1738 onToggle(); 1739 onFocus(); 1740 } 1741 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 1742 icon: library_button, 1743 title: keyboard_title, 1744 onClick: onClick, 1745 isActive: isActive, 1746 role: "menuitemcheckbox" 1747 }); 1748 } 1749 }; 1750 1751 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/help.js 1752 /** 1753 * WordPress dependencies 1754 */ 1755 1756 1757 const help = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 1758 xmlns: "http://www.w3.org/2000/svg", 1759 viewBox: "0 0 24 24", 1760 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 1761 d: "M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z" 1762 }) 1763 }); 1764 /* harmony default export */ const library_help = (help); 1765 1766 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/unknown/index.js 1767 /** 1768 * WordPress dependencies 1769 */ 1770 1771 1772 1773 1774 1775 const unknown_name = 'core/unknown'; 1776 const unknown_title = (0,external_wp_i18n_namespaceObject.__)('Clear Unknown Formatting'); 1777 function selectionContainsUnknownFormats(value) { 1778 if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) { 1779 return false; 1780 } 1781 const selectedValue = (0,external_wp_richText_namespaceObject.slice)(value); 1782 return selectedValue.formats.some(formats => { 1783 return formats.some(format => format.type === unknown_name); 1784 }); 1785 } 1786 const unknown = { 1787 name: unknown_name, 1788 title: unknown_title, 1789 tagName: '*', 1790 className: null, 1791 edit({ 1792 isActive, 1793 value, 1794 onChange, 1795 onFocus 1796 }) { 1797 if (!isActive && !selectionContainsUnknownFormats(value)) { 1798 return null; 1799 } 1800 function onClick() { 1801 onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, unknown_name)); 1802 onFocus(); 1803 } 1804 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 1805 name: "unknown", 1806 icon: library_help, 1807 title: unknown_title, 1808 onClick: onClick, 1809 isActive: true 1810 }); 1811 } 1812 }; 1813 1814 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/language.js 1815 /** 1816 * WordPress dependencies 1817 */ 1818 1819 1820 const language = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 1821 xmlns: "http://www.w3.org/2000/svg", 1822 viewBox: "0 0 24 24", 1823 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 1824 d: "M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z" 1825 }) 1826 }); 1827 /* harmony default export */ const library_language = (language); 1828 1829 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/language/index.js 1830 /** 1831 * WordPress dependencies 1832 */ 1833 1834 1835 /** 1836 * WordPress dependencies 1837 */ 1838 1839 1840 1841 1842 1843 1844 1845 1846 const language_name = 'core/language'; 1847 const language_title = (0,external_wp_i18n_namespaceObject.__)('Language'); 1848 const language_language = { 1849 name: language_name, 1850 tagName: 'bdo', 1851 className: null, 1852 edit: language_Edit, 1853 title: language_title 1854 }; 1855 function language_Edit({ 1856 isActive, 1857 value, 1858 onChange, 1859 contentRef 1860 }) { 1861 const [isPopoverVisible, setIsPopoverVisible] = (0,external_wp_element_namespaceObject.useState)(false); 1862 const togglePopover = () => { 1863 setIsPopoverVisible(state => !state); 1864 }; 1865 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 1866 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, { 1867 icon: library_language, 1868 label: language_title, 1869 title: language_title, 1870 onClick: () => { 1871 if (isActive) { 1872 onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, language_name)); 1873 } else { 1874 togglePopover(); 1875 } 1876 }, 1877 isActive: isActive, 1878 role: "menuitemcheckbox" 1879 }), isPopoverVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InlineLanguageUI, { 1880 value: value, 1881 onChange: onChange, 1882 onClose: togglePopover, 1883 contentRef: contentRef 1884 })] 1885 }); 1886 } 1887 function InlineLanguageUI({ 1888 value, 1889 contentRef, 1890 onChange, 1891 onClose 1892 }) { 1893 const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({ 1894 editableContentElement: contentRef.current, 1895 settings: language_language 1896 }); 1897 const [lang, setLang] = (0,external_wp_element_namespaceObject.useState)(''); 1898 const [dir, setDir] = (0,external_wp_element_namespaceObject.useState)('ltr'); 1899 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { 1900 className: "block-editor-format-toolbar__language-popover", 1901 anchor: popoverAnchor, 1902 onClose: onClose, 1903 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 1904 as: "form", 1905 spacing: 4, 1906 className: "block-editor-format-toolbar__language-container-content", 1907 onSubmit: event => { 1908 event.preventDefault(); 1909 onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, { 1910 type: language_name, 1911 attributes: { 1912 lang, 1913 dir 1914 } 1915 })); 1916 onClose(); 1917 }, 1918 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 1919 __next40pxDefaultSize: true, 1920 __nextHasNoMarginBottom: true, 1921 label: language_title, 1922 value: lang, 1923 onChange: val => setLang(val), 1924 help: (0,external_wp_i18n_namespaceObject.__)('A valid language attribute, like "en" or "fr".') 1925 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { 1926 __next40pxDefaultSize: true, 1927 __nextHasNoMarginBottom: true, 1928 label: (0,external_wp_i18n_namespaceObject.__)('Text direction'), 1929 value: dir, 1930 options: [{ 1931 label: (0,external_wp_i18n_namespaceObject.__)('Left to right'), 1932 value: 'ltr' 1933 }, { 1934 label: (0,external_wp_i18n_namespaceObject.__)('Right to left'), 1935 value: 'rtl' 1936 }], 1937 onChange: val => setDir(val) 1938 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 1939 alignment: "right", 1940 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { 1941 __next40pxDefaultSize: true, 1942 variant: "primary", 1943 type: "submit", 1944 text: (0,external_wp_i18n_namespaceObject.__)('Apply') 1945 }) 1946 })] 1947 }) 1948 }); 1949 } 1950 1951 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/non-breaking-space/index.js 1952 /** 1953 * WordPress dependencies 1954 */ 1955 1956 1957 1958 1959 const non_breaking_space_name = 'core/non-breaking-space'; 1960 const non_breaking_space_title = (0,external_wp_i18n_namespaceObject.__)('Non breaking space'); 1961 const nonBreakingSpace = { 1962 name: non_breaking_space_name, 1963 title: non_breaking_space_title, 1964 tagName: 'nbsp', 1965 className: null, 1966 edit({ 1967 value, 1968 onChange 1969 }) { 1970 function addNonBreakingSpace() { 1971 onChange((0,external_wp_richText_namespaceObject.insert)(value, '\u00a0')); 1972 } 1973 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichTextShortcut, { 1974 type: "primaryShift", 1975 character: " ", 1976 onUse: addNonBreakingSpace 1977 }); 1978 } 1979 }; 1980 1981 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/default-formats.js 1982 /** 1983 * Internal dependencies 1984 */ 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 /* 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, unknown, language_language, nonBreakingSpace]); 2000 2001 ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/index.js 2002 /** 2003 * WordPress dependencies 2004 */ 2005 2006 2007 /** 2008 * Internal dependencies 2009 */ 2010 2011 default_formats.forEach(({ 2012 name, 2013 ...settings 2014 }) => (0,external_wp_richText_namespaceObject.registerFormatType)(name, settings)); 2015 2016 (window.wp = window.wp || {}).formatLibrary = __webpack_exports__; 2017 /******/ })() 2018 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Tue Dec 3 08:20:01 2024 | Cross-referenced by PHPXref |