format-library.js 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839
  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. ;// CONCATENATED MODULE: external ["wp","richText"]
  23. var external_wp_richText_namespaceObject = window["wp"]["richText"];
  24. ;// CONCATENATED MODULE: external ["wp","element"]
  25. var external_wp_element_namespaceObject = window["wp"]["element"];
  26. ;// CONCATENATED MODULE: external ["wp","i18n"]
  27. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  28. ;// CONCATENATED MODULE: external ["wp","blockEditor"]
  29. var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
  30. ;// CONCATENATED MODULE: external ["wp","primitives"]
  31. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  32. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-bold.js
  33. /**
  34. * WordPress dependencies
  35. */
  36. const formatBold = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  37. xmlns: "http://www.w3.org/2000/svg",
  38. viewBox: "0 0 24 24"
  39. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  40. 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"
  41. }));
  42. /* harmony default export */ var format_bold = (formatBold);
  43. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/bold/index.js
  44. /**
  45. * WordPress dependencies
  46. */
  47. const bold_name = 'core/bold';
  48. const title = (0,external_wp_i18n_namespaceObject.__)('Bold');
  49. const bold = {
  50. name: bold_name,
  51. title,
  52. tagName: 'strong',
  53. className: null,
  54. edit(_ref) {
  55. let {
  56. isActive,
  57. value,
  58. onChange,
  59. onFocus
  60. } = _ref;
  61. function onToggle() {
  62. onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  63. type: bold_name,
  64. title
  65. }));
  66. }
  67. function onClick() {
  68. onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  69. type: bold_name
  70. }));
  71. onFocus();
  72. }
  73. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
  74. type: "primary",
  75. character: "b",
  76. onUse: onToggle
  77. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  78. name: "bold",
  79. icon: format_bold,
  80. title: title,
  81. onClick: onClick,
  82. isActive: isActive,
  83. shortcutType: "primary",
  84. shortcutCharacter: "b"
  85. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, {
  86. inputType: "formatBold",
  87. onInput: onToggle
  88. }));
  89. }
  90. };
  91. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/code.js
  92. /**
  93. * WordPress dependencies
  94. */
  95. const code = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  96. viewBox: "0 0 24 24",
  97. xmlns: "http://www.w3.org/2000/svg"
  98. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  99. 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"
  100. }));
  101. /* harmony default export */ var library_code = (code);
  102. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/code/index.js
  103. /**
  104. * WordPress dependencies
  105. */
  106. const code_name = 'core/code';
  107. const code_title = (0,external_wp_i18n_namespaceObject.__)('Inline code');
  108. const code_code = {
  109. name: code_name,
  110. title: code_title,
  111. tagName: 'code',
  112. className: null,
  113. __unstableInputRule(value) {
  114. const BACKTICK = '`';
  115. const {
  116. start,
  117. text
  118. } = value;
  119. const characterBefore = text.slice(start - 1, start); // Quick check the text for the necessary character.
  120. if (characterBefore !== BACKTICK) {
  121. return value;
  122. }
  123. const textBefore = text.slice(0, start - 1);
  124. const indexBefore = textBefore.lastIndexOf(BACKTICK);
  125. if (indexBefore === -1) {
  126. return value;
  127. }
  128. const startIndex = indexBefore;
  129. const endIndex = start - 2;
  130. if (startIndex === endIndex) {
  131. return value;
  132. }
  133. value = (0,external_wp_richText_namespaceObject.remove)(value, startIndex, startIndex + 1);
  134. value = (0,external_wp_richText_namespaceObject.remove)(value, endIndex, endIndex + 1);
  135. value = (0,external_wp_richText_namespaceObject.applyFormat)(value, {
  136. type: code_name
  137. }, startIndex, endIndex);
  138. return value;
  139. },
  140. edit(_ref) {
  141. let {
  142. value,
  143. onChange,
  144. onFocus,
  145. isActive
  146. } = _ref;
  147. function onClick() {
  148. onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  149. type: code_name,
  150. title: code_title
  151. }));
  152. onFocus();
  153. }
  154. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
  155. type: "access",
  156. character: "x",
  157. onUse: onClick
  158. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  159. icon: library_code,
  160. title: code_title,
  161. onClick: onClick,
  162. isActive: isActive,
  163. role: "menuitemcheckbox"
  164. }));
  165. }
  166. };
  167. ;// CONCATENATED MODULE: external ["wp","components"]
  168. var external_wp_components_namespaceObject = window["wp"]["components"];
  169. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard-return.js
  170. /**
  171. * WordPress dependencies
  172. */
  173. const keyboardReturn = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  174. xmlns: "http://www.w3.org/2000/svg",
  175. viewBox: "-2 -2 24 24"
  176. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  177. 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"
  178. }));
  179. /* harmony default export */ var keyboard_return = (keyboardReturn);
  180. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/image/index.js
  181. /**
  182. * WordPress dependencies
  183. */
  184. const ALLOWED_MEDIA_TYPES = ['image'];
  185. const image_name = 'core/image';
  186. const image_title = (0,external_wp_i18n_namespaceObject.__)('Inline image');
  187. const image_image = {
  188. name: image_name,
  189. title: image_title,
  190. keywords: [(0,external_wp_i18n_namespaceObject.__)('photo'), (0,external_wp_i18n_namespaceObject.__)('media')],
  191. object: true,
  192. tagName: 'img',
  193. className: null,
  194. attributes: {
  195. className: 'class',
  196. style: 'style',
  197. url: 'src',
  198. alt: 'alt'
  199. },
  200. edit: Edit
  201. };
  202. function InlineUI(_ref) {
  203. let {
  204. value,
  205. onChange,
  206. activeObjectAttributes,
  207. contentRef
  208. } = _ref;
  209. const {
  210. style
  211. } = activeObjectAttributes;
  212. const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(style === null || style === void 0 ? void 0 : style.replace(/\D/g, ''));
  213. const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
  214. editableContentElement: contentRef.current,
  215. value,
  216. settings: image_image
  217. });
  218. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
  219. position: "bottom center",
  220. focusOnMount: false,
  221. anchor: popoverAnchor,
  222. className: "block-editor-format-toolbar__image-popover"
  223. }, (0,external_wp_element_namespaceObject.createElement)("form", {
  224. className: "block-editor-format-toolbar__image-container-content",
  225. onSubmit: event => {
  226. const newReplacements = value.replacements.slice();
  227. newReplacements[value.start] = {
  228. type: image_name,
  229. attributes: { ...activeObjectAttributes,
  230. style: width ? `width: ${width}px;` : ''
  231. }
  232. };
  233. onChange({ ...value,
  234. replacements: newReplacements
  235. });
  236. event.preventDefault();
  237. }
  238. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  239. className: "block-editor-format-toolbar__image-container-value",
  240. type: "number",
  241. label: (0,external_wp_i18n_namespaceObject.__)('Width'),
  242. value: width,
  243. min: 1,
  244. onChange: newWidth => setWidth(newWidth)
  245. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  246. icon: keyboard_return,
  247. label: (0,external_wp_i18n_namespaceObject.__)('Apply'),
  248. type: "submit"
  249. })));
  250. }
  251. function Edit(_ref2) {
  252. let {
  253. value,
  254. onChange,
  255. onFocus,
  256. isObjectActive,
  257. activeObjectAttributes,
  258. contentRef
  259. } = _ref2;
  260. const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
  261. function openModal() {
  262. setIsModalOpen(true);
  263. }
  264. function closeModal() {
  265. setIsModalOpen(false);
  266. }
  267. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  268. icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
  269. xmlns: "http://www.w3.org/2000/svg",
  270. viewBox: "0 0 24 24"
  271. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
  272. 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"
  273. })),
  274. title: image_title,
  275. onClick: openModal,
  276. isActive: isObjectActive
  277. }), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
  278. allowedTypes: ALLOWED_MEDIA_TYPES,
  279. onSelect: _ref3 => {
  280. let {
  281. id,
  282. url,
  283. alt,
  284. width: imgWidth
  285. } = _ref3;
  286. closeModal();
  287. onChange((0,external_wp_richText_namespaceObject.insertObject)(value, {
  288. type: image_name,
  289. attributes: {
  290. className: `wp-image-${id}`,
  291. style: `width: ${Math.min(imgWidth, 150)}px;`,
  292. url,
  293. alt
  294. }
  295. }));
  296. onFocus();
  297. },
  298. onClose: closeModal,
  299. render: _ref4 => {
  300. let {
  301. open
  302. } = _ref4;
  303. open();
  304. return null;
  305. }
  306. }), isObjectActive && (0,external_wp_element_namespaceObject.createElement)(InlineUI, {
  307. value: value,
  308. onChange: onChange,
  309. activeObjectAttributes: activeObjectAttributes,
  310. contentRef: contentRef
  311. }));
  312. }
  313. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-italic.js
  314. /**
  315. * WordPress dependencies
  316. */
  317. const formatItalic = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  318. xmlns: "http://www.w3.org/2000/svg",
  319. viewBox: "0 0 24 24"
  320. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  321. d: "M12.5 5L10 19h1.9l2.5-14z"
  322. }));
  323. /* harmony default export */ var format_italic = (formatItalic);
  324. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/italic/index.js
  325. /**
  326. * WordPress dependencies
  327. */
  328. const italic_name = 'core/italic';
  329. const italic_title = (0,external_wp_i18n_namespaceObject.__)('Italic');
  330. const italic = {
  331. name: italic_name,
  332. title: italic_title,
  333. tagName: 'em',
  334. className: null,
  335. edit(_ref) {
  336. let {
  337. isActive,
  338. value,
  339. onChange,
  340. onFocus
  341. } = _ref;
  342. function onToggle() {
  343. onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  344. type: italic_name,
  345. title: italic_title
  346. }));
  347. }
  348. function onClick() {
  349. onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  350. type: italic_name
  351. }));
  352. onFocus();
  353. }
  354. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
  355. type: "primary",
  356. character: "i",
  357. onUse: onToggle
  358. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  359. name: "italic",
  360. icon: format_italic,
  361. title: italic_title,
  362. onClick: onClick,
  363. isActive: isActive,
  364. shortcutType: "primary",
  365. shortcutCharacter: "i"
  366. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, {
  367. inputType: "formatItalic",
  368. onInput: onToggle
  369. }));
  370. }
  371. };
  372. ;// CONCATENATED MODULE: external ["wp","url"]
  373. var external_wp_url_namespaceObject = window["wp"]["url"];
  374. ;// CONCATENATED MODULE: external ["wp","htmlEntities"]
  375. var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
  376. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link-off.js
  377. /**
  378. * WordPress dependencies
  379. */
  380. const linkOff = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  381. xmlns: "http://www.w3.org/2000/svg",
  382. viewBox: "0 0 24 24"
  383. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  384. d: "M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z"
  385. }));
  386. /* harmony default export */ var link_off = (linkOff);
  387. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js
  388. /**
  389. * WordPress dependencies
  390. */
  391. const link_link = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  392. xmlns: "http://www.w3.org/2000/svg",
  393. viewBox: "0 0 24 24"
  394. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  395. d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z"
  396. }));
  397. /* harmony default export */ var library_link = (link_link);
  398. ;// CONCATENATED MODULE: external ["wp","a11y"]
  399. var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
  400. ;// CONCATENATED MODULE: external ["wp","data"]
  401. var external_wp_data_namespaceObject = window["wp"]["data"];
  402. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/utils.js
  403. /**
  404. * WordPress dependencies
  405. */
  406. /**
  407. * Check for issues with the provided href.
  408. *
  409. * @param {string} href The href.
  410. *
  411. * @return {boolean} Is the href invalid?
  412. */
  413. function isValidHref(href) {
  414. if (!href) {
  415. return false;
  416. }
  417. const trimmedHref = href.trim();
  418. if (!trimmedHref) {
  419. return false;
  420. } // Does the href start with something that looks like a URL protocol?
  421. if (/^\S+:/.test(trimmedHref)) {
  422. const protocol = (0,external_wp_url_namespaceObject.getProtocol)(trimmedHref);
  423. if (!(0,external_wp_url_namespaceObject.isValidProtocol)(protocol)) {
  424. return false;
  425. } // Add some extra checks for http(s) URIs, since these are the most common use-case.
  426. // This ensures URIs with an http protocol have exactly two forward slashes following the protocol.
  427. if (protocol.startsWith('http') && !/^https?:\/\/[^\/\s]/i.test(trimmedHref)) {
  428. return false;
  429. }
  430. const authority = (0,external_wp_url_namespaceObject.getAuthority)(trimmedHref);
  431. if (!(0,external_wp_url_namespaceObject.isValidAuthority)(authority)) {
  432. return false;
  433. }
  434. const path = (0,external_wp_url_namespaceObject.getPath)(trimmedHref);
  435. if (path && !(0,external_wp_url_namespaceObject.isValidPath)(path)) {
  436. return false;
  437. }
  438. const queryString = (0,external_wp_url_namespaceObject.getQueryString)(trimmedHref);
  439. if (queryString && !(0,external_wp_url_namespaceObject.isValidQueryString)(queryString)) {
  440. return false;
  441. }
  442. const fragment = (0,external_wp_url_namespaceObject.getFragment)(trimmedHref);
  443. if (fragment && !(0,external_wp_url_namespaceObject.isValidFragment)(fragment)) {
  444. return false;
  445. }
  446. } // Validate anchor links.
  447. if (trimmedHref.startsWith('#') && !(0,external_wp_url_namespaceObject.isValidFragment)(trimmedHref)) {
  448. return false;
  449. }
  450. return true;
  451. }
  452. /**
  453. * Generates the format object that will be applied to the link text.
  454. *
  455. * @param {Object} options
  456. * @param {string} options.url The href of the link.
  457. * @param {string} options.type The type of the link.
  458. * @param {string} options.id The ID of the link.
  459. * @param {boolean} options.opensInNewWindow Whether this link will open in a new window.
  460. *
  461. * @return {Object} The final format object.
  462. */
  463. function createLinkFormat(_ref) {
  464. let {
  465. url,
  466. type,
  467. id,
  468. opensInNewWindow
  469. } = _ref;
  470. const format = {
  471. type: 'core/link',
  472. attributes: {
  473. url
  474. }
  475. };
  476. if (type) format.attributes.type = type;
  477. if (id) format.attributes.id = id;
  478. if (opensInNewWindow) {
  479. format.attributes.target = '_blank';
  480. format.attributes.rel = 'noreferrer noopener';
  481. }
  482. return format;
  483. }
  484. /* eslint-disable jsdoc/no-undefined-types */
  485. /**
  486. * Get the start and end boundaries of a given format from a rich text value.
  487. *
  488. *
  489. * @param {RichTextValue} value the rich text value to interrogate.
  490. * @param {string} format the identifier for the target format (e.g. `core/link`, `core/bold`).
  491. * @param {number?} startIndex optional startIndex to seek from.
  492. * @param {number?} endIndex optional endIndex to seek from.
  493. * @return {Object} object containing start and end values for the given format.
  494. */
  495. /* eslint-enable jsdoc/no-undefined-types */
  496. function getFormatBoundary(value, format) {
  497. var _newFormats$startInde, _newFormats$endIndex, _newFormats;
  498. let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
  499. let endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
  500. const EMPTY_BOUNDARIES = {
  501. start: null,
  502. end: null
  503. };
  504. const {
  505. formats
  506. } = value;
  507. let targetFormat;
  508. let initialIndex;
  509. if (!(formats !== null && formats !== void 0 && formats.length)) {
  510. return EMPTY_BOUNDARIES;
  511. } // Clone formats to avoid modifying source formats.
  512. const newFormats = formats.slice();
  513. const formatAtStart = (_newFormats$startInde = newFormats[startIndex]) === null || _newFormats$startInde === void 0 ? void 0 : _newFormats$startInde.find(_ref2 => {
  514. let {
  515. type
  516. } = _ref2;
  517. return type === format.type;
  518. });
  519. const formatAtEnd = (_newFormats$endIndex = newFormats[endIndex]) === null || _newFormats$endIndex === void 0 ? void 0 : _newFormats$endIndex.find(_ref3 => {
  520. let {
  521. type
  522. } = _ref3;
  523. return type === format.type;
  524. });
  525. const formatAtEndMinusOne = (_newFormats = newFormats[endIndex - 1]) === null || _newFormats === void 0 ? void 0 : _newFormats.find(_ref4 => {
  526. let {
  527. type
  528. } = _ref4;
  529. return type === format.type;
  530. });
  531. if (!!formatAtStart) {
  532. // Set values to conform to "start"
  533. targetFormat = formatAtStart;
  534. initialIndex = startIndex;
  535. } else if (!!formatAtEnd) {
  536. // Set values to conform to "end"
  537. targetFormat = formatAtEnd;
  538. initialIndex = endIndex;
  539. } else if (!!formatAtEndMinusOne) {
  540. // This is an edge case which will occur if you create a format, then place
  541. // the caret just before the format and hit the back ARROW key. The resulting
  542. // value object will have start and end +1 beyond the edge of the format boundary.
  543. targetFormat = formatAtEndMinusOne;
  544. initialIndex = endIndex - 1;
  545. } else {
  546. return EMPTY_BOUNDARIES;
  547. }
  548. const index = newFormats[initialIndex].indexOf(targetFormat);
  549. const walkingArgs = [newFormats, initialIndex, targetFormat, index]; // Walk the startIndex "backwards" to the leading "edge" of the matching format.
  550. startIndex = walkToStart(...walkingArgs); // Walk the endIndex "forwards" until the trailing "edge" of the matching format.
  551. endIndex = walkToEnd(...walkingArgs); // Safe guard: start index cannot be less than 0.
  552. startIndex = startIndex < 0 ? 0 : startIndex; // // Return the indicies of the "edges" as the boundaries.
  553. return {
  554. start: startIndex,
  555. end: endIndex
  556. };
  557. }
  558. /**
  559. * Walks forwards/backwards towards the boundary of a given format within an
  560. * array of format objects. Returns the index of the boundary.
  561. *
  562. * @param {Array} formats the formats to search for the given format type.
  563. * @param {number} initialIndex the starting index from which to walk.
  564. * @param {Object} targetFormatRef a reference to the format type object being sought.
  565. * @param {number} formatIndex the index at which we expect the target format object to be.
  566. * @param {string} direction either 'forwards' or 'backwards' to indicate the direction.
  567. * @return {number} the index of the boundary of the given format.
  568. */
  569. function walkToBoundary(formats, initialIndex, targetFormatRef, formatIndex, direction) {
  570. let index = initialIndex;
  571. const directions = {
  572. forwards: 1,
  573. backwards: -1
  574. };
  575. const directionIncrement = directions[direction] || 1; // invalid direction arg default to forwards
  576. const inverseDirectionIncrement = directionIncrement * -1;
  577. while (formats[index] && formats[index][formatIndex] === targetFormatRef) {
  578. // Increment/decrement in the direction of operation.
  579. index = index + directionIncrement;
  580. } // Restore by one in inverse direction of operation
  581. // to avoid out of bounds.
  582. index = index + inverseDirectionIncrement;
  583. return index;
  584. }
  585. const partialRight = function (fn) {
  586. for (var _len = arguments.length, partialArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  587. partialArgs[_key - 1] = arguments[_key];
  588. }
  589. return function () {
  590. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  591. args[_key2] = arguments[_key2];
  592. }
  593. return fn(...args, ...partialArgs);
  594. };
  595. };
  596. const walkToStart = partialRight(walkToBoundary, 'backwards');
  597. const walkToEnd = partialRight(walkToBoundary, 'forwards');
  598. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/use-link-instance-key.js
  599. // Weakly referenced map allows unused ids to be garbage collected.
  600. const weakMap = new WeakMap(); // Incrementing zero-based ID value.
  601. let id = -1;
  602. const prefix = 'link-control-instance';
  603. function getKey(_id) {
  604. return `${prefix}-${_id}`;
  605. }
  606. /**
  607. * Builds a unique link control key for the given object reference.
  608. *
  609. * @param {Object} instance an unique object reference specific to this link control instance.
  610. * @return {string} the unique key to use for this link control.
  611. */
  612. function useLinkInstanceKey(instance) {
  613. if (!instance) {
  614. return;
  615. }
  616. if (weakMap.has(instance)) {
  617. return getKey(weakMap.get(instance));
  618. }
  619. id += 1;
  620. weakMap.set(instance, id);
  621. return getKey(id);
  622. }
  623. /* harmony default export */ var use_link_instance_key = (useLinkInstanceKey);
  624. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/inline.js
  625. /**
  626. * WordPress dependencies
  627. */
  628. /**
  629. * Internal dependencies
  630. */
  631. function InlineLinkUI(_ref) {
  632. let {
  633. isActive,
  634. activeAttributes,
  635. addingLink,
  636. value,
  637. onChange,
  638. speak,
  639. stopAddingLink,
  640. contentRef
  641. } = _ref;
  642. const richLinkTextValue = getRichTextValueFromSelection(value, isActive); // Get the text content minus any HTML tags.
  643. const richTextText = richLinkTextValue.text;
  644. /**
  645. * Pending settings to be applied to the next link. When inserting a new
  646. * link, toggle values cannot be applied immediately, because there is not
  647. * yet a link for them to apply to. Thus, they are maintained in a state
  648. * value until the time that the link can be inserted or edited.
  649. *
  650. * @type {[Object|undefined,Function]}
  651. */
  652. const [nextLinkValue, setNextLinkValue] = (0,external_wp_element_namespaceObject.useState)();
  653. const {
  654. createPageEntity,
  655. userCanCreatePages
  656. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  657. const {
  658. getSettings
  659. } = select(external_wp_blockEditor_namespaceObject.store);
  660. const _settings = getSettings();
  661. return {
  662. createPageEntity: _settings.__experimentalCreatePageEntity,
  663. userCanCreatePages: _settings.__experimentalUserCanCreatePages
  664. };
  665. }, []);
  666. const linkValue = {
  667. url: activeAttributes.url,
  668. type: activeAttributes.type,
  669. id: activeAttributes.id,
  670. opensInNewTab: activeAttributes.target === '_blank',
  671. title: richTextText,
  672. ...nextLinkValue
  673. };
  674. function removeLink() {
  675. const newValue = (0,external_wp_richText_namespaceObject.removeFormat)(value, 'core/link');
  676. onChange(newValue);
  677. stopAddingLink();
  678. speak((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive');
  679. }
  680. function onChangeLink(nextValue) {
  681. // Merge with values from state, both for the purpose of assigning the
  682. // next state value, and for use in constructing the new link format if
  683. // the link is ready to be applied.
  684. nextValue = { ...nextLinkValue,
  685. ...nextValue
  686. }; // LinkControl calls `onChange` immediately upon the toggling a setting.
  687. const didToggleSetting = linkValue.opensInNewTab !== nextValue.opensInNewTab && linkValue.url === nextValue.url; // If change handler was called as a result of a settings change during
  688. // link insertion, it must be held in state until the link is ready to
  689. // be applied.
  690. const didToggleSettingForNewLink = didToggleSetting && nextValue.url === undefined; // If link will be assigned, the state value can be considered flushed.
  691. // Otherwise, persist the pending changes.
  692. setNextLinkValue(didToggleSettingForNewLink ? nextValue : undefined);
  693. if (didToggleSettingForNewLink) {
  694. return;
  695. }
  696. const newUrl = (0,external_wp_url_namespaceObject.prependHTTP)(nextValue.url);
  697. const linkFormat = createLinkFormat({
  698. url: newUrl,
  699. type: nextValue.type,
  700. id: nextValue.id !== undefined && nextValue.id !== null ? String(nextValue.id) : undefined,
  701. opensInNewWindow: nextValue.opensInNewTab
  702. });
  703. const newText = nextValue.title || newUrl;
  704. if ((0,external_wp_richText_namespaceObject.isCollapsed)(value) && !isActive) {
  705. // Scenario: we don't have any actively selected text or formats.
  706. const toInsert = (0,external_wp_richText_namespaceObject.applyFormat)((0,external_wp_richText_namespaceObject.create)({
  707. text: newText
  708. }), linkFormat, 0, newText.length);
  709. onChange((0,external_wp_richText_namespaceObject.insert)(value, toInsert));
  710. } else {
  711. // Scenario: we have any active text selection or an active format.
  712. let newValue;
  713. if (newText === richTextText) {
  714. // If we're not updating the text then ignore.
  715. newValue = (0,external_wp_richText_namespaceObject.applyFormat)(value, linkFormat);
  716. } else {
  717. // Create new RichText value for the new text in order that we
  718. // can apply formats to it.
  719. newValue = (0,external_wp_richText_namespaceObject.create)({
  720. text: newText
  721. }); // Apply the new Link format to this new text value.
  722. newValue = (0,external_wp_richText_namespaceObject.applyFormat)(newValue, linkFormat, 0, newText.length); // Update the original (full) RichTextValue replacing the
  723. // target text with the *new* RichTextValue containing:
  724. // 1. The new text content.
  725. // 2. The new link format.
  726. // Note original formats will be lost when applying this change.
  727. // That is expected behaviour.
  728. // See: https://github.com/WordPress/gutenberg/pull/33849#issuecomment-936134179.
  729. newValue = (0,external_wp_richText_namespaceObject.replace)(value, richTextText, newValue);
  730. }
  731. newValue.start = newValue.end;
  732. newValue.activeFormats = [];
  733. onChange(newValue);
  734. } // Focus should only be shifted back to the formatted segment when the
  735. // URL is submitted.
  736. if (!didToggleSetting) {
  737. stopAddingLink();
  738. }
  739. if (!isValidHref(newUrl)) {
  740. speak((0,external_wp_i18n_namespaceObject.__)('Warning: the link has been inserted but may have errors. Please test it.'), 'assertive');
  741. } else if (isActive) {
  742. speak((0,external_wp_i18n_namespaceObject.__)('Link edited.'), 'assertive');
  743. } else {
  744. speak((0,external_wp_i18n_namespaceObject.__)('Link inserted.'), 'assertive');
  745. }
  746. }
  747. const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
  748. editableContentElement: contentRef.current,
  749. value,
  750. settings: build_module_link_link
  751. }); // Generate a string based key that is unique to this anchor reference.
  752. // This is used to force re-mount the LinkControl component to avoid
  753. // potential stale state bugs caused by the component not being remounted
  754. // See https://github.com/WordPress/gutenberg/pull/34742.
  755. const forceRemountKey = use_link_instance_key(popoverAnchor); // The focusOnMount prop shouldn't evolve during render of a Popover
  756. // otherwise it causes a render of the content.
  757. const focusOnMount = (0,external_wp_element_namespaceObject.useRef)(addingLink ? 'firstElement' : false);
  758. async function handleCreate(pageTitle) {
  759. const page = await createPageEntity({
  760. title: pageTitle,
  761. status: 'draft'
  762. });
  763. return {
  764. id: page.id,
  765. type: page.type,
  766. title: page.title.rendered,
  767. url: page.link,
  768. kind: 'post-type'
  769. };
  770. }
  771. function createButtonText(searchTerm) {
  772. return (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)(
  773. /* translators: %s: search term. */
  774. (0,external_wp_i18n_namespaceObject.__)('Create Page: <mark>%s</mark>'), searchTerm), {
  775. mark: (0,external_wp_element_namespaceObject.createElement)("mark", null)
  776. });
  777. }
  778. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
  779. anchor: popoverAnchor,
  780. focusOnMount: focusOnMount.current,
  781. onClose: stopAddingLink,
  782. position: "bottom center",
  783. shift: true
  784. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl, {
  785. key: forceRemountKey,
  786. value: linkValue,
  787. onChange: onChangeLink,
  788. onRemove: removeLink,
  789. forceIsEditingLink: addingLink,
  790. hasRichPreviews: true,
  791. createSuggestion: createPageEntity && handleCreate,
  792. withCreateSuggestion: userCanCreatePages,
  793. createSuggestionButtonText: createButtonText,
  794. hasTextControl: true
  795. }));
  796. }
  797. function getRichTextValueFromSelection(value, isActive) {
  798. // Default to the selection ranges on the RichTextValue object.
  799. let textStart = value.start;
  800. let textEnd = value.end; // If the format is currently active then the rich text value
  801. // should always be taken from the bounds of the active format
  802. // and not the selected text.
  803. if (isActive) {
  804. const boundary = getFormatBoundary(value, {
  805. type: 'core/link'
  806. });
  807. textStart = boundary.start; // Text *selection* always extends +1 beyond the edge of the format.
  808. // We account for that here.
  809. textEnd = boundary.end + 1;
  810. } // Get a RichTextValue containing the selected text content.
  811. return (0,external_wp_richText_namespaceObject.slice)(value, textStart, textEnd);
  812. }
  813. /* harmony default export */ var inline = ((0,external_wp_components_namespaceObject.withSpokenMessages)(InlineLinkUI));
  814. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/link/index.js
  815. /**
  816. * WordPress dependencies
  817. */
  818. /**
  819. * Internal dependencies
  820. */
  821. const link_name = 'core/link';
  822. const link_title = (0,external_wp_i18n_namespaceObject.__)('Link');
  823. function link_Edit(_ref) {
  824. let {
  825. isActive,
  826. activeAttributes,
  827. value,
  828. onChange,
  829. onFocus,
  830. contentRef
  831. } = _ref;
  832. const [addingLink, setAddingLink] = (0,external_wp_element_namespaceObject.useState)(false);
  833. function addLink() {
  834. const text = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(value));
  835. if (text && (0,external_wp_url_namespaceObject.isURL)(text) && isValidHref(text)) {
  836. onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
  837. type: link_name,
  838. attributes: {
  839. url: text
  840. }
  841. }));
  842. } else if (text && (0,external_wp_url_namespaceObject.isEmail)(text)) {
  843. onChange((0,external_wp_richText_namespaceObject.applyFormat)(value, {
  844. type: link_name,
  845. attributes: {
  846. url: `mailto:${text}`
  847. }
  848. }));
  849. } else {
  850. setAddingLink(true);
  851. }
  852. }
  853. function stopAddingLink() {
  854. setAddingLink(false);
  855. onFocus();
  856. }
  857. function onRemoveFormat() {
  858. onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, link_name));
  859. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Link removed.'), 'assertive');
  860. }
  861. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
  862. type: "primary",
  863. character: "k",
  864. onUse: addLink
  865. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
  866. type: "primaryShift",
  867. character: "k",
  868. onUse: onRemoveFormat
  869. }), isActive && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  870. name: "link",
  871. icon: link_off,
  872. title: (0,external_wp_i18n_namespaceObject.__)('Unlink'),
  873. onClick: onRemoveFormat,
  874. isActive: isActive,
  875. shortcutType: "primaryShift",
  876. shortcutCharacter: "k"
  877. }), !isActive && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  878. name: "link",
  879. icon: library_link,
  880. title: link_title,
  881. onClick: addLink,
  882. isActive: isActive,
  883. shortcutType: "primary",
  884. shortcutCharacter: "k"
  885. }), (addingLink || isActive) && (0,external_wp_element_namespaceObject.createElement)(inline, {
  886. addingLink: addingLink,
  887. stopAddingLink: stopAddingLink,
  888. isActive: isActive,
  889. activeAttributes: activeAttributes,
  890. value: value,
  891. onChange: onChange,
  892. contentRef: contentRef
  893. }));
  894. }
  895. const build_module_link_link = {
  896. name: link_name,
  897. title: link_title,
  898. tagName: 'a',
  899. className: null,
  900. attributes: {
  901. url: 'href',
  902. type: 'data-type',
  903. id: 'data-id',
  904. target: 'target'
  905. },
  906. __unstablePasteRule(value, _ref2) {
  907. let {
  908. html,
  909. plainText
  910. } = _ref2;
  911. if ((0,external_wp_richText_namespaceObject.isCollapsed)(value)) {
  912. return value;
  913. }
  914. const pastedText = (html || plainText).replace(/<[^>]+>/g, '').trim(); // A URL was pasted, turn the selection into a link.
  915. if (!(0,external_wp_url_namespaceObject.isURL)(pastedText)) {
  916. return value;
  917. } // Allows us to ask for this information when we get a report.
  918. window.console.log('Created link:\n\n', pastedText);
  919. return (0,external_wp_richText_namespaceObject.applyFormat)(value, {
  920. type: link_name,
  921. attributes: {
  922. url: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(pastedText)
  923. }
  924. });
  925. },
  926. edit: link_Edit
  927. };
  928. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-strikethrough.js
  929. /**
  930. * WordPress dependencies
  931. */
  932. const formatStrikethrough = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  933. xmlns: "http://www.w3.org/2000/svg",
  934. viewBox: "0 0 24 24"
  935. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  936. 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"
  937. }));
  938. /* harmony default export */ var format_strikethrough = (formatStrikethrough);
  939. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/strikethrough/index.js
  940. /**
  941. * WordPress dependencies
  942. */
  943. const strikethrough_name = 'core/strikethrough';
  944. const strikethrough_title = (0,external_wp_i18n_namespaceObject.__)('Strikethrough');
  945. const strikethrough = {
  946. name: strikethrough_name,
  947. title: strikethrough_title,
  948. tagName: 's',
  949. className: null,
  950. edit(_ref) {
  951. let {
  952. isActive,
  953. value,
  954. onChange,
  955. onFocus
  956. } = _ref;
  957. function onClick() {
  958. onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  959. type: strikethrough_name,
  960. title: strikethrough_title
  961. }));
  962. onFocus();
  963. }
  964. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
  965. type: "access",
  966. character: "d",
  967. onUse: onClick
  968. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  969. icon: format_strikethrough,
  970. title: strikethrough_title,
  971. onClick: onClick,
  972. isActive: isActive,
  973. role: "menuitemcheckbox"
  974. }));
  975. }
  976. };
  977. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/underline/index.js
  978. /**
  979. * WordPress dependencies
  980. */
  981. const underline_name = 'core/underline';
  982. const underline_title = (0,external_wp_i18n_namespaceObject.__)('Underline');
  983. const underline = {
  984. name: underline_name,
  985. title: underline_title,
  986. tagName: 'span',
  987. className: null,
  988. attributes: {
  989. style: 'style'
  990. },
  991. edit(_ref) {
  992. let {
  993. value,
  994. onChange
  995. } = _ref;
  996. const onToggle = () => {
  997. onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  998. type: underline_name,
  999. attributes: {
  1000. style: 'text-decoration: underline;'
  1001. },
  1002. title: underline_title
  1003. }));
  1004. };
  1005. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextShortcut, {
  1006. type: "primary",
  1007. character: "u",
  1008. onUse: onToggle
  1009. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent, {
  1010. inputType: "formatUnderline",
  1011. onInput: onToggle
  1012. }));
  1013. }
  1014. };
  1015. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
  1016. /**
  1017. * WordPress dependencies
  1018. */
  1019. /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
  1020. /**
  1021. * Return an SVG icon.
  1022. *
  1023. * @param {IconProps} props icon is the SVG component to render
  1024. * size is a number specifiying the icon size in pixels
  1025. * Other props will be passed to wrapped SVG component
  1026. *
  1027. * @return {JSX.Element} Icon component
  1028. */
  1029. function Icon(_ref) {
  1030. let {
  1031. icon,
  1032. size = 24,
  1033. ...props
  1034. } = _ref;
  1035. return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  1036. width: size,
  1037. height: size,
  1038. ...props
  1039. });
  1040. }
  1041. /* harmony default export */ var icon = (Icon);
  1042. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/text-color.js
  1043. /**
  1044. * WordPress dependencies
  1045. */
  1046. const textColor = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1047. xmlns: "http://www.w3.org/2000/svg",
  1048. viewBox: "0 0 24 24"
  1049. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1050. 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"
  1051. }));
  1052. /* harmony default export */ var text_color = (textColor);
  1053. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/text-color/inline.js
  1054. /**
  1055. * WordPress dependencies
  1056. */
  1057. /**
  1058. * Internal dependencies
  1059. */
  1060. function parseCSS() {
  1061. let css = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  1062. return css.split(';').reduce((accumulator, rule) => {
  1063. if (rule) {
  1064. const [property, value] = rule.split(':');
  1065. if (property === 'color') accumulator.color = value;
  1066. if (property === 'background-color' && value !== transparentValue) accumulator.backgroundColor = value;
  1067. }
  1068. return accumulator;
  1069. }, {});
  1070. }
  1071. function parseClassName() {
  1072. let className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  1073. let colorSettings = arguments.length > 1 ? arguments[1] : undefined;
  1074. return className.split(' ').reduce((accumulator, name) => {
  1075. // `colorSlug` could contain dashes, so simply match the start and end.
  1076. if (name.startsWith('has-') && name.endsWith('-color')) {
  1077. const colorSlug = name.replace(/^has-/, '').replace(/-color$/, '');
  1078. const colorObject = (0,external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues)(colorSettings, colorSlug);
  1079. accumulator.color = colorObject.color;
  1080. }
  1081. return accumulator;
  1082. }, {});
  1083. }
  1084. function getActiveColors(value, name, colorSettings) {
  1085. const activeColorFormat = (0,external_wp_richText_namespaceObject.getActiveFormat)(value, name);
  1086. if (!activeColorFormat) {
  1087. return {};
  1088. }
  1089. return { ...parseCSS(activeColorFormat.attributes.style),
  1090. ...parseClassName(activeColorFormat.attributes.class, colorSettings)
  1091. };
  1092. }
  1093. function setColors(value, name, colorSettings, colors) {
  1094. const {
  1095. color,
  1096. backgroundColor
  1097. } = { ...getActiveColors(value, name, colorSettings),
  1098. ...colors
  1099. };
  1100. if (!color && !backgroundColor) {
  1101. return (0,external_wp_richText_namespaceObject.removeFormat)(value, name);
  1102. }
  1103. const styles = [];
  1104. const classNames = [];
  1105. const attributes = {};
  1106. if (backgroundColor) {
  1107. styles.push(['background-color', backgroundColor].join(':'));
  1108. } else {
  1109. // Override default browser color for mark element.
  1110. styles.push(['background-color', transparentValue].join(':'));
  1111. }
  1112. if (color) {
  1113. const colorObject = (0,external_wp_blockEditor_namespaceObject.getColorObjectByColorValue)(colorSettings, color);
  1114. if (colorObject) {
  1115. classNames.push((0,external_wp_blockEditor_namespaceObject.getColorClassName)('color', colorObject.slug));
  1116. } else {
  1117. styles.push(['color', color].join(':'));
  1118. }
  1119. }
  1120. if (styles.length) attributes.style = styles.join(';');
  1121. if (classNames.length) attributes.class = classNames.join(' ');
  1122. return (0,external_wp_richText_namespaceObject.applyFormat)(value, {
  1123. type: name,
  1124. attributes
  1125. });
  1126. }
  1127. function ColorPicker(_ref) {
  1128. let {
  1129. name,
  1130. property,
  1131. value,
  1132. onChange
  1133. } = _ref;
  1134. const colors = (0,external_wp_data_namespaceObject.useSelect)(select => {
  1135. var _getSettings$colors;
  1136. const {
  1137. getSettings
  1138. } = select(external_wp_blockEditor_namespaceObject.store);
  1139. return (_getSettings$colors = getSettings().colors) !== null && _getSettings$colors !== void 0 ? _getSettings$colors : [];
  1140. }, []);
  1141. const onColorChange = (0,external_wp_element_namespaceObject.useCallback)(color => {
  1142. onChange(setColors(value, name, colors, {
  1143. [property]: color
  1144. }));
  1145. }, [colors, onChange, property]);
  1146. const activeColors = (0,external_wp_element_namespaceObject.useMemo)(() => getActiveColors(value, name, colors), [name, value, colors]);
  1147. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ColorPalette, {
  1148. value: activeColors[property],
  1149. onChange: onColorChange
  1150. });
  1151. }
  1152. function InlineColorUI(_ref2) {
  1153. let {
  1154. name,
  1155. value,
  1156. onChange,
  1157. onClose,
  1158. contentRef
  1159. } = _ref2;
  1160. /*
  1161. As you change the text color by typing a HEX value into a field,
  1162. the return value of document.getSelection jumps to the field you're editing,
  1163. not the highlighted text. Given that useAnchor uses document.getSelection,
  1164. it will return null, since it can't find the <mark> element within the HEX input.
  1165. This caches the last truthy value of the selection anchor reference.
  1166. */
  1167. const popoverAnchor = (0,external_wp_blockEditor_namespaceObject.useCachedTruthy)((0,external_wp_richText_namespaceObject.useAnchor)({
  1168. editableContentElement: contentRef.current,
  1169. value,
  1170. settings: text_color_textColor
  1171. }));
  1172. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
  1173. onClose: onClose,
  1174. className: "components-inline-color-popover",
  1175. anchor: popoverAnchor
  1176. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
  1177. tabs: [{
  1178. name: 'color',
  1179. title: (0,external_wp_i18n_namespaceObject.__)('Text')
  1180. }, {
  1181. name: 'backgroundColor',
  1182. title: (0,external_wp_i18n_namespaceObject.__)('Background')
  1183. }]
  1184. }, tab => (0,external_wp_element_namespaceObject.createElement)(ColorPicker, {
  1185. name: name,
  1186. property: tab.name,
  1187. value: value,
  1188. onChange: onChange
  1189. })));
  1190. }
  1191. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/text-color/index.js
  1192. /**
  1193. * WordPress dependencies
  1194. */
  1195. /**
  1196. * Internal dependencies
  1197. */
  1198. const transparentValue = 'rgba(0, 0, 0, 0)';
  1199. const text_color_name = 'core/text-color';
  1200. const text_color_title = (0,external_wp_i18n_namespaceObject.__)('Highlight');
  1201. const EMPTY_ARRAY = [];
  1202. function getComputedStyleProperty(element, property) {
  1203. const {
  1204. ownerDocument
  1205. } = element;
  1206. const {
  1207. defaultView
  1208. } = ownerDocument;
  1209. const style = defaultView.getComputedStyle(element);
  1210. const value = style.getPropertyValue(property);
  1211. if (property === 'background-color' && value === transparentValue && element.parentElement) {
  1212. return getComputedStyleProperty(element.parentElement, property);
  1213. }
  1214. return value;
  1215. }
  1216. function fillComputedColors(element, _ref) {
  1217. let {
  1218. color,
  1219. backgroundColor
  1220. } = _ref;
  1221. if (!color && !backgroundColor) {
  1222. return;
  1223. }
  1224. return {
  1225. color: color || getComputedStyleProperty(element, 'color'),
  1226. backgroundColor: backgroundColor === transparentValue ? getComputedStyleProperty(element, 'background-color') : backgroundColor
  1227. };
  1228. }
  1229. function TextColorEdit(_ref2) {
  1230. let {
  1231. value,
  1232. onChange,
  1233. isActive,
  1234. activeAttributes,
  1235. contentRef
  1236. } = _ref2;
  1237. const allowCustomControl = (0,external_wp_blockEditor_namespaceObject.useSetting)('color.custom');
  1238. const colors = (0,external_wp_blockEditor_namespaceObject.useSetting)('color.palette') || EMPTY_ARRAY;
  1239. const [isAddingColor, setIsAddingColor] = (0,external_wp_element_namespaceObject.useState)(false);
  1240. const enableIsAddingColor = (0,external_wp_element_namespaceObject.useCallback)(() => setIsAddingColor(true), [setIsAddingColor]);
  1241. const disableIsAddingColor = (0,external_wp_element_namespaceObject.useCallback)(() => setIsAddingColor(false), [setIsAddingColor]);
  1242. const colorIndicatorStyle = (0,external_wp_element_namespaceObject.useMemo)(() => fillComputedColors(contentRef.current, getActiveColors(value, text_color_name, colors)), [value, colors]);
  1243. const hasColorsToChoose = colors.length || !allowCustomControl;
  1244. if (!hasColorsToChoose && !isActive) {
  1245. return null;
  1246. }
  1247. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  1248. className: "format-library-text-color-button",
  1249. isActive: isActive,
  1250. icon: (0,external_wp_element_namespaceObject.createElement)(icon, {
  1251. icon: text_color,
  1252. style: colorIndicatorStyle
  1253. }),
  1254. title: text_color_title // If has no colors to choose but a color is active remove the color onClick.
  1255. ,
  1256. onClick: hasColorsToChoose ? enableIsAddingColor : () => onChange((0,external_wp_richText_namespaceObject.removeFormat)(value, text_color_name)),
  1257. role: "menuitemcheckbox"
  1258. }), isAddingColor && (0,external_wp_element_namespaceObject.createElement)(InlineColorUI, {
  1259. name: text_color_name,
  1260. onClose: disableIsAddingColor,
  1261. activeAttributes: activeAttributes,
  1262. value: value,
  1263. onChange: onChange,
  1264. contentRef: contentRef
  1265. }));
  1266. }
  1267. const text_color_textColor = {
  1268. name: text_color_name,
  1269. title: text_color_title,
  1270. tagName: 'mark',
  1271. className: 'has-inline-color',
  1272. attributes: {
  1273. style: 'style',
  1274. class: 'class'
  1275. },
  1276. /*
  1277. * Since this format relies on the <mark> tag, it's important to
  1278. * prevent the default yellow background color applied by most
  1279. * browsers. The solution is to detect when this format is used with a
  1280. * text color but no background color, and in such cases to override
  1281. * the default styling with a transparent background.
  1282. *
  1283. * @see https://github.com/WordPress/gutenberg/pull/35516
  1284. */
  1285. __unstableFilterAttributeValue(key, value) {
  1286. if (key !== 'style') return value; // We should not add a background-color if it's already set.
  1287. if (value && value.includes('background-color')) return value;
  1288. const addedCSS = ['background-color', transparentValue].join(':'); // Prepend `addedCSS` to avoid a double `;;` as any the existing CSS
  1289. // rules will already include a `;`.
  1290. return value ? [addedCSS, value].join(';') : addedCSS;
  1291. },
  1292. edit: TextColorEdit
  1293. };
  1294. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/subscript.js
  1295. /**
  1296. * WordPress dependencies
  1297. */
  1298. const subscript = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1299. xmlns: "http://www.w3.org/2000/svg",
  1300. viewBox: "0 0 24 24"
  1301. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1302. 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"
  1303. }));
  1304. /* harmony default export */ var library_subscript = (subscript);
  1305. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/subscript/index.js
  1306. /**
  1307. * WordPress dependencies
  1308. */
  1309. const subscript_name = 'core/subscript';
  1310. const subscript_title = (0,external_wp_i18n_namespaceObject.__)('Subscript');
  1311. const subscript_subscript = {
  1312. name: subscript_name,
  1313. title: subscript_title,
  1314. tagName: 'sub',
  1315. className: null,
  1316. edit(_ref) {
  1317. let {
  1318. isActive,
  1319. value,
  1320. onChange,
  1321. onFocus
  1322. } = _ref;
  1323. function onToggle() {
  1324. onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  1325. type: subscript_name,
  1326. title: subscript_title
  1327. }));
  1328. }
  1329. function onClick() {
  1330. onToggle();
  1331. onFocus();
  1332. }
  1333. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  1334. icon: library_subscript,
  1335. title: subscript_title,
  1336. onClick: onClick,
  1337. isActive: isActive,
  1338. role: "menuitemcheckbox"
  1339. });
  1340. }
  1341. };
  1342. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/superscript.js
  1343. /**
  1344. * WordPress dependencies
  1345. */
  1346. const superscript = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1347. xmlns: "http://www.w3.org/2000/svg",
  1348. viewBox: "0 0 24 24"
  1349. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1350. 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"
  1351. }));
  1352. /* harmony default export */ var library_superscript = (superscript);
  1353. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/superscript/index.js
  1354. /**
  1355. * WordPress dependencies
  1356. */
  1357. const superscript_name = 'core/superscript';
  1358. const superscript_title = (0,external_wp_i18n_namespaceObject.__)('Superscript');
  1359. const superscript_superscript = {
  1360. name: superscript_name,
  1361. title: superscript_title,
  1362. tagName: 'sup',
  1363. className: null,
  1364. edit(_ref) {
  1365. let {
  1366. isActive,
  1367. value,
  1368. onChange,
  1369. onFocus
  1370. } = _ref;
  1371. function onToggle() {
  1372. onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  1373. type: superscript_name,
  1374. title: superscript_title
  1375. }));
  1376. }
  1377. function onClick() {
  1378. onToggle();
  1379. onFocus();
  1380. }
  1381. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  1382. icon: library_superscript,
  1383. title: superscript_title,
  1384. onClick: onClick,
  1385. isActive: isActive,
  1386. role: "menuitemcheckbox"
  1387. });
  1388. }
  1389. };
  1390. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/button.js
  1391. /**
  1392. * WordPress dependencies
  1393. */
  1394. const button_button = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1395. viewBox: "0 0 24 24",
  1396. xmlns: "http://www.w3.org/2000/svg"
  1397. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1398. d: "M19 6.5H5c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v7zM8 12.8h8v-1.5H8v1.5z"
  1399. }));
  1400. /* harmony default export */ var library_button = (button_button);
  1401. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/keyboard/index.js
  1402. /**
  1403. * WordPress dependencies
  1404. */
  1405. const keyboard_name = 'core/keyboard';
  1406. const keyboard_title = (0,external_wp_i18n_namespaceObject.__)('Keyboard input');
  1407. const keyboard = {
  1408. name: keyboard_name,
  1409. title: keyboard_title,
  1410. tagName: 'kbd',
  1411. className: null,
  1412. edit(_ref) {
  1413. let {
  1414. isActive,
  1415. value,
  1416. onChange,
  1417. onFocus
  1418. } = _ref;
  1419. function onToggle() {
  1420. onChange((0,external_wp_richText_namespaceObject.toggleFormat)(value, {
  1421. type: keyboard_name,
  1422. title: keyboard_title
  1423. }));
  1424. }
  1425. function onClick() {
  1426. onToggle();
  1427. onFocus();
  1428. }
  1429. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichTextToolbarButton, {
  1430. icon: library_button,
  1431. title: keyboard_title,
  1432. onClick: onClick,
  1433. isActive: isActive,
  1434. role: "menuitemcheckbox"
  1435. });
  1436. }
  1437. };
  1438. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/default-formats.js
  1439. /**
  1440. * Internal dependencies
  1441. */
  1442. /* 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]);
  1443. ;// CONCATENATED MODULE: ./node_modules/@wordpress/format-library/build-module/index.js
  1444. /**
  1445. * WordPress dependencies
  1446. */
  1447. /**
  1448. * Internal dependencies
  1449. */
  1450. default_formats.forEach(_ref => {
  1451. let {
  1452. name,
  1453. ...settings
  1454. } = _ref;
  1455. return (0,external_wp_richText_namespaceObject.registerFormatType)(name, settings);
  1456. });
  1457. (window.wp = window.wp || {}).formatLibrary = __webpack_exports__;
  1458. /******/ })()
  1459. ;