mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-26 02:57:45 +01:00
a41c798835
In addition to all the packages being updated to the latest versions, this commit also includes some mandatory changes to avoid editor breakage: - Update React to to 18.2.0. - Add the right stylesheets to support iframed block editors. Props ntsekouras, mamaduka, flixos90, desrosj, peterwilsoncc. See #57471. Built from https://develop.svn.wordpress.org/trunk@55246 git-svn-id: http://core.svn.wordpress.org/trunk@54779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
21 KiB
JavaScript
2 lines
21 KiB
JavaScript
/*! This file is auto-generated */
|
|
!function(){"use strict";var e={r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t);var n=window.wp.richText,r=window.wp.element,o=window.wp.i18n,a=window.wp.blockEditor,l=window.wp.primitives;var c=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(l.Path,{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"}));const i="core/bold",s=(0,o.__)("Bold"),u={name:i,title:s,tagName:"strong",className:null,edit(e){let{isActive:t,value:o,onChange:l,onFocus:u}=e;function m(){l((0,n.toggleFormat)(o,{type:i,title:s}))}return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.RichTextShortcut,{type:"primary",character:"b",onUse:m}),(0,r.createElement)(a.RichTextToolbarButton,{name:"bold",icon:c,title:s,onClick:function(){l((0,n.toggleFormat)(o,{type:i})),u()},isActive:t,shortcutType:"primary",shortcutCharacter:"b"}),(0,r.createElement)(a.__unstableRichTextInputEvent,{inputType:"formatBold",onInput:m}))}};var m=(0,r.createElement)(l.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(l.Path,{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"}));const h="core/code",p=(0,o.__)("Inline code"),g={name:h,title:p,tagName:"code",className:null,__unstableInputRule(e){const{start:t,text:r}=e;if("`"!==r.slice(t-1,t))return e;const o=r.slice(0,t-1).lastIndexOf("`");if(-1===o)return e;const a=o,l=t-2;return a===l?e:(e=(0,n.remove)(e,a,a+1),e=(0,n.remove)(e,l,l+1),e=(0,n.applyFormat)(e,{type:h},a,l))},edit(e){let{value:t,onChange:o,onFocus:l,isActive:c}=e;function i(){o((0,n.toggleFormat)(t,{type:h,title:p})),l()}return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.RichTextShortcut,{type:"access",character:"x",onUse:i}),(0,r.createElement)(a.RichTextToolbarButton,{icon:m,title:p,onClick:i,isActive:c,role:"menuitemcheckbox"}))}};var v=window.wp.components;var d=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,r.createElement)(l.Path,{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"}));const w=["image"],b="core/image",f=(0,o.__)("Inline image"),y={name:b,title:f,keywords:[(0,o.__)("photo"),(0,o.__)("media")],object:!0,tagName:"img",className:null,attributes:{className:"class",style:"style",url:"src",alt:"alt"},edit:function(e){let{value:t,onChange:o,onFocus:l,isObjectActive:c,activeObjectAttributes:i,contentRef:s}=e;const[u,m]=(0,r.useState)(!1);function h(){m(!1)}return(0,r.createElement)(a.MediaUploadCheck,null,(0,r.createElement)(a.RichTextToolbarButton,{icon:(0,r.createElement)(v.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(v.Path,{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"})),title:f,onClick:function(){m(!0)},isActive:c}),u&&(0,r.createElement)(a.MediaUpload,{allowedTypes:w,onSelect:e=>{let{id:r,url:a,alt:c,width:i}=e;h(),o((0,n.insertObject)(t,{type:b,attributes:{className:`wp-image-${r}`,style:`width: ${Math.min(i,150)}px;`,url:a,alt:c}})),l()},onClose:h,render:e=>{let{open:t}=e;return t(),null}}),c&&(0,r.createElement)(E,{value:t,onChange:o,activeObjectAttributes:i,contentRef:s}))}};function E(e){let{value:t,onChange:a,activeObjectAttributes:l,contentRef:c}=e;const{style:i}=l,[s,u]=(0,r.useState)(null==i?void 0:i.replace(/\D/g,"")),m=(0,n.useAnchor)({editableContentElement:c.current,value:t,settings:y});return(0,r.createElement)(v.Popover,{placement:"bottom",focusOnMount:!1,anchor:m,className:"block-editor-format-toolbar__image-popover"},(0,r.createElement)("form",{className:"block-editor-format-toolbar__image-container-content",onSubmit:e=>{const n=t.replacements.slice();n[t.start]={type:b,attributes:{...l,style:s?`width: ${s}px;`:""}},a({...t,replacements:n}),e.preventDefault()}},(0,r.createElement)(v.TextControl,{className:"block-editor-format-toolbar__image-container-value",type:"number",label:(0,o.__)("Width"),value:s,min:1,onChange:e=>u(e)}),(0,r.createElement)(v.Button,{icon:d,label:(0,o.__)("Apply"),type:"submit"})))}var k=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(l.Path,{d:"M12.5 5L10 19h1.9l2.5-14z"}));const C="core/italic",x=(0,o.__)("Italic"),_={name:C,title:x,tagName:"em",className:null,edit(e){let{isActive:t,value:o,onChange:l,onFocus:c}=e;function i(){l((0,n.toggleFormat)(o,{type:C,title:x}))}return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.RichTextShortcut,{type:"primary",character:"i",onUse:i}),(0,r.createElement)(a.RichTextToolbarButton,{name:"italic",icon:k,title:x,onClick:function(){l((0,n.toggleFormat)(o,{type:C})),c()},isActive:t,shortcutType:"primary",shortcutCharacter:"i"}),(0,r.createElement)(a.__unstableRichTextInputEvent,{inputType:"formatItalic",onInput:i}))}};var T=window.wp.url,S=window.wp.htmlEntities;var F=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(l.Path,{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"}));var A=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(l.Path,{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"})),N=window.wp.a11y,R=window.wp.data;function P(e){if(!e)return!1;const t=e.trim();if(!t)return!1;if(/^\S+:/.test(t)){const e=(0,T.getProtocol)(t);if(!(0,T.isValidProtocol)(e))return!1;if(e.startsWith("http")&&!/^https?:\/\/[^\/\s]/i.test(t))return!1;const n=(0,T.getAuthority)(t);if(!(0,T.isValidAuthority)(n))return!1;const r=(0,T.getPath)(t);if(r&&!(0,T.isValidPath)(r))return!1;const o=(0,T.getQueryString)(t);if(o&&!(0,T.isValidQueryString)(o))return!1;const a=(0,T.getFragment)(t);if(a&&!(0,T.isValidFragment)(a))return!1}return!(t.startsWith("#")&&!(0,T.isValidFragment)(t))}function V(e,t){var n,r,o;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.start,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.end;const c={start:null,end:null},{formats:i}=e;let s,u;if(null==i||!i.length)return c;const m=i.slice(),h=null===(n=m[a])||void 0===n?void 0:n.find((e=>{let{type:n}=e;return n===t.type})),p=null===(r=m[l])||void 0===r?void 0:r.find((e=>{let{type:n}=e;return n===t.type})),g=null===(o=m[l-1])||void 0===o?void 0:o.find((e=>{let{type:n}=e;return n===t.type}));if(h)s=h,u=a;else if(p)s=p,u=l;else{if(!g)return c;s=g,u=l-1}const v=m[u].indexOf(s),d=[m,u,s,v];return a=B(...d),l=H(...d),a=a<0?0:a,{start:a,end:l}}function M(e,t,n,r,o){let a=t;const l={forwards:1,backwards:-1}[o]||1,c=-1*l;for(;e[a]&&e[a][r]===n;)a+=l;return a+=c,a}const z=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return e(...r,...n)}},B=z(M,"backwards"),H=z(M,"forwards"),L=new WeakMap;let I=-1;function j(e){return`link-control-instance-${e}`}var U=function(e){if(e)return L.has(e)?j(L.get(e)):(I+=1,L.set(e,I),j(I))};var G=(0,v.withSpokenMessages)((function(e){let{isActive:t,activeAttributes:l,addingLink:c,value:i,onChange:s,speak:u,stopAddingLink:m,contentRef:h}=e;const p=function(e,t){let r=e.start,o=e.end;if(t){const t=V(e,{type:"core/link"});r=t.start,o=t.end+1}return(0,n.slice)(e,r,o)}(i,t),g=p.text,[d,w]=(0,r.useState)(),{createPageEntity:b,userCanCreatePages:f}=(0,R.useSelect)((e=>{const{getSettings:t}=e(a.store),n=t();return{createPageEntity:n.__experimentalCreatePageEntity,userCanCreatePages:n.__experimentalUserCanCreatePages}}),[]),y={url:l.url,type:l.type,id:l.id,opensInNewTab:"_blank"===l.target,title:g,...d},E=(0,n.useAnchor)({editableContentElement:h.current,value:i,settings:$}),k=U(E),C=(0,r.useRef)(!!c&&"firstElement");return(0,r.createElement)(v.Popover,{anchor:E,focusOnMount:C.current,onClose:m,placement:"bottom",shift:!0},(0,r.createElement)(a.__experimentalLinkControl,{key:k,value:y,onChange:function(e){e={...d,...e};const r=y.opensInNewTab!==e.opensInNewTab&&y.url===e.url,a=r&&void 0===e.url;if(w(a?e:void 0),a)return;const l=(0,T.prependHTTP)(e.url),c=function(e){let{url:t,type:n,id:r,opensInNewWindow:o}=e;const a={type:"core/link",attributes:{url:t}};return n&&(a.attributes.type=n),r&&(a.attributes.id=r),o&&(a.attributes.target="_blank",a.attributes.rel="noreferrer noopener"),a}({url:l,type:e.type,id:void 0!==e.id&&null!==e.id?String(e.id):void 0,opensInNewWindow:e.opensInNewTab}),h=e.title||l;if((0,n.isCollapsed)(i)&&!t){const e=(0,n.applyFormat)((0,n.create)({text:h}),c,0,h.length);s((0,n.insert)(i,e))}else{let e;if(h===g)e=(0,n.applyFormat)(i,c);else{e=(0,n.create)({text:h}),e=(0,n.applyFormat)(e,c,0,h.length);const t=V(i,{type:"core/link"}),[r,o]=(0,n.split)(i,t.start,t.start),a=(0,n.replace)(o,g,e);e=(0,n.concat)(r,a)}e.start=e.end,e.activeFormats=[],s(e)}r||m(),P(l)?u(t?(0,o.__)("Link edited."):(0,o.__)("Link inserted."),"assertive"):u((0,o.__)("Warning: the link has been inserted but may have errors. Please test it."),"assertive")},onRemove:function(){const e=(0,n.removeFormat)(i,"core/link");s(e),m(),u((0,o.__)("Link removed."),"assertive")},forceIsEditingLink:c,hasRichPreviews:!0,createSuggestion:b&&async function(e){const t=await b({title:e,status:"draft"});return{id:t.id,type:t.type,title:t.title.rendered,url:t.link,kind:"post-type"}},withCreateSuggestion:f,createSuggestionButtonText:function(e){return(0,r.createInterpolateElement)((0,o.sprintf)((0,o.__)("Create Page: <mark>%s</mark>"),e),{mark:(0,r.createElement)("mark",null)})},hasTextControl:!0}))}));const O="core/link",W=(0,o.__)("Link");const $={name:O,title:W,tagName:"a",className:null,attributes:{url:"href",type:"data-type",id:"data-id",target:"target"},__unstablePasteRule(e,t){let{html:r,plainText:o}=t;if((0,n.isCollapsed)(e))return e;const a=(r||o).replace(/<[^>]+>/g,"").trim();return(0,T.isURL)(a)?(window.console.log("Created link:\n\n",a),(0,n.applyFormat)(e,{type:O,attributes:{url:(0,S.decodeEntities)(a)}})):e},edit:function(e){let{isActive:t,activeAttributes:l,value:c,onChange:i,onFocus:s,contentRef:u}=e;const[m,h]=(0,r.useState)(!1);function p(){const e=(0,n.getTextContent)((0,n.slice)(c));e&&(0,T.isURL)(e)&&P(e)?i((0,n.applyFormat)(c,{type:O,attributes:{url:e}})):e&&(0,T.isEmail)(e)?i((0,n.applyFormat)(c,{type:O,attributes:{url:`mailto:${e}`}})):h(!0)}function g(){i((0,n.removeFormat)(c,O)),(0,N.speak)((0,o.__)("Link removed."),"assertive")}return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.RichTextShortcut,{type:"primary",character:"k",onUse:p}),(0,r.createElement)(a.RichTextShortcut,{type:"primaryShift",character:"k",onUse:g}),t&&(0,r.createElement)(a.RichTextToolbarButton,{name:"link",icon:F,title:(0,o.__)("Unlink"),onClick:g,isActive:t,shortcutType:"primaryShift",shortcutCharacter:"k"}),!t&&(0,r.createElement)(a.RichTextToolbarButton,{name:"link",icon:A,title:W,onClick:p,isActive:t,shortcutType:"primary",shortcutCharacter:"k"}),(m||t)&&(0,r.createElement)(G,{addingLink:m,stopAddingLink:function(){h(!1),s()},isActive:t,activeAttributes:l,value:c,onChange:i,contentRef:u}))}};var D=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(l.Path,{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"}));const Q="core/strikethrough",K=(0,o.__)("Strikethrough"),q={name:Q,title:K,tagName:"s",className:null,edit(e){let{isActive:t,value:o,onChange:l,onFocus:c}=e;function i(){l((0,n.toggleFormat)(o,{type:Q,title:K})),c()}return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.RichTextShortcut,{type:"access",character:"d",onUse:i}),(0,r.createElement)(a.RichTextToolbarButton,{icon:D,title:K,onClick:i,isActive:t,role:"menuitemcheckbox"}))}},J="core/underline",X=(0,o.__)("Underline"),Y={name:J,title:X,tagName:"span",className:null,attributes:{style:"style"},edit(e){let{value:t,onChange:o}=e;const l=()=>{o((0,n.toggleFormat)(t,{type:J,attributes:{style:"text-decoration: underline;"},title:X}))};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.RichTextShortcut,{type:"primary",character:"u",onUse:l}),(0,r.createElement)(a.__unstableRichTextInputEvent,{inputType:"formatUnderline",onInput:l}))}};var Z=function(e){let{icon:t,size:n=24,...o}=e;return(0,r.cloneElement)(t,{width:n,height:n,...o})};var ee=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(l.Path,{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"}));var te=(0,r.createElement)(l.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(l.Path,{d:"M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"}));function ne(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.split(";").reduce(((e,t)=>{if(t){const[n,r]=t.split(":");"color"===n&&(e.color=r),"background-color"===n&&r!==ce&&(e.backgroundColor=r)}return e}),{})}function re(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return e.split(" ").reduce(((e,n)=>{if(n.startsWith("has-")&&n.endsWith("-color")){const r=n.replace(/^has-/,"").replace(/-color$/,""),o=(0,a.getColorObjectByAttributeValues)(t,r);e.color=o.color}return e}),{})}function oe(e,t,r){const o=(0,n.getActiveFormat)(e,t);return o?{...ne(o.attributes.style),...re(o.attributes.class,r)}:{}}function ae(e){let{name:t,property:o,value:l,onChange:c}=e;const i=(0,R.useSelect)((e=>{var t;const{getSettings:n}=e(a.store);return null!==(t=n().colors)&&void 0!==t?t:[]}),[]),s=(0,r.useCallback)((e=>{c(function(e,t,r,o){const{color:l,backgroundColor:c}={...oe(e,t,r),...o};if(!l&&!c)return(0,n.removeFormat)(e,t);const i=[],s=[],u={};if(c?i.push(["background-color",c].join(":")):i.push(["background-color",ce].join(":")),l){const e=(0,a.getColorObjectByColorValue)(r,l);e?s.push((0,a.getColorClassName)("color",e.slug)):i.push(["color",l].join(":"))}return i.length&&(u.style=i.join(";")),s.length&&(u.class=s.join(" ")),(0,n.applyFormat)(e,{type:t,attributes:u})}(l,t,i,{[o]:e}))}),[i,c,o]),u=(0,r.useMemo)((()=>oe(l,t,i)),[t,l,i]);return(0,r.createElement)(a.ColorPalette,{value:u[o],onChange:s})}function le(e){let{name:t,value:l,onChange:c,onClose:i,contentRef:s}=e;const u=(0,a.useCachedTruthy)((0,n.useAnchor)({editableContentElement:s.current,value:l,settings:he}));return(0,r.createElement)(v.Popover,{onClose:i,className:"components-inline-color-popover",anchor:u},(0,r.createElement)(v.TabPanel,{tabs:[{name:"color",title:(0,o.__)("Text")},{name:"backgroundColor",title:(0,o.__)("Background")}]},(e=>(0,r.createElement)(ae,{name:t,property:e.name,value:l,onChange:c}))))}const ce="rgba(0, 0, 0, 0)",ie="core/text-color",se=(0,o.__)("Highlight"),ue=[];function me(e,t){const{ownerDocument:n}=e,{defaultView:r}=n,o=r.getComputedStyle(e).getPropertyValue(t);return"background-color"===t&&o===ce&&e.parentElement?me(e.parentElement,t):o}const he={name:ie,title:se,tagName:"mark",className:"has-inline-color",attributes:{style:"style",class:"class"},__unstableFilterAttributeValue(e,t){if("style"!==e)return t;if(t&&t.includes("background-color"))return t;const n=["background-color",ce].join(":");return t?[n,t].join(";"):n},edit:function(e){let{value:t,onChange:o,isActive:l,activeAttributes:c,contentRef:i}=e;const s=(0,a.useSetting)("color.custom"),u=(0,a.useSetting)("color.palette")||ue,[m,h]=(0,r.useState)(!1),p=(0,r.useCallback)((()=>h(!0)),[h]),g=(0,r.useCallback)((()=>h(!1)),[h]),v=(0,r.useMemo)((()=>function(e,t){let{color:n,backgroundColor:r}=t;if(n||r)return{color:n||me(e,"color"),backgroundColor:r===ce?me(e,"background-color"):r}}(i.current,oe(t,ie,u))),[t,u]),d=u.length||!s;return d||l?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.RichTextToolbarButton,{className:"format-library-text-color-button",isActive:l,icon:(0,r.createElement)(Z,{icon:Object.keys(c).length?ee:te,style:v}),title:se,onClick:d?p:()=>o((0,n.removeFormat)(t,ie)),role:"menuitemcheckbox"}),m&&(0,r.createElement)(le,{name:ie,onClose:g,activeAttributes:c,value:t,onChange:o,contentRef:i})):null}};var pe=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(l.Path,{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"}));const ge="core/subscript",ve=(0,o.__)("Subscript"),de={name:ge,title:ve,tagName:"sub",className:null,edit(e){let{isActive:t,value:o,onChange:l,onFocus:c}=e;return(0,r.createElement)(a.RichTextToolbarButton,{icon:pe,title:ve,onClick:function(){l((0,n.toggleFormat)(o,{type:ge,title:ve})),c()},isActive:t,role:"menuitemcheckbox"})}};var we=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(l.Path,{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"}));const be="core/superscript",fe=(0,o.__)("Superscript"),ye={name:be,title:fe,tagName:"sup",className:null,edit(e){let{isActive:t,value:o,onChange:l,onFocus:c}=e;return(0,r.createElement)(a.RichTextToolbarButton,{icon:we,title:fe,onClick:function(){l((0,n.toggleFormat)(o,{type:be,title:fe})),c()},isActive:t,role:"menuitemcheckbox"})}};var Ee=(0,r.createElement)(l.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,r.createElement)(l.Path,{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"}));const ke="core/keyboard",Ce=(0,o.__)("Keyboard input"),xe={name:ke,title:Ce,tagName:"kbd",className:null,edit(e){let{isActive:t,value:o,onChange:l,onFocus:c}=e;return(0,r.createElement)(a.RichTextToolbarButton,{icon:Ee,title:Ce,onClick:function(){l((0,n.toggleFormat)(o,{type:ke,title:Ce})),c()},isActive:t,role:"menuitemcheckbox"})}};var _e=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(l.Path,{d:"M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"}));const Te="core/unknown",Se=(0,o.__)("Clear Unknown Formatting");[u,g,y,_,$,q,Y,he,de,ye,xe,{name:Te,title:Se,tagName:"*",className:null,edit(e){let{isActive:t,value:o,onChange:l,onFocus:c}=e;const i=(0,n.slice)(o).formats.some((e=>e.some((e=>e.type===Te))));return t||i?(0,r.createElement)(a.RichTextToolbarButton,{name:"unknown",icon:_e,title:Se,onClick:function(){l((0,n.removeFormat)(o,Te)),c()},isActive:!0}):null}}].forEach((e=>{let{name:t,...r}=e;return(0,n.registerFormatType)(t,r)})),(window.wp=window.wp||{}).formatLibrary=t}(); |