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