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