mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-18 00:25:37 +01:00
61ddc8d582
The following package versions were changed: @wordpress/annotations: 1.12.1 -> 1.12.2 @wordpress/block-directory: 1.5.5 -> 1.5.6 @wordpress/block-editor: 3.7.5 -> 3.7.6 @wordpress/block-library: 2.14.5 -> 2.14.6 @wordpress/blocks: 6.12.1 -> 6.12.2 @wordpress/components: 9.2.4 -> 9.2.5 @wordpress/core-data: 2.12.1 -> 2.12.2 @wordpress/data: 4.14.1 -> 4.14.2 @wordpress/data-controls: 1.8.1 -> 1.8.2 @wordpress/edit-post: 3.13.6 -> 3.13.7 @wordpress/editor: 9.12.5 -> 9.12.6 @wordpress/format-library: 1.14.5 -> 1.14.6 @wordpress/keyboard-shortcuts: 1.1.1 -> 1.1.2 @wordpress/list-reusable-blocks: 1.13.4 -> 1.13.5 @wordpress/notices: 2.0.1 -> 2.0.2 @wordpress/nux: 3.12.4 -> 3.12.5 @wordpress/rich-text: 3.12.1 -> 3.12.2 @wordpress/server-side-render: 1.8.4 -> 1.8.5 @wordpress/viewport: 2.13.1 -> 2.13.2 Description of editor changes included in the RC available at https://github.com/WordPress/gutenberg/pull/21083. Props itsjonq, mcsf, aduth. Fixes: #49688. Built from https://develop.svn.wordpress.org/trunk@47495 git-svn-id: http://core.svn.wordpress.org/trunk@47270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
24 KiB
JavaScript
2 lines
24 KiB
JavaScript
/*! This file is auto-generated */
|
|
this.wp=this.wp||{},this.wp.formatLibrary=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=430)}({0:function(t,e){!function(){t.exports=this.wp.element}()},1:function(t,e){!function(){t.exports=this.wp.i18n}()},12:function(t,e,n){"use strict";function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}n.d(e,"a",(function(){return r}))},13:function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}n.d(e,"a",(function(){return o}))},14:function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.d(e,"a",(function(){return r}))},15:function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var r=n(34),o=n(7);function c(t,e){return!e||"object"!==Object(r.a)(e)&&"function"!=typeof e?Object(o.a)(t):e}},159:function(t,e,n){"use strict";var r=n(0),o=n(9),c=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)(o.Path,{d:"M17.74 2.76c1.68 1.69 1.68 4.41 0 6.1l-1.53 1.52c-1.12 1.12-2.7 1.47-4.14 1.09l2.62-2.61.76-.77.76-.76c.84-.84.84-2.2 0-3.04-.84-.85-2.2-.85-3.04 0l-.77.76-3.38 3.38c-.37-1.44-.02-3.02 1.1-4.14l1.52-1.53c1.69-1.68 4.42-1.68 6.1 0zM8.59 13.43l5.34-5.34c.42-.42.42-1.1 0-1.52-.44-.43-1.13-.39-1.53 0l-5.33 5.34c-.42.42-.42 1.1 0 1.52.44.43 1.13.39 1.52 0zm-.76 2.29l4.14-4.15c.38 1.44.03 3.02-1.09 4.14l-1.52 1.53c-1.69 1.68-4.41 1.68-6.1 0-1.68-1.68-1.68-4.42 0-6.1l1.53-1.52c1.12-1.12 2.7-1.47 4.14-1.1l-4.14 4.15c-.85.84-.85 2.2 0 3.05.84.84 2.2.84 3.04 0z"}));e.a=c},16:function(t,e,n){"use strict";function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}n.d(e,"a",(function(){return r}))},17:function(t,e,n){"use strict";function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}n.d(e,"a",(function(){return o}))},19:function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(43);function o(t,e){if(null==t)return{};var n,o,c=Object(r.a)(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)n=i[o],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(c[n]=t[n])}return c}},192:function(t,e,n){"use strict";var r=n(0),o=n(9),c=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)(o.Path,{d:"M16 4h2v9H7v3l-5-4 5-4v3h9V4z"}));e.a=c},2:function(t,e){!function(){t.exports=this.lodash}()},20:function(t,e,n){"use strict";var r=n(38);var o=n(27),c=n(39);function i(t,e){return Object(r.a)(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,o=!1,c=void 0;try{for(var i,a=t[Symbol.iterator]();!(r=(i=a.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,c=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw c}}return n}}(t,e)||Object(o.a)(t,e)||Object(c.a)()}n.d(e,"a",(function(){return i}))},22:function(t,e){!function(){t.exports=this.wp.keycodes}()},24:function(t,e){!function(){t.exports=this.wp.richText}()},25:function(t,e,n){"use strict";function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}n.d(e,"a",(function(){return r}))},27:function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(25);function o(t,e){if(t){if("string"==typeof t)return Object(r.a)(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Object(r.a)(t,e):void 0}}},28:function(t,e){!function(){t.exports=this.wp.dom}()},290:function(t,e,n){"use strict";var r=n(0),o=n(9),c=Object(r.createElement)(o.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(o.Path,{d:"M9.4,16.6L4.8,12l4.6-4.6L8,6l-6,6l6,6L9.4,16.6z M14.6,16.6l4.6-4.6l-4.6-4.6L16,6l6,6l-6,6L14.6,16.6z"}));e.a=c},3:function(t,e){!function(){t.exports=this.wp.components}()},30:function(t,e){!function(){t.exports=this.wp.url}()},34:function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}n.d(e,"a",(function(){return r}))},38:function(t,e,n){"use strict";function r(t){if(Array.isArray(t))return t}n.d(e,"a",(function(){return r}))},39:function(t,e,n){"use strict";function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}n.d(e,"a",(function(){return r}))},4:function(t,e){!function(){t.exports=this.wp.data}()},43:function(t,e,n){"use strict";function r(t,e){if(null==t)return{};var n,r,o={},c=Object.keys(t);for(r=0;r<c.length;r++)n=c[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}n.d(e,"a",(function(){return r}))},430:function(t,e,n){"use strict";n.r(e);var r=n(19),o=n(24),c=n(0),i=n(1),a=n(6),l=n(9),u=Object(c.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(c.createElement)(l.Path,{d:"M6 4v13h4.54c1.37 0 2.46-.33 3.26-1 .8-.66 1.2-1.58 1.2-2.77 0-.84-.17-1.51-.51-2.01s-.9-.85-1.67-1.03v-.09c.57-.1 1.02-.4 1.36-.9s.51-1.13.51-1.91c0-1.14-.39-1.98-1.17-2.5C12.75 4.26 11.5 4 9.78 4H6zm2.57 5.15V6.26h1.36c.73 0 1.27.11 1.61.32.34.22.51.58.51 1.07 0 .54-.16.92-.47 1.15s-.82.35-1.51.35h-1.5zm0 2.19h1.6c1.44 0 2.16.53 2.16 1.61 0 .6-.17 1.05-.51 1.34s-.86.43-1.57.43H8.57v-3.38z"})),s="core/bold",b=Object(i.__)("Bold"),f={name:s,title:b,tagName:"strong",className:null,edit:function(t){var e=t.isActive,n=t.value,r=t.onChange,i=t.onFocus;function l(){r(Object(o.toggleFormat)(n,{type:s}))}return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.RichTextShortcut,{type:"primary",character:"b",onUse:l}),Object(c.createElement)(a.RichTextToolbarButton,{name:"bold",icon:u,title:b,onClick:function(){l(),i()},isActive:e,shortcutType:"primary",shortcutCharacter:"b"}),Object(c.createElement)(a.__unstableRichTextInputEvent,{inputType:"formatBold",onInput:l}))}},p=n(290),m="core/code",O=Object(i.__)("Inline Code"),v={name:m,title:O,tagName:"code",className:null,__unstableInputRule:function(t){var e=t,n=e.start,r=e.text;if("`"!==r.slice(n-1,n))return t;var c=r.slice(0,n-1).lastIndexOf("`");if(-1===c)return t;var i=c,a=n-2;return i===a?t:(t=Object(o.remove)(t,i,i+1),t=Object(o.remove)(t,a,a+1),t=Object(o.applyFormat)(t,{type:m},i,a))},edit:function(t){var e=t.value,n=t.onChange,r=t.onFocus,i=t.isActive;return Object(c.createElement)(a.RichTextToolbarButton,{icon:p.a,title:O,onClick:function(){n(Object(o.toggleFormat)(e,{type:m})),r()},isActive:i})}},h=n(5),d=n(14),j=n(13),g=n(15),y=n(16),w=n(7),E=n(17),k=n(3),C=n(22),x=n(192);function _(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function S(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?_(Object(n),!0).forEach((function(e){Object(h.a)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var T=["image"],P=Object(i.__)("Inline image"),A=function(t){return t.stopPropagation()};function M(){var t=window.getSelection();return t.rangeCount?t.getRangeAt(0):null}var R={name:"core/image",title:P,keywords:[Object(i.__)("photo"),Object(i.__)("media")],object:!0,tagName:"img",className:null,attributes:{className:"class",style:"style",url:"src",alt:"alt"},edit:function(t){function e(){var t;return Object(d.a)(this,e),(t=Object(g.a)(this,Object(y.a)(e).apply(this,arguments))).onChange=t.onChange.bind(Object(w.a)(t)),t.onKeyDown=t.onKeyDown.bind(Object(w.a)(t)),t.openModal=t.openModal.bind(Object(w.a)(t)),t.closeModal=t.closeModal.bind(Object(w.a)(t)),t.anchorRef=null,t.state={modal:!1},t}return Object(E.a)(e,t),Object(j.a)(e,[{key:"onChange",value:function(t){this.setState({width:t})}},{key:"onKeyDown",value:function(t){[C.LEFT,C.DOWN,C.RIGHT,C.UP,C.BACKSPACE,C.ENTER].indexOf(t.keyCode)>-1&&t.stopPropagation()}},{key:"openModal",value:function(){this.setState({modal:!0})}},{key:"closeModal",value:function(){this.setState({modal:!1})}},{key:"componentDidMount",value:function(){this.anchorRef=M()}},{key:"componentDidUpdate",value:function(t){(!t.isObjectActive&&this.props.isObjectActive||t.activeObjectAttributes.url!==this.props.activeObjectAttributes.url)&&(this.anchorRef=M())}},{key:"render",value:function(){var t=this,e=this.props,n=e.value,r=e.onChange,l=e.onFocus,u=e.isObjectActive,s=e.activeObjectAttributes;return Object(c.createElement)(a.MediaUploadCheck,null,Object(c.createElement)(a.RichTextToolbarButton,{icon:Object(c.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(k.Path,{d:"M4 16h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2zM4 5h10v9H4V5zm14 9v2h4v-2h-4zM2 20h20v-2H2v2zm6.4-8.8L7 9.4 5 12h8l-2.6-3.4-2 2.6z"})),title:P,onClick:this.openModal,isActive:u}),this.state.modal&&Object(c.createElement)(a.MediaUpload,{allowedTypes:T,onSelect:function(e){var c=e.id,i=e.url,a=e.alt,u=e.width;t.closeModal(),r(Object(o.insertObject)(n,{type:"core/image",attributes:{className:"wp-image-".concat(c),style:"width: ".concat(Math.min(u,150),"px;"),url:i,alt:a}})),l()},onClose:this.closeModal,render:function(t){return(0,t.open)(),null}}),u&&Object(c.createElement)(k.Popover,{position:"bottom center",focusOnMount:!1,anchorRef:this.anchorRef},Object(c.createElement)("form",{className:"block-editor-format-toolbar__image-container-content",onKeyPress:A,onKeyDown:this.onKeyDown,onSubmit:function(e){var o=n.replacements.slice();o[n.start]={type:"core/image",attributes:S({},s,{style:"width: ".concat(t.state.width,"px;")})},r(S({},n,{replacements:o})),e.preventDefault()}},Object(c.createElement)(k.TextControl,{className:"block-editor-format-toolbar__image-container-value",type:"number",label:Object(i.__)("Width"),value:this.state.width,min:1,onChange:this.onChange}),Object(c.createElement)(k.Button,{icon:x.a,label:Object(i.__)("Apply"),type:"submit"}))))}}],[{key:"getDerivedStateFromProps",value:function(t,e){var n=t.activeObjectAttributes.style;return n===e.previousStyle?null:n?{width:n.replace(/\D/g,""),previousStyle:n}:{width:void 0,previousStyle:n}}}]),e}(c.Component)},L=Object(c.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(c.createElement)(l.Path,{d:"M14.78 6h-2.13l-2.8 9h2.12l-.62 2H4.6l.62-2h2.14l2.8-9H8.03l.62-2h6.75z"})),F="core/italic",N=Object(i.__)("Italic"),z={name:F,title:N,tagName:"em",className:null,edit:function(t){var e=t.isActive,n=t.value,r=t.onChange,i=t.onFocus;function l(){r(Object(o.toggleFormat)(n,{type:F}))}return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.RichTextShortcut,{type:"primary",character:"i",onUse:l}),Object(c.createElement)(a.RichTextToolbarButton,{name:"italic",icon:L,title:N,onClick:function(){l(),i()},isActive:e,shortcutType:"primary",shortcutCharacter:"i"}),Object(c.createElement)(a.__unstableRichTextInputEvent,{inputType:"formatItalic",onInput:l}))}},I=n(30),B=n(58),H=Object(c.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(c.createElement)(l.Path,{d:"M17.74 2.26c1.68 1.69 1.68 4.41 0 6.1l-1.53 1.52c-.32.33-.69.58-1.08.77L13 10l1.69-1.64.76-.77.76-.76c.84-.84.84-2.2 0-3.04-.84-.85-2.2-.85-3.04 0l-.77.76-.76.76L10 7l-.65-2.14c.19-.38.44-.75.77-1.07l1.52-1.53c1.69-1.68 4.42-1.68 6.1 0zM2 4l8 6-6-8zm4-2l4 8-2-8H6zM2 6l8 4-8-2V6zm7.36 7.69L10 13l.74 2.35-1.38 1.39c-1.69 1.68-4.41 1.68-6.1 0-1.68-1.68-1.68-4.42 0-6.1l1.39-1.38L7 10l-.69.64-1.52 1.53c-.85.84-.85 2.2 0 3.04.84.85 2.2.85 3.04 0zM18 16l-8-6 6 8zm-4 2l-4-8 2 8h2zm4-4l-8-4 8 2v2z"})),V=n(159),D=n(20),U=n(2);function G(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function K(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?G(Object(n),!0).forEach((function(e){Object(h.a)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):G(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var W=Object(k.withSpokenMessages)((function(t){var e=t.isActive,n=t.activeAttributes,r=t.addingLink,l=t.value,u=t.onChange,s=t.speak,b=t.stopAddingLink,f=Object(c.useMemo)(U.uniqueId,[r]),p=Object(c.useState)(),m=Object(D.a)(p,2),O=m[0],v=m[1],h=Object(c.useMemo)((function(){var t=window.getSelection();if(t.rangeCount){var n=t.getRangeAt(0);if(r&&!e)return n;var o=n.startContainer;for(o=o.nextElementSibling||o;o.nodeType!==window.Node.ELEMENT_NODE;)o=o.parentNode;return o.closest("a")}}),[r,l.start,l.end]),d=K({url:n.url,opensInNewTab:"_blank"===n.target},O);return Object(c.createElement)(k.Popover,{key:f,anchorRef:h,focusOnMount:!!r&&"firstElement",onClose:b,position:"bottom center"},Object(c.createElement)(a.__experimentalLinkControl,{value:d,onChange:function(t){t=K({},O,{},t);var n=d.opensInNewTab!==t.opensInNewTab&&d.url===t.url,r=n&&void 0===t.url;if(v(r?t:void 0),!r){var c=Object(I.prependHTTP)(t.url),a=function(t){var e={type:"core/link",attributes:{url:t.url}};return t.opensInNewWindow&&(e.attributes.target="_blank",e.attributes.rel="noreferrer noopener"),e}({url:c,opensInNewWindow:t.opensInNewTab});if(Object(o.isCollapsed)(l)&&!e){var f=Object(o.applyFormat)(Object(o.create)({text:c}),a,0,c.length);u(Object(o.insert)(l,f))}else u(Object(o.applyFormat)(l,a));n||b(),!function(t){if(!t)return!1;var e=t.trim();if(!e)return!1;if(/^\S+:/.test(e)){var n=Object(I.getProtocol)(e);if(!Object(I.isValidProtocol)(n))return!1;if(Object(U.startsWith)(n,"http")&&!/^https?:\/\/[^\/\s]/i.test(e))return!1;var r=Object(I.getAuthority)(e);if(!Object(I.isValidAuthority)(r))return!1;var o=Object(I.getPath)(e);if(o&&!Object(I.isValidPath)(o))return!1;var c=Object(I.getQueryString)(e);if(c&&!Object(I.isValidQueryString)(c))return!1;var i=Object(I.getFragment)(e);if(i&&!Object(I.isValidFragment)(i))return!1}return!(Object(U.startsWith)(e,"#")&&!Object(I.isValidFragment)(e))}(c)?s(Object(i.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive"):s(e?Object(i.__)("Link edited."):Object(i.__)("Link inserted."),"assertive")}},forceIsEditingLink:r}))})),Q=Object(i.__)("Link"),$={name:"core/link",title:Q,tagName:"a",className:null,attributes:{url:"href",target:"target"},__unstablePasteRule:function(t,e){var n=e.html,r=e.plainText;if(Object(o.isCollapsed)(t))return t;var c=(n||r).replace(/<[^>]+>/g,"").trim();return Object(I.isURL)(c)?(window.console.log("Created link:\n\n",c),Object(o.applyFormat)(t,{type:"core/link",attributes:{url:Object(B.decodeEntities)(c)}})):t},edit:Object(k.withSpokenMessages)(function(t){function e(){var t;return Object(d.a)(this,e),(t=Object(g.a)(this,Object(y.a)(e).apply(this,arguments))).addLink=t.addLink.bind(Object(w.a)(t)),t.stopAddingLink=t.stopAddingLink.bind(Object(w.a)(t)),t.onRemoveFormat=t.onRemoveFormat.bind(Object(w.a)(t)),t.state={addingLink:!1},t}return Object(E.a)(e,t),Object(j.a)(e,[{key:"addLink",value:function(){var t=this.props,e=t.value,n=t.onChange,r=Object(o.getTextContent)(Object(o.slice)(e));r&&Object(I.isURL)(r)?n(Object(o.applyFormat)(e,{type:"core/link",attributes:{url:r}})):r&&Object(I.isEmail)(r)?n(Object(o.applyFormat)(e,{type:"core/link",attributes:{url:"mailto:".concat(r)}})):this.setState({addingLink:!0})}},{key:"stopAddingLink",value:function(){this.setState({addingLink:!1}),this.props.onFocus()}},{key:"onRemoveFormat",value:function(){var t=this.props,e=t.value,n=t.onChange,r=t.speak;n(Object(o.removeFormat)(e,"core/link")),r(Object(i.__)("Link removed."),"assertive")}},{key:"render",value:function(){var t=this.props,e=t.isActive,n=t.activeAttributes,r=t.value,o=t.onChange;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.RichTextShortcut,{type:"primary",character:"k",onUse:this.addLink}),Object(c.createElement)(a.RichTextShortcut,{type:"primaryShift",character:"k",onUse:this.onRemoveFormat}),e&&Object(c.createElement)(a.RichTextToolbarButton,{name:"link",icon:H,title:Object(i.__)("Unlink"),onClick:this.onRemoveFormat,isActive:e,shortcutType:"primaryShift",shortcutCharacter:"k"}),!e&&Object(c.createElement)(a.RichTextToolbarButton,{name:"link",icon:V.a,title:Q,onClick:this.addLink,isActive:e,shortcutType:"primary",shortcutCharacter:"k"}),(this.state.addingLink||e)&&Object(c.createElement)(W,{addingLink:this.state.addingLink,stopAddingLink:this.stopAddingLink,isActive:e,activeAttributes:n,value:r,onChange:o}))}}]),e}(c.Component))},q=Object(c.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(c.createElement)(l.Path,{d:"M15.82 12.25c.26 0 .5-.02.74-.07.23-.05.48-.12.73-.2v.84c-.46.17-.99.26-1.58.26-.88 0-1.54-.26-2.01-.79-.39-.44-.62-1.04-.68-1.79h-.94c.12.21.18.48.18.79 0 .54-.18.95-.55 1.26-.38.3-.9.45-1.56.45H8v-2.5H6.59l.93 2.5H6.49l-.59-1.67H3.62L3.04 13H2l.93-2.5H2v-1h1.31l.93-2.49H5.3l.92 2.49H8V7h1.77c1 0 1.41.17 1.77.41.37.24.55.62.55 1.13 0 .35-.09.64-.27.87l-.08.09h1.29c.05-.4.15-.77.31-1.1.23-.46.55-.82.98-1.06.43-.25.93-.37 1.51-.37.61 0 1.17.12 1.69.38l-.35.81c-.2-.1-.42-.18-.64-.25s-.46-.11-.71-.11c-.55 0-.99.2-1.31.59-.23.29-.38.66-.44 1.11H17v1h-2.95c.06.5.2.9.44 1.19.3.37.75.56 1.33.56zM4.44 8.96l-.18.54H5.3l-.22-.61c-.04-.11-.09-.28-.17-.51-.07-.24-.12-.41-.14-.51-.08.33-.18.69-.33 1.09zm4.53-1.09V9.5h1.19c.28-.02.49-.09.64-.18.19-.13.28-.35.28-.66 0-.28-.1-.48-.3-.61-.2-.12-.53-.18-.97-.18h-.84zm-3.33 2.64v-.01H3.91v.01h1.73zm5.28.01l-.03-.02H8.97v1.68h1.04c.4 0 .71-.08.92-.23.21-.16.31-.4.31-.74 0-.31-.11-.54-.32-.69z"})),J="core/strikethrough",X=Object(i.__)("Strikethrough"),Y={name:J,title:X,tagName:"s",className:null,edit:function(t){var e=t.isActive,n=t.value,r=t.onChange,i=t.onFocus;return Object(c.createElement)(a.RichTextToolbarButton,{icon:q,title:X,onClick:function(){r(Object(o.toggleFormat)(n,{type:J})),i()},isActive:e})}},Z={name:"core/underline",title:Object(i.__)("Underline"),tagName:"span",className:null,attributes:{style:"style"},edit:function(t){var e=t.value,n=t.onChange,r=function(){n(Object(o.toggleFormat)(e,{type:"core/underline",attributes:{style:"text-decoration: underline;"}}))};return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.RichTextShortcut,{type:"primary",character:"u",onUse:r}),Object(c.createElement)(a.__unstableRichTextInputEvent,{inputType:"formatUnderline",onInput:r}))}},tt=n(4),et=n(12),nt=n(28);function rt(t,e,n){var r=Object(o.getActiveFormat)(e,t);if(r){var c=r.attributes.style;if(c)return c.replace(new RegExp("^color:\\s*"),"");var i=r.attributes.class;if(i){var l=i.replace(/.*has-(.*?)-color.*/,"$1");return Object(a.getColorObjectByAttributeValues)(n,l).color}}}var ot=function(t){var e=t.addingColor,n=Object(r.a)(t,["addingColor"]),o=Object(c.useMemo)((function(){var t=window.getSelection(),n=t.rangeCount>0?t.getRangeAt(0):null;if(n){if(e)return Object(nt.getRectangleFromRange)(n);var r=n.startContainer;for(r=r.nextElementSibling||r;r.nodeType!==window.Node.ELEMENT_NODE;)r=r.parentNode;var o=r.closest("span");return o?o.getBoundingClientRect():void 0}}),[]);return o?Object(c.createElement)(a.URLPopover,Object(et.a)({anchorRect:o},n)):null},ct=function(t){var e=t.name,n=t.value,r=t.onChange,i=Object(tt.useSelect)((function(t){var e=t("core/block-editor").getSettings;return Object(U.get)(e(),["colors"],[])})),l=Object(c.useCallback)((function(t){if(t){var c=Object(a.getColorObjectByColorValue)(i,t);r(Object(o.applyFormat)(n,{type:e,attributes:c?{class:Object(a.getColorClassName)("color",c.slug)}:{style:"color:".concat(t)}}))}else r(Object(o.removeFormat)(n,e))}),[i,r]),u=Object(c.useMemo)((function(){return rt(e,n,i)}),[e,n,i]);return Object(c.createElement)(a.ColorPalette,{value:u,onChange:l})},it=Object(k.withSpokenMessages)((function(t){var e=t.name,n=t.value,r=t.onChange,o=t.onClose,i=t.isActive,a=t.addingColor;return Object(c.createElement)(ot,{value:n,isActive:i,addingColor:a,onClose:o,className:"components-inline-color-popover"},Object(c.createElement)(ct,{name:e,value:n,onChange:r}))})),at="core/text-color",lt=Object(i.__)("Text Color"),ut=[];[f,v,R,z,$,Y,Z,{name:at,title:lt,tagName:"span",className:"has-inline-color",attributes:{style:"style",class:"class"},edit:function(t){var e=t.value,n=t.onChange,r=t.isActive,i=t.activeAttributes,l=Object(tt.useSelect)((function(t){var e,n=t("core/block-editor");return e=n&&n.getSettings?n.getSettings():{},{colors:Object(U.get)(e,["colors"],ut),disableCustomColors:e.disableCustomColors}})),u=l.colors,s=l.disableCustomColors,b=Object(c.useState)(!1),f=Object(D.a)(b,2),p=f[0],m=f[1],O=Object(c.useCallback)((function(){return m(!0)}),[m]),v=Object(c.useCallback)((function(){return m(!1)}),[m]),h=Object(c.useMemo)((function(){var t=rt(at,e,u);if(t)return{backgroundColor:t}}),[e,u]),d=!Object(U.isEmpty)(u)||!0!==s;return d||r?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.RichTextToolbarButton,{key:r?"text-color":"text-color-not-active",className:"format-library-text-color-button",name:r?"text-color":void 0,icon:Object(c.createElement)(c.Fragment,null,Object(c.createElement)(k.Dashicon,{icon:"editor-textcolor"}),r&&Object(c.createElement)("span",{className:"format-library-text-color-button__indicator",style:h})),title:lt,onClick:d?O:function(){return n(Object(o.removeFormat)(e,at))}}),p&&Object(c.createElement)(it,{name:at,addingColor:p,onClose:v,isActive:r,activeAttributes:i,value:e,onChange:n})):null}}].forEach((function(t){var e=t.name,n=Object(r.a)(t,["name"]);return Object(o.registerFormatType)(e,n)}))},5:function(t,e,n){"use strict";function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,"a",(function(){return r}))},58:function(t,e){!function(){t.exports=this.wp.htmlEntities}()},6:function(t,e){!function(){t.exports=this.wp.blockEditor}()},7:function(t,e,n){"use strict";function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}n.d(e,"a",(function(){return r}))},9:function(t,e){!function(){t.exports=this.wp.primitives}()}}); |