2024-12-13 14:06:24 -05:00
|
|
|
(()=>{"use strict";const t=window.wp.richText,e=window.wp.i18n,n=window.wp.blockEditor,o=window.wp.primitives,r=window.ReactJSXRuntime,i=(0,r.jsx)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(o.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"})}),a="core/bold",s=(0,e.__)("Bold"),l={name:a,title:s,tagName:"strong",className:null,edit({isActive:e,value:o,onChange:l,onFocus:c}){function u(){l((0,t.toggleFormat)(o,{type:a,title:s}))}return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.RichTextShortcut,{type:"primary",character:"b",onUse:u}),(0,r.jsx)(n.RichTextToolbarButton,{name:"bold",icon:i,title:s,onClick:function(){l((0,t.toggleFormat)(o,{type:a})),c()},isActive:e,shortcutType:"primary",shortcutCharacter:"b"}),(0,r.jsx)(n.__unstableRichTextInputEvent,{inputType:"formatBold",onInput:u})]})}},c=(0,r.jsx)(o.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)(o.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"})}),u="core/code",h=(0,e.__)("Inline code"),m={name:u,title:h,tagName:"code",className:null,__unstableInputRule(e){const{start:n,text:o}=e;if("`"!==o[n-1])return e;if(n-2<0)return e;const r=o.lastIndexOf("`",n-2);if(-1===r)return e;const i=r,a=n-2;return i===a?e:(e=(0,t.remove)(e,i,i+1),e=(0,t.remove)(e,a,a+1),e=(0,t.applyFormat)(e,{type:u},i,a))},edit({value:e,onChange:o,onFocus:i,isActive:a}){function s(){o((0,t.toggleFormat)(e,{type:u,title:h})),i()}return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.RichTextShortcut,{type:"access",character:"x",onUse:s}),(0,r.jsx)(n.RichTextToolbarButton,{icon:c,title:h,onClick:s,isActive:a,role:"menuitemcheckbox"})]})}},p=window.wp.components,g=window.wp.element,d=["image"],x="core/image",v=(0,e.__)("Inline image"),f={name:x,title:v,keywords:[(0,e.__)("photo"),(0,e.__)("media")],object:!0,tagName:"img",className:null,attributes:{className:"class",style:"style",url:"src",alt:"alt"},edit:function({value:e,onChange:o,onFocus:i,isObjectActive:a,activeObjectAttributes:s,contentRef:l}){return(0,r.jsxs)(n.MediaUploadCheck,{children:[(0,r.jsx)(n.MediaUpload,{allowedTypes:d,onSelect:({id:n,url:r,alt:a,width:s})=>{o((0,t.insertObject)(e,{type:x,attributes:{className:`wp-image-${n}`,style:`width: ${Math.min(s,150)}px;`,url:r,alt:a}})),i()},render:({open:t})=>(0,r.jsx)(n.RichTextToolbarButton,{icon:(0,r.jsx)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(p.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:v,onClick:t,isActive:a})}),a&&(0,r.jsx)(b,{value:e,onChange:o,activeObjectAttributes:s,contentRef:l})]})}};function b({value:n,onChange:o,activeObjectAttributes:i,contentRef:a}){const{style:s,alt:l}=i,c=s?.replace(/\D/g,""),[u,h]=(0,g.useState)(c),[m,d]=(0,g.useState)(l),v=u!==c||m!==l,b=(0,t.useAnchor)({editableContentElement:a.current,settings:f});return(0,r.jsx)(p.Popover,{placement:"bottom",focusOnMount:!1,anchor:b,className:"block-editor-format-toolbar__image-popover",children:(0,r.jsx)("form",{className:"block-editor-format-toolbar__image-container-content",onSubmit:t=>{const e=n.replacements.slice();e[n.start]={type:x,attributes:{...i,style:c?`width: ${u}px;`:"",alt:m}},o({...n,replacements:e}),t.preventDefault()},children:(0,r.jsxs)(p.__experimentalVStack,{spacing:4,children:[(0,r.jsx)(p.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,e.__)("Width"),value:u,min:1,onChange:t=>{h(t)}}),(0,r.jsx)(p.TextareaControl,{label:(0,e.__)("Alternative t
|