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