Changeset 3374099
- Timestamp:
- 10/07/2025 03:23:47 AM (5 months ago)
- Location:
- snow-monkey-editor/trunk
- Files:
-
- 21 edited
-
dist/js/editor.asset.php (modified) (1 diff)
-
dist/js/editor.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
snow-monkey-editor.php (modified) (1 diff)
-
src/format/badge/editor.js (modified) (5 diffs)
-
src/format/bg-color/editor.js (modified) (5 diffs)
-
src/format/br/editor.js (modified) (1 diff)
-
src/format/component/inline-background-color.js (modified) (7 diffs)
-
src/format/component/inline-color.js (modified) (7 diffs)
-
src/format/component/inline-font-size.js (modified) (4 diffs)
-
src/format/component/inline-gradient.js (modified) (7 diffs)
-
src/format/component/inline-highlighter.js (modified) (7 diffs)
-
src/format/component/inline-letter-spacing.js (modified) (5 diffs)
-
src/format/component/inline-line-height.js (modified) (5 diffs)
-
src/format/font-size/editor.js (modified) (5 diffs)
-
src/format/highlighter/editor.js (modified) (5 diffs)
-
src/format/letter-spacing/editor.js (modified) (5 diffs)
-
src/format/line-height/editor.js (modified) (5 diffs)
-
src/format/text-color/editor.js (modified) (5 diffs)
-
src/format/text-gradient/editor.js (modified) (5 diffs)
-
vendor/composer/platform_check.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
snow-monkey-editor/trunk/dist/js/editor.asset.php
r3274014 r3374099 1 <?php return array('dependencies' => array('lodash', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-preferences', 'wp-rich-text'), 'version' => '8 38587cedcd5eaa6f6ca');1 <?php return array('dependencies' => array('lodash', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-preferences', 'wp-rich-text'), 'version' => '85d5d5f767986326c6e9'); -
snow-monkey-editor/trunk/dist/js/editor.js
r3274014 r3374099 1 (()=>{var e={558:e=>{"use strict";var t=function(e){return parseInt(e,16)};e.exports=function(e, o){var n,s,r=function(e){return"#"===e.charAt(0)?e.slice(1):e}(e),a=function(e){var o=e.g,n=e.b,s=e.a;return{r:t(e.r),g:t(o),b:t(n),a:+(t(s)/255).toFixed(2)}}({r:(s=3===(n=r).length||4===n.length)?"".concat(n.slice(0,1)).concat(n.slice(0,1)):n.slice(0,2),g:s?"".concat(n.slice(1,2)).concat(n.slice(1,2)):n.slice(2,4),b:s?"".concat(n.slice(2,3)).concat(n.slice(2,3)):n.slice(4,6),a:(s?"".concat(n.slice(3,4)).concat(n.slice(3,4)):n.slice(6,8))||"ff"});return function(e,t){var o,n=e.r,s=e.g,r=e.b,a=e.a,i=(o=t,!isNaN(parseFloat(o))&&isFinite(o)?t:a);return"rgba(".concat(n,", ").concat(s,", ").concat(r,", ").concat(i,")")}(a,o)}},919:e=>{e.exports=function(e){if("string"!=typeof e)throw new Error("color has to be type of `string`");if("#"===e.substr(0,1))return{hex:e,alpha:1};var t=e.replace(/\s+/g,""),o=/(.*?)rgb(a)??\((\d{1,3}),(\d{1,3}),(\d{1,3})(,([01]|1.0*|0??\.([0-9]{0,})))??\)/.exec(t);if(!o)throw new Error("given color ("+e+") isn't a valid rgb or rgba color");var n=parseInt(o[3],10),s=parseInt(o[4],10),r=parseInt(o[5],10),a=o[6]?/([0-9\.]+)/.exec(o[6])[0]:"1",i=(r|s<<8|n<<16|1<<24).toString(16).slice(1);return"."===a.substr(0,1)&&(a=parseFloat("0"+a)),a=parseFloat(Math.round(100*a))/100,{hex:"#"+i.toString(16),alpha:a}}},942:(e,t)=>{var o;!function(){"use strict";var n={}.hasOwnProperty;function s(){for(var e="",t=0;t<arguments.length;t++){var o=arguments[t];o&&(e=a(e,r(o)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return s.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var o in e)n.call(e,o)&&e[o]&&(t=a(t,o));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(s.default=s,e.exports=s):void 0===(o=function(){return s}.apply(t,[]))||(e.exports=o)}()}},t={};function o(n){var s=t[n];if(void 0!==s)return s.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,o),r.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};o.r(e),o.d(e,{settings:()=>_});var t={};o.r(t),o.d(t,{settings:()=>B});var n={};o.r(n),o.d(n,{settings:()=>z});var s={};o.r(s),o.d(s,{settings:()=>V});var r={};o.r(r),o.d(r,{settings:()=>J});var a={};o.r(a),o.d(a,{settings:()=>ee});var i={};o.r(i),o.d(i,{settings:()=>ae});var l={};o.r(l),o.d(l,{settings:()=>be});var c={};o.r(c),o.d(c,{settings:()=>Ce});var m={};o.r(m),o.d(m,{settings:()=>je});const u=window.lodash,d=window.wp.blockEditor,g=window.wp.components,p=window.wp.richText,h=window.wp.i18n,b=window.ReactJSXRuntime,v=(0,b.jsx)("svg",{role:"img",focusable:"false",width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,b.jsx)("path",{d:"M13.982,16.711c-0.744,1.441 -2.248,2.428 -3.982,2.428c-1.735,0 -3.238,-0.986 -3.983,-2.428c0.909,-1.213 2.355,-2.002 3.983,-2.002c1.629,0 3.074,0.789 3.982,2.002Zm-0.748,-7.657c-0.314,2.56 1.248,2.919 1.248,5.603c0,0.467 -0.072,0.918 -0.205,1.344c-1.037,-1.203 -2.57,-1.967 -4.277,-1.967c-1.708,0 -3.24,0.764 -4.277,1.967c-0.133,-0.426 -0.205,-0.877 -0.205,-1.344c0,-2.684 1.563,-3.043 1.247,-5.603c-0.362,-2.928 -4.315,-2.465 -4.315,-5.334c0,-1.579 1.279,-2.858 2.858,-2.858c1.709,0 2.765,1.558 4.692,1.558c1.926,0 2.982,-1.558 4.691,-1.558c1.578,0 2.857,1.279 2.857,2.858c0.001,2.869 -3.952,2.406 -4.314,5.334Zm-4.677,-4.947l-0.708,0c0,0.498 -0.403,0.9 -0.901,0.9c-0.498,0 -0.901,-0.402 -0.901,-0.9l-0.708,0c0,0.889 0.72,1.609 1.609,1.609c0.889,0 1.609,-0.72 1.609,-1.609Zm0.979,7.141c0,-0.312 -0.253,-0.568 -0.566,-0.568c-0.313,0 -0.567,0.256 -0.567,0.568c0,0.312 0.254,0.566 0.567,0.566c0.313,0 0.566,-0.253 0.566,-0.566Zm2.062,0c0,-0.312 -0.254,-0.568 -0.568,-0.568c-0.312,0 -0.566,0.256 -0.566,0.568c0,0.312 0.254,0.566 0.566,0.566c0.314,0 0.568,-0.253 0.568,-0.566Zm3.062,-7.141l-0.707,0c0,0.498 -0.404,0.9 -0.9,0.9c-0.498,0 -0.902,-0.402 -0.902,-0.9l-0.707,0c0,0.889 0.721,1.609 1.609,1.609c0.886,0.001 1.607,-0.72 1.607,-1.609Z"})}),x={position:"bottom left",variant:"alternate"};(0,p.registerFormatType)("snow-monkey-editor/dropdown",{title:"buttons",tagName:"sme-dropdown",className:null,edit:()=>(0,b.jsx)(d.BlockFormatControls,{children:(0,b.jsx)("div",{className:"block-editor-format-toolbar",children:(0,b.jsxs)(g.ToolbarGroup,{children:[(0,b.jsx)(g.Slot,{name:"SnowMonkey.ToolbarControls",children:e=>0!==e.length&&(0,b.jsx)(g.ToolbarItem,{children:t=>(0,b.jsx)(g.DropdownMenu,{icon:v,label:(0,h.__)("Snow Monkey Editor Controls","snow-monkey-editor"),toggleProps:t,controls:(0,u.orderBy)(e.map((([{props:e}])=>e)),"title"),popoverProps:x})})}),["sme-font-size","sme-letter-spacing","sme-line-height","sme-text-color","sme-text-gradient","sme-bg-color","sme-highlighter","sme-badge"].map((e=>(0,b.jsx)(g.Slot,{name:`SnowMonkey.ToolbarControls.${e}`},e)))]})})})});const C=e=>{if(!e)return;const{name:t,settings:o}=e;(0,p.registerFormatType)(t,o)},y=window.wp.data,f=window.wp.element,k=window.wp.keycodes;function w({name:e,shortcutType:t,shortcutCharacter:o,...n}){let s,r="SnowMonkey.ToolbarControls";return e&&(r+=`.${e}`),t&&o&&(s=k.displayShortcut[t](o)),(0,b.jsx)(g.Fill,{name:r,children:(0,b.jsx)(g.ToolbarButton,{...n,shortcut:s})})}const j=(0,h.__)("Remove formatting","snow-monkey-editor"),_={name:"snow-monkey-editor/remove-fomatting",title:j,tagName:"span",className:"sme-remove-fomatting",edit:({value:e,onChange:t})=>{const o=(0,y.useSelect)((e=>e("core/rich-text").getFormatTypes()),[]),n=(0,f.useCallback)((()=>{if(0<o.length){let n=e;o.forEach((e=>{n=(0,p.removeFormat)(n,e.name)})),t({...n})}}),[e,o]);return(0,b.jsx)(w,{icon:"editor-removeformatting",title:j,onClick:n})}};var S=o(942),R=o.n(S);const N=({name:e,value:t,onChange:o,onReset:n})=>{const[s]=(0,d.useSettings)("typography.fontSizes"),r=(0,f.useMemo)((()=>function(e,t,o){const n=(0,p.getActiveFormat)(t,e);if(!n)return;const s=n.attributes.style;if(s)return s.replace(new RegExp("^font-size:\\s*"),"");const r=n.attributes.class;if(r){let e=r.replace(/.*has-([^\s]*)-font-size.*/,"$1"),t=(0,u.find)(o,{slug:e});if(!t&&(e=e.replace(/(\d)-([^\d])/,"$1$2",e),t=(0,u.find)(o,{slug:e}),!t))return;return t.size}}(e,t,s)),[e,t]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(d.FontSizePicker,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,value:r,onChange:o,fontSizes:s}),(0,b.jsx)(g.Button,{disabled:void 0===t,variant:"secondary",size:"small",onClick:n,children:(0,h.__)("Reset")})]})},F=(0,g.withSpokenMessages)((({name:e,value:t,onChange:o,onClose:n,onReset:s,contentRef:r,settings:a})=>{const i=(0,p.useAnchor)({editableContentElement:r.current,settings:a}),l=(0,d.useCachedTruthy)(i.getBoundingClientRect());return i.getBoundingClientRect=()=>l,(0,b.jsx)(g.Popover,{anchor:i,onClose:n,className:"sme-popover sme-popover--inline-font-size components-inline-color-popover",children:(0,b.jsx)("fieldset",{children:(0,b.jsx)(N,{name:e,value:t,onChange:o,onReset:s})})})})),A="snow-monkey-editor/font-size",M=(0,h.__)("Font size","snow-monkey-editor"),B={name:A,title:M,tagName:"span",className:"sme-font-size",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:o,isActive:n,activeAttributes:s,contentRef:r}=e,[a]=(0,d.useSettings)("typography.fontSizes"),[i,l]=(0,f.useState)(!1);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w,{name:n?"sme-font-size":void 0,title:M,className:R()("sme-toolbar-button",{"is-pressed":!!n}),onClick:()=>{l(!i)},icon:(0,b.jsx)(g.Icon,{icon:"editor-textcolor"})},n?"sme-font-size":"sme-font-size-not-active"),i&&(0,b.jsx)(F,{name:A,activeAttributes:s,value:t,onClose:()=>l(!1),onReset:()=>{l(!1),o((0,p.removeFormat)(t,A))},onChange:e=>{if(e){let n;if((0,u.isString)(e)||a[0]&&(0,u.isString)(a[0].size))n=e;else{if(!(0,u.isNumber)(e))return;n=`${e}px`}const s=(0,u.find)(a,{size:e});o((0,p.applyFormat)(t,{type:A,attributes:s?{class:(0,d.getFontSizeClass)(s.slug)}:{style:`font-size: ${n}`}}))}else o((0,p.removeFormat)(t,A))},contentRef:r,settings:B})]})}},O=({name:e,title:t,value:o,onChange:n,onReset:s})=>{const r=(0,f.useMemo)((()=>function(e,t){const o=(0,p.getActiveFormat)(t,e);if(!o)return;const n=o.attributes?.style;return n?parseFloat(n.replace(new RegExp("^letter-spacing:\\s*"),"").replace("rem","")):void 0}(e,o)),[e,o]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(g.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:t,value:r,onChange:n,min:"0",max:"2",step:"0.1",initialPosition:void 0}),(0,b.jsx)(g.Button,{disabled:void 0===o,variant:"secondary",isSmall:!0,onClick:s,children:(0,h.__)("Reset")})]})},T=(0,g.withSpokenMessages)((({name:e,title:t,value:o,onChange:n,onClose:s,onReset:r,contentRef:a,settings:i})=>{const l=(0,p.useAnchor)({editableContentElement:a.current,settings:i}),c=(0,d.useCachedTruthy)(l.getBoundingClientRect());return l.getBoundingClientRect=()=>c,(0,b.jsx)(g.Popover,{anchor:l,onClose:s,className:"sme-popover sme-popover--inline-letter-spacing components-inline-color-popover",children:(0,b.jsx)("fieldset",{children:(0,b.jsx)(O,{name:e,title:t,value:o,onChange:n,onReset:r})})})})),P="snow-monkey-editor/letter-spacing",E=(0,h.__)("Letter spacing","snow-monkey-editor"),z={name:P,title:E,tagName:"span",className:"sme-letter-spacing",attributes:{style:"style"},edit:e=>{const{value:t,onChange:o,isActive:n,activeAttributes:s,contentRef:r}=e,[a,i]=(0,f.useState)(!1);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w,{name:n?"sme-letter-spacing":void 0,title:E,className:R()("sme-toolbar-button",{"is-pressed":!!n}),onClick:()=>{i(!a)},icon:(0,b.jsx)(g.Icon,{icon:"controls-pause"})},n?"sme-letter-spacing":"sme-letter-spacing-not-active"),a&&(0,b.jsx)(T,{name:P,title:E,activeAttributes:s,value:t,onClose:()=>{i(!1)},onReset:()=>{i(!1),o((0,p.removeFormat)(t,P))},onChange:e=>{o((0,p.applyFormat)(t,{type:P,attributes:{style:`letter-spacing: ${e}rem`}}))},contentRef:r,settings:z})]})}},I=({name:e,title:t,value:o,onChange:n,onReset:s})=>{const r=(0,f.useMemo)((()=>function(e,t){const o=(0,p.getActiveFormat)(t,e);if(!o)return;const n=o.attributes.style;return n?parseFloat(n.replace(new RegExp("^line-height:\\s*"),"")):void 0}(e,o)),[e,o]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(g.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:t,value:r,onChange:n,min:"0",max:"5",step:"0.1",initialPosition:void 0}),(0,b.jsx)(g.Button,{disabled:void 0===o,variant:"secondary",isSmall:!0,onClick:s,children:(0,h.__)("Reset")})]})},$=(0,g.withSpokenMessages)((({name:e,title:t,value:o,onChange:n,onClose:s,onReset:r,contentRef:a,settings:i})=>{const l=(0,p.useAnchor)({editableContentElement:a.current,settings:i}),c=(0,d.useCachedTruthy)(l.getBoundingClientRect());return l.getBoundingClientRect=()=>c,(0,b.jsx)(g.Popover,{anchor:l,onClose:s,className:"sme-popover sme-popover--inline-line-height components-inline-color-popover",children:(0,b.jsx)("fieldset",{children:(0,b.jsx)(I,{name:e,title:t,value:o,onChange:n,onReset:r})})})})),H="snow-monkey-editor/line-height",L=(0,h.__)("Line height","snow-monkey-editor"),V={name:H,title:L,tagName:"span",className:"sme-line-height",attributes:{style:"style"},edit:e=>{const{value:t,onChange:o,isActive:n,activeAttributes:s,contentRef:r}=e,[a,i]=(0,f.useState)(!1);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w,{name:n?"sme-line-height":void 0,title:L,className:R()("sme-toolbar-button",{"is-pressed":!!n}),onClick:()=>{i(!a)},icon:(0,b.jsx)(g.Icon,{icon:"editor-insertmore"})},n?"sme-line-height":"sme-line-height-not-active"),a&&(0,b.jsx)($,{name:H,title:L,activeAttributes:s,value:t,onClose:()=>{i(!1)},onReset:()=>{i(!1),o((0,p.removeFormat)(t,H))},onChange:e=>{o((0,p.applyFormat)(t,{type:H,attributes:{style:`line-height: ${e}`}}))},contentRef:r,settings:V})]})}};function G(e,t,o){const n=(0,p.getActiveFormat)(t,e);if(!n)return;const s=n.attributes.style;if(s)return s.replace(new RegExp("^color:\\s*"),"");const r=n.attributes.class;if(r){const e=r.replace(/.*has-([^\s]*)-color.*/,"$1");return(0,d.getColorObjectByAttributeValues)(o,e).color}}const Z=({name:e,value:t,onChange:o})=>{const[n,s,r]=(0,d.useSettings)("color.palette.custom","color.palette.theme","color.palette.default"),a=(0,f.useMemo)((()=>[...n||[],...s||[],...r||[]]),[n,s,r]),i=(0,f.useMemo)((()=>G(e,t,a)),[e,t,a]);return(0,b.jsx)(d.__experimentalColorGradientControl,{label:(0,h.__)("Color","snow-monkey-editor"),colorValue:i,onColorChange:o,...(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},D=(0,g.withSpokenMessages)((({name:e,value:t,onChange:o,onClose:n,contentRef:s,settings:r})=>{const a=(0,p.useAnchor)({editableContentElement:s.current,settings:r}),i=(0,d.useCachedTruthy)(a.getBoundingClientRect());return a.getBoundingClientRect=()=>i,(0,b.jsx)(g.Popover,{anchor:a,value:t,onClose:n,className:"sme-popover sme-popover--inline-color components-inline-color-popover",children:(0,b.jsx)(Z,{name:e,value:t,onChange:o})})})),U="snow-monkey-editor/text-color",q=(0,h.__)("Text color","snow-monkey-editor"),J={name:U,title:q,tagName:"span",className:"sme-text-color",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:o,isActive:n,activeAttributes:s,contentRef:r}=e,[a,i,l]=(0,d.useSettings)("color.palette.custom","color.palette.theme","color.palette.default"),c=(0,f.useMemo)((()=>[...a||[],...i||[],...l||[]]),[a,i,l]),[m,u]=(0,f.useState)(!1),h=(0,f.useMemo)((()=>G(U,t,c)),[t,c]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w,{name:n?"sme-text-color":void 0,title:q,style:{color:h},className:R()("sme-toolbar-button",{"is-pressed":!!n}),onClick:()=>{u(!m)},icon:(0,b.jsx)(g.Icon,{icon:"edit"})},n?"sme-text-color":"sme-text-color-not-active"),m&&(0,b.jsx)(D,{name:U,activeAttributes:s,value:t,onClose:()=>u(!1),onChange:e=>{if(e){const n=(0,d.getColorObjectByColorValue)(c,e);o((0,p.applyFormat)(t,{type:U,attributes:n?{class:(0,d.getColorClassName)("color",n.slug)}:{style:`color: ${e}`}}))}else o((0,p.removeFormat)(t,U)),u(!1)},contentRef:r,settings:J})]})}};function X(e,t,o){const n=(0,p.getActiveFormat)(t,e);if(!n)return;const s=n.attributes?.style;if(s)return s.replace(new RegExp("^background-image:\\s*"),"");const r=n.attributes?.class;if(r){let e=r.replace(/.*has-([^\s]*)-gradient-background.*/,"$1"),t=(0,u.find)(o,{slug:e});if(!t&&(e=e.replace(/(\d)-([^\d])/,"$1$2",e),t=(0,u.find)(o,{slug:e}),!t))return;return t.gradient}}const K=({name:e,value:t,onChange:o})=>{const[n,s,r]=(0,d.useSettings)("color.gradients.custom","color.gradients.theme","color.gradients.default"),a=(0,f.useMemo)((()=>[...n||[],...s||[],...r||[]]),[n,s,r]),i=(0,f.useMemo)((()=>X(e,t,a)),[e,t,a]);return(0,b.jsx)(d.__experimentalColorGradientControl,{label:(0,h.__)("Color","snow-monkey-editor"),gradientValue:i,onGradientChange:o,...(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},Q=(0,g.withSpokenMessages)((({name:e,value:t,onChange:o,onClose:n,contentRef:s,settings:r})=>{const a=(0,p.useAnchor)({editableContentElement:s.current,settings:r}),i=(0,d.useCachedTruthy)(a.getBoundingClientRect());return a.getBoundingClientRect=()=>i,(0,b.jsx)(g.Popover,{anchor:a,onClose:n,className:"sme-popover sme-popover--inline-gradient components-inline-gradient-popover",children:(0,b.jsx)(K,{name:e,value:t,onChange:o})})})),W="snow-monkey-editor/text-gradient",Y=(0,h.__)("Text gradient","snow-monkey-editor"),ee={name:W,title:Y,tagName:"span",className:"sme-text-gradient",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:o,isActive:n,activeAttributes:s,contentRef:r}=e,[a,i,l]=(0,d.useSettings)("color.gradients.custom","color.gradients.theme","color.gradients.default"),c=(0,f.useMemo)((()=>[...a||[],...i||[],...l||[]]),[a,i,l]),[m,u]=(0,f.useState)(!1),h=(0,f.useMemo)((()=>X(W,t,c)),[t,c]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w,{name:n?"sme-text-gradient":void 0,title:Y,style:{"--sme--gradient":h},className:R()("sme-toolbar-button","sme-toolbar-button--text-gradient",{"is-pressed":!!n}),onClick:()=>{u(!m)},icon:(0,b.jsx)(g.Icon,{icon:"edit"})},n?"sme-text-gradient":"sme-text-gradient-not-active"),m&&(0,b.jsx)(Q,{name:W,activeAttributes:s,value:t,onClose:()=>u(!1),onChange:e=>{if(e){const n=(0,d.getGradientSlugByValue)(c,e);o((0,p.applyFormat)(t,{type:W,attributes:n?{class:(0,d.__experimentalGetGradientClass)(n)}:{style:`background-image: ${e}`}}))}else o((0,p.removeFormat)(t,W)),u(!1)},contentRef:r,settings:ee})]})}};function te(e,t,o){const n=(0,p.getActiveFormat)(t,e);if(!n)return;const s=n.attributes.style;if(s)return s.replace(new RegExp("^background-color:\\s*"),"");const r=n.attributes.class;if(r){const e=r.replace(/.*has-([^\s]*)-background-color.*/,"$1");return(0,d.getColorObjectByAttributeValues)(o,e).color}}const oe=({name:e,value:t,onChange:o})=>{const[n,s,r]=(0,d.useSettings)("color.palette.custom","color.palette.theme","color.palette.default"),a=(0,f.useMemo)((()=>[...n||[],...s||[],...r||[]]),[n,s,r]),i=(0,f.useMemo)((()=>te(e,t,a)),[e,t,a]);return(0,b.jsx)(d.__experimentalColorGradientControl,{label:(0,h.__)("Color","snow-monkey-editor"),colorValue:i,onColorChange:o,...(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},ne=(0,g.withSpokenMessages)((({name:e,value:t,onChange:o,onClose:n,contentRef:s,settings:r})=>{const a=(0,p.useAnchor)({editableContentElement:s.current,settings:r}),i=(0,d.useCachedTruthy)(a.getBoundingClientRect());return a.getBoundingClientRect=()=>i,(0,b.jsx)(g.Popover,{anchor:a,onClose:n,className:"sme-popover sme-popover--inline-background-color components-inline-color-popover",children:(0,b.jsx)(oe,{name:e,value:t,onChange:o})})})),se="snow-monkey-editor/bg-color",re=(0,h.__)("Background color","snow-monkey-editor"),ae={name:se,title:re,tagName:"span",className:"sme-bg-color",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:o,isActive:n,activeAttributes:s,contentRef:r}=e,[a,i,l]=(0,d.useSettings)("color.palette.custom","color.palette.theme","color.palette.default"),c=(0,f.useMemo)((()=>[...a||[],...i||[],...l||[]]),[a,i,l]),[m,u]=(0,f.useState)(!1),h=(0,f.useMemo)((()=>te(se,t,c)),[t,c]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w,{name:n?"sme-bg-color":void 0,title:re,style:{color:h},className:R()("sme-toolbar-button",{"is-pressed":!!n}),onClick:()=>{u(!m)},icon:(0,b.jsx)(g.Icon,{icon:"tag"})},n?"sme-bg-color":"sme-bg-color-not-active"),m&&(0,b.jsx)(ne,{name:se,activeAttributes:s,value:t,onClose:()=>u(!1),onChange:e=>{if(e){const n=(0,d.getColorObjectByColorValue)(c,e);o((0,p.applyFormat)(t,{type:se,attributes:n?{class:(0,d.getColorClassName)("background-color",n.slug)}:{style:`background-color: ${e}`}}))}else o((0,p.removeFormat)(t,se)),u(!1)},contentRef:r,settings:ae})]})}};var ie=o(558),le=o.n(ie),ce=o(919),me=o.n(ce);function ue(e,t){const o=(0,p.getActiveFormat)(t,e);if(!o)return;const n=o.attributes.style;if(!n)return;const s=n.match(/(#[0-9A-F]{3,6}) /i);if(s)return s;const r=n.match(/,\s*?(rgba?\([^)]+\)) /i);return r?function(e){if(!e||4===e.length)return e;const t=e.match(/^#([0-9A-F])\1([0-9A-F])\1([0-9A-F])\1$/i);return t?`#${t[1].slice(0,1)}${t[2].slice(0,1)}${t[3].slice(0,1)}`:e}(me()(r[1]).hex):void 0}const de=({name:e,value:t,onChange:o})=>{const[n,s,r]=(0,d.useSettings)("color.palette.custom","color.palette.theme","color.palette.default"),a=(0,f.useMemo)((()=>[...n||[],...s||[],...r||[]]),[n,s,r]),i=(0,f.useMemo)((()=>ue(e,t)),[e,t,a]);return(0,b.jsx)(d.__experimentalColorGradientControl,{label:(0,h.__)("Color","snow-monkey-editor"),colorValue:i,onColorChange:o,...(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},ge=(0,g.withSpokenMessages)((({name:e,value:t,onChange:o,onClose:n,contentRef:s,settings:r})=>{const a=(0,p.useAnchor)({editableContentElement:s.current,settings:r}),i=(0,d.useCachedTruthy)(a.getBoundingClientRect());return a.getBoundingClientRect=()=>i,(0,b.jsx)(g.Popover,{anchor:a,onClose:n,className:"sme-popover sme-popover--inline-color components-inline-color-popover",children:(0,b.jsx)(de,{name:e,value:t,onChange:o})})})),pe="snow-monkey-editor/highlighter",he=(0,h.__)("Highlighter","snow-monkey-editor"),be={name:pe,title:he,tagName:"span",className:"sme-highlighter",attributes:{style:"style"},edit:e=>{const{value:t,onChange:o,isActive:n,activeAttributes:s,contentRef:r}=e,[a,i,l]=(0,d.useSettings)("color.palette.custom","color.palette.theme","color.palette.default"),c=(0,f.useMemo)((()=>[...a||[],...i||[],...l||[]]),[a,i,l]),[m,u]=(0,f.useState)(!1),h=(0,f.useMemo)((()=>ue(pe,t)),[t,c]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w,{name:n?"sme-highlighter":void 0,title:he,style:{color:h},className:R()("sme-toolbar-button",{"is-pressed":!!n}),onClick:()=>{u(!m)},icon:(0,b.jsx)(g.Icon,{icon:"tag"})},n?"sme-highlighter":"sme-highlighter-not-active"),m&&(0,b.jsx)(ge,{name:pe,activeAttributes:s,value:t,onClose:()=>u(!1),onChange:e=>{e?(e.match(/^#/)&&(e=le()(e,.5)),o((0,p.applyFormat)(t,{type:pe,attributes:{style:`background-image: linear-gradient(transparent 60%, ${e} 60%)`}}))):(o((0,p.removeFormat)(t,pe)),u(!1))},contentRef:r,settings:be})]})}},ve="snow-monkey-editor/badge",xe=(0,h.__)("Badge","snow-monkey-editor"),Ce={name:ve,title:xe,tagName:"span",className:"sme-badge",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:o,isActive:n,activeAttributes:s,contentRef:r}=e,[a,i,l]=(0,d.useSettings)("color.palette.custom","color.palette.theme","color.palette.default"),c=(0,f.useMemo)((()=>[...a||[],...i||[],...l||[]]),[a,i,l]),[m,u]=(0,f.useState)(!1),h=(0,f.useMemo)((()=>te(ve,t,c)),[t,c]);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w,{name:n?"sme-badge":void 0,title:xe,style:{color:h},className:R()("sme-toolbar-button",{"is-pressed":!!n}),onClick:()=>{u(!m)},icon:(0,b.jsx)(g.Icon,{icon:"tag"})},n?"sme-badge":"sme-badge-not-active"),m&&(0,b.jsx)(ne,{name:ve,activeAttributes:s,value:t,onClose:()=>u(!1),onChange:e=>{if(e){const n=(0,d.getColorObjectByColorValue)(c,e);o((0,p.applyFormat)(t,{type:ve,attributes:n?{class:(0,d.getColorClassName)("background-color",n.slug)}:{style:`background-color: ${e}`}}))}else o((0,p.removeFormat)(t,ve)),u(!1)},contentRef:r,settings:Ce})]})}},ye="snow-monkey-editor/br",fe=(0,h.__)("Line break per screen size","snow-monkey-editor"),ke={type:ye,innerHTML:"<br />"};function we({value:e,onChange:t,activeObjectAttributes:o,contentRef:n}){const s=e.replacements.slice()?.[e.start]?.attributes?.class,[r,a]=(0,f.useState)(!!s?.match(/sme-br--disable:desktop/)),[i,l]=(0,f.useState)(!!s?.match(/sme-br--disable:tablet/)),[c,m]=(0,f.useState)(!!s?.match(/sme-br--disable:mobile/)),u=(0,p.useAnchor)({editableContentElement:n.current,settings:je}),d=(0,f.useCallback)((n=>{a(!n);const s=e.replacements.slice();s[e.start]={...ke,attributes:{...o,class:R()({"sme-br--disable:desktop":!n,"sme-br--disable:tablet":i,"sme-br--disable:mobile":c})}},t({...e,replacements:s})}),[i,c]),v=(0,f.useCallback)((n=>{l(!n);const s=e.replacements.slice();s[e.start]={...ke,attributes:{...o,class:R()({"sme-br--disable:desktop":r,"sme-br--disable:tablet":!n,"sme-br--disable:mobile":c})}},t({...e,replacements:s})}),[r,c]),x=(0,f.useCallback)((n=>{m(!n);const s=e.replacements.slice();s[e.start]={...ke,attributes:{...o,class:R()({"sme-br--disable:desktop":r,"sme-br--disable:tablet":i,"sme-br--disable:mobile":!n})}},t({...e,replacements:s})}),[r,i]);return(0,b.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:!1,anchor:u,className:"sme-popover sme-popover--inline-br",children:(0,b.jsxs)("div",{style:{width:"260px"},children:[(0,b.jsx)(g.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,h.__)("Line breaks when on the desktop","snow-monkey-editor"),checked:!r,onChange:d,disabled:i&&c}),(0,b.jsx)(g.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,h.__)("Line breaks when on the tablet","snow-monkey-editor"),checked:!i,onChange:v,disabled:r&&c}),(0,b.jsx)(g.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,h.__)("Line breaks when on the mobile","snow-monkey-editor"),checked:!c,onChange:x,disabled:r&&i})]})})}const je={name:ye,title:fe,tagName:"span",className:"sme-br",attributes:{class:"class"},interactive:!0,contentEditable:!1,edit:function({value:e,onChange:t,onFocus:o,isObjectActive:n,activeObjectAttributes:s,contentRef:r}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(w,{icon:(0,b.jsx)("span",{className:"dashicon",children:(0,b.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,b.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0224 5.25C18.4366 5.25 18.7724 5.58579 18.7724 6V15C18.7724 15.4142 18.4366 15.75 18.0224 15.75L18.0112 15.7499L18 15.75H10.0784V19L4.5 14.8349L10.0784 10.6699V14.25H17.2724V6C17.2724 5.58579 17.6082 5.25 18.0224 5.25Z",fill:"currentColor"})})}),title:fe,onClick:()=>{const n=(0,p.insertObject)(e,{...ke},e.end,e.end);n.start=n.end-1,t(n),o()},isActive:n}),n&&(0,b.jsx)(we,{value:e,onChange:t,activeObjectAttributes:s,contentRef:r})]})}};C(e),C(t),C(n),C(s),C(r),C(a),C(i),C(l),C(c),C(m);const _e=window.wp.compose,Se=window.wp.hooks;(0,Se.addFilter)("editor.BlockListBlock","snow-monkey-editor/ordered-list/orderd-styles",(0,_e.createHigherOrderComponent)((e=>t=>{const{attributes:o,name:n}=t?.block,{start:s,reversed:r,ordered:a,className:i}=o;return"core/list"!==n?(0,b.jsx)(e,{...t}):(i?.match("is-style-sme-ordered-list-square")||i?.match("is-style-sme-ordered-list-circle"))&&a?(0,b.jsx)(e,{...t,wrapperProps:{...t.wrapperProps,style:{...t.wrapperProps?.style,counterReset:r?`sme-count ${s+1}`:"sme-count "+(s-1)}}}):(0,b.jsx)(e,{...t})}),"withSnowMonkeyEditorOrderdListOrderdStyles"));const Re=window.wp.blocks,Ne=window.wp.preferences;const Fe="snow-monkey-editor/preferences",Ae=["allowedBlocks","content","templateLock","placeholder"],Me=e=>!(({name:e}={})=>!(0,Re.hasBlockSupport)(e,"snowmonkeyeditor.blockPresets"))(e)&&(!!function(e,t){if(!e||!Object.keys(e).length)return!1;const o=function(e){return(0,Se.applyFilters)("SnowMonkeyEditor.extension.allowedRoles",["administrator","editor","author","contributor"],e)}(t);return 0<e.roles.filter((e=>-1<o.indexOf(e))).length}(snowmonkeyeditor?.currentUser,"block-presets")&&!!(0,Re.getBlockType)(e.name)),Be=(0,_e.createHigherOrderComponent)((e=>((0,y.dispatch)(Ne.store).setDefaults(Fe,{blockPresets:{}}),t=>{if(!Me(t))return(0,b.jsx)(e,{...t});const{name:o,attributes:n,setAttributes:s}=t,[r,a]=(0,f.useState)(void 0),[i,l]=(0,f.useState)(0),c=(0,y.useSelect)((e=>e(Ne.store).get(Fe,"blockPresets")),[]),m=c?.[o],u=(0,Re.getBlockSupport)(o,"snowmonkeyeditor.blockPresets"),p=u?.ignore||[],v=({blockName:e,presetName:t,preset:o})=>(0,b.jsxs)("div",{className:"sme-editor-block-presets__preset",children:[(0,b.jsx)(g.Button,{onClick:()=>{const t=(0,Re.getBlockType)(e),n={};Object.keys(t.attributes).forEach((e=>{n[e]=void 0})),Ae.forEach((e=>{delete n[e],delete o[e]})),p.forEach((e=>{delete n[e],delete o[e]})),s({...n,...o})},variant:"secondary",children:t}),(0,b.jsx)(g.Button,{label:(0,h.__)("Remove this preset","snow-monkey-editor"),onClick:()=>{const o={...c};delete o?.[e]?.[t],(0,y.dispatch)(Ne.store).set(Fe,"blockPresets",o),l(i+1)},variant:"tertiary",children:"x"})]});return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(e,{...t}),(0,b.jsx)(d.InspectorControls,{children:(0,b.jsxs)(g.PanelBody,{title:(0,h.__)("Presets","snow-monkey-editor"),children:[!!m&&!!Object.values(m)&&(0,b.jsx)("div",{className:"sme-editor-block-presets",children:Object.values(m).map(((e,t)=>{const n=Object.keys(m)[t];return(0,b.jsx)(v,{blockName:o,presetName:n,preset:e},t)}))}),(0,b.jsxs)("div",{className:"sme-editor-block-presets-inserter",children:[(0,b.jsx)("h3",{className:"sme-editor-block-presets-inserter__title",children:(0,h.__)("Save current settings as a preset","snow-monkey-editor")}),(0,b.jsxs)("div",{className:"sme-editor-block-presets-inserter__control",children:[(0,b.jsx)(g.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,value:r||"",placeholder:(0,h.__)("Input the preset name.","snow-monkey-editor"),onChange:e=>a(e)}),(0,b.jsx)(g.Button,{variant:"primary",disabled:!r,onClick:async()=>{const e={...n};Ae.forEach((t=>{delete e[t]})),p.forEach((t=>{delete e[t]}));const t={...c,[o]:{...m,[r]:{...e}}};(0,y.dispatch)(Ne.store).set(Fe,"blockPresets",t),a(void 0)},children:(0,h.__)("Save","snow-monkey-editor")})]})]})]})})]})})),"withInspectorControl");(0,Se.addFilter)("editor.BlockEdit","snow-monkey-editor/block-presets/with-inspector-controls",Be,100),(0,Se.addFilter)("blocks.registerBlockType","snow-monkey-editor/block-presets/support",((e,t)=>{let o=!1;return"core/button"===t?o={ignore:["url","title","text","linkTarget","rel"]}:"core/cover"===t?o={ignore:["url"]}:"core/list"===t?o={ignore:["values"]}:"core/paragraph"!==t&&"core/group"!==t&&"core/columns"!==t&&"core/column"!==t&&"core/heading"!==t||(o=!0),!1===o?e:{...e,supports:{...e.supports,snowmonkeyeditor:{blockPresets:o}}}}))})()})();1 (()=>{var e={558:e=>{"use strict";var t=function(e){return parseInt(e,16)};e.exports=function(e,n){var o,s,r=function(e){return"#"===e.charAt(0)?e.slice(1):e}(e),a=function(e){var n=e.g,o=e.b,s=e.a;return{r:t(e.r),g:t(n),b:t(o),a:+(t(s)/255).toFixed(2)}}({r:(s=3===(o=r).length||4===o.length)?"".concat(o.slice(0,1)).concat(o.slice(0,1)):o.slice(0,2),g:s?"".concat(o.slice(1,2)).concat(o.slice(1,2)):o.slice(2,4),b:s?"".concat(o.slice(2,3)).concat(o.slice(2,3)):o.slice(4,6),a:(s?"".concat(o.slice(3,4)).concat(o.slice(3,4)):o.slice(6,8))||"ff"});return function(e,t){var n,o=e.r,s=e.g,r=e.b,a=e.a,i=(n=t,!isNaN(parseFloat(n))&&isFinite(n)?t:a);return"rgba(".concat(o,", ").concat(s,", ").concat(r,", ").concat(i,")")}(a,n)}},919:e=>{e.exports=function(e){if("string"!=typeof e)throw new Error("color has to be type of `string`");if("#"===e.substr(0,1))return{hex:e,alpha:1};var t=e.replace(/\s+/g,""),n=/(.*?)rgb(a)??\((\d{1,3}),(\d{1,3}),(\d{1,3})(,([01]|1.0*|0??\.([0-9]{0,})))??\)/.exec(t);if(!n)throw new Error("given color ("+e+") isn't a valid rgb or rgba color");var o=parseInt(n[3],10),s=parseInt(n[4],10),r=parseInt(n[5],10),a=n[6]?/([0-9\.]+)/.exec(n[6])[0]:"1",i=(r|s<<8|o<<16|1<<24).toString(16).slice(1);return"."===a.substr(0,1)&&(a=parseFloat("0"+a)),a=parseFloat(Math.round(100*a))/100,{hex:"#"+i.toString(16),alpha:a}}},942:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function s(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return s.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)o.call(e,n)&&e[n]&&(t=a(t,n));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(s.default=s,e.exports=s):void 0===(n=function(){return s}.apply(t,[]))||(e.exports=n)}()}},t={};function n(o){var s=t[o];if(void 0!==s)return s.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};n.r(e),n.d(e,{settings:()=>_});var t={};n.r(t),n.d(t,{settings:()=>O});var o={};n.r(o),n.d(o,{settings:()=>I});var s={};n.r(s),n.d(s,{settings:()=>V});var r={};n.r(r),n.d(r,{settings:()=>J});var a={};n.r(a),n.d(a,{settings:()=>ee});var i={};n.r(i),n.d(i,{settings:()=>ae});var l={};n.r(l),n.d(l,{settings:()=>he});var c={};n.r(c),n.d(c,{settings:()=>fe});var m={};n.r(m),n.d(m,{settings:()=>we});const u=window.lodash,d=window.wp.blockEditor,g=window.wp.components,p=window.wp.richText,b=window.wp.i18n,h=window.ReactJSXRuntime,v=(0,h.jsx)("svg",{role:"img",focusable:"false",width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,h.jsx)("path",{d:"M13.982,16.711c-0.744,1.441 -2.248,2.428 -3.982,2.428c-1.735,0 -3.238,-0.986 -3.983,-2.428c0.909,-1.213 2.355,-2.002 3.983,-2.002c1.629,0 3.074,0.789 3.982,2.002Zm-0.748,-7.657c-0.314,2.56 1.248,2.919 1.248,5.603c0,0.467 -0.072,0.918 -0.205,1.344c-1.037,-1.203 -2.57,-1.967 -4.277,-1.967c-1.708,0 -3.24,0.764 -4.277,1.967c-0.133,-0.426 -0.205,-0.877 -0.205,-1.344c0,-2.684 1.563,-3.043 1.247,-5.603c-0.362,-2.928 -4.315,-2.465 -4.315,-5.334c0,-1.579 1.279,-2.858 2.858,-2.858c1.709,0 2.765,1.558 4.692,1.558c1.926,0 2.982,-1.558 4.691,-1.558c1.578,0 2.857,1.279 2.857,2.858c0.001,2.869 -3.952,2.406 -4.314,5.334Zm-4.677,-4.947l-0.708,0c0,0.498 -0.403,0.9 -0.901,0.9c-0.498,0 -0.901,-0.402 -0.901,-0.9l-0.708,0c0,0.889 0.72,1.609 1.609,1.609c0.889,0 1.609,-0.72 1.609,-1.609Zm0.979,7.141c0,-0.312 -0.253,-0.568 -0.566,-0.568c-0.313,0 -0.567,0.256 -0.567,0.568c0,0.312 0.254,0.566 0.567,0.566c0.313,0 0.566,-0.253 0.566,-0.566Zm2.062,0c0,-0.312 -0.254,-0.568 -0.568,-0.568c-0.312,0 -0.566,0.256 -0.566,0.568c0,0.312 0.254,0.566 0.566,0.566c0.314,0 0.568,-0.253 0.568,-0.566Zm3.062,-7.141l-0.707,0c0,0.498 -0.404,0.9 -0.9,0.9c-0.498,0 -0.902,-0.402 -0.902,-0.9l-0.707,0c0,0.889 0.721,1.609 1.609,1.609c0.886,0.001 1.607,-0.72 1.607,-1.609Z"})}),x={position:"bottom left",variant:"alternate"};(0,p.registerFormatType)("snow-monkey-editor/dropdown",{title:"buttons",tagName:"sme-dropdown",className:null,edit:()=>(0,h.jsx)(d.BlockFormatControls,{children:(0,h.jsx)("div",{className:"block-editor-format-toolbar",children:(0,h.jsxs)(g.ToolbarGroup,{children:[(0,h.jsx)(g.Slot,{name:"SnowMonkey.ToolbarControls",children:e=>0!==e.length&&(0,h.jsx)(g.ToolbarItem,{children:t=>(0,h.jsx)(g.DropdownMenu,{icon:v,label:(0,b.__)("Snow Monkey Editor Controls","snow-monkey-editor"),toggleProps:t,controls:(0,u.orderBy)(e.map((([{props:e}])=>e)),"title"),popoverProps:x})})}),["sme-font-size","sme-letter-spacing","sme-line-height","sme-text-color","sme-text-gradient","sme-bg-color","sme-highlighter","sme-badge"].map((e=>(0,h.jsx)(g.Slot,{name:`SnowMonkey.ToolbarControls.${e}`},e)))]})})})});const f=e=>{if(!e)return;const{name:t,settings:n}=e;(0,p.registerFormatType)(t,n)},y=window.wp.data,C=window.wp.element,k=window.wp.keycodes;function j({name:e,shortcutType:t,shortcutCharacter:n,...o}){let s,r="SnowMonkey.ToolbarControls";return e&&(r+=`.${e}`),t&&n&&(s=k.displayShortcut[t](n)),(0,h.jsx)(g.Fill,{name:r,children:(0,h.jsx)(g.ToolbarButton,{...o,shortcut:s})})}const w=(0,b.__)("Remove formatting","snow-monkey-editor"),_={name:"snow-monkey-editor/remove-fomatting",title:w,tagName:"span",className:"sme-remove-fomatting",edit:({value:e,onChange:t})=>{const n=(0,y.useSelect)((e=>e("core/rich-text").getFormatTypes()),[]),o=(0,C.useCallback)((()=>{if(0<n.length){let o=e;n.forEach((e=>{o=(0,p.removeFormat)(o,e.name)})),t({...o})}}),[e,n]);return(0,h.jsx)(j,{icon:"editor-removeformatting",title:w,onClick:o})}};var S=n(942),N=n.n(S);const F=({name:e,value:t,onChange:n,onReset:o})=>{const[s]=(0,d.useSettings)("typography.fontSizes"),r=(0,C.useMemo)((()=>function(e,t,n){const o=(0,p.getActiveFormat)(t,e);if(!o)return;const s=o.attributes.style;if(s)return s.replace(new RegExp("^font-size:\\s*"),"");const r=o.attributes.class;if(r){let e=r.replace(/.*has-([^\s]*)-font-size.*/,"$1"),t=(0,u.find)(n,{slug:e});if(!t&&(e=e.replace(/(\d)-([^\d])/,"$1$2",e),t=(0,u.find)(n,{slug:e}),!t))return;return t.size}}(e,t,s)),[e,t]);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(d.FontSizePicker,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,value:r,onChange:n,fontSizes:s}),(0,h.jsx)(g.Button,{disabled:void 0===t,variant:"secondary",size:"small",onClick:o,children:(0,b.__)("Reset")})]})},R=({name:e,value:t,onChange:n,onReset:o,contentRef:s,settings:r})=>{const a=(0,p.useAnchor)({editableContentElement:s.current,settings:r});return(0,h.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:!1,anchor:a,className:"sme-popover sme-popover--inline-font-size components-inline-color-popover",children:(0,h.jsx)("fieldset",{children:(0,h.jsx)(F,{name:e,value:t,onChange:n,onReset:o})})})},A="snow-monkey-editor/font-size",M=(0,b.__)("Font size","snow-monkey-editor"),O={name:A,title:M,tagName:"span",className:"sme-font-size",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:n,isActive:o,contentRef:s}=e,[r]=(0,d.useSettings)("typography.fontSizes"),[a,i]=(0,C.useState)(!1),l=(0,C.useCallback)((()=>{i(!0)}),[i]),c=(0,C.useCallback)((()=>{i(!1)}),[i]);return(0,C.useEffect)((()=>{c()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:o?"sme-font-size":void 0,title:M,className:N()("sme-toolbar-button",{"is-pressed":!!o}),onClick:l,icon:(0,h.jsx)(g.Icon,{icon:"editor-textcolor"})},o?"sme-font-size":"sme-font-size-not-active"),a&&(0,h.jsx)(R,{name:A,value:t,onReset:()=>{n((0,p.removeFormat)(t,A)),c()},onChange:e=>{if(e){let o;if((0,u.isString)(e)||r[0]&&(0,u.isString)(r[0].size))o=e;else{if(!(0,u.isNumber)(e))return;o=`${e}px`}const s=(0,u.find)(r,{size:e});n((0,p.applyFormat)(t,{type:A,attributes:s?{class:(0,d.getFontSizeClass)(s.slug)}:{style:`font-size: ${o}`}}))}else n((0,p.removeFormat)(t,A)),c()},contentRef:s,settings:{...O,isActive:o}})]})}},B=({name:e,title:t,value:n,onChange:o,onReset:s})=>{const r=(0,C.useMemo)((()=>function(e,t){const n=(0,p.getActiveFormat)(t,e);if(!n)return;const o=n.attributes?.style;return o?parseFloat(o.replace(new RegExp("^letter-spacing:\\s*"),"").replace("rem","")):void 0}(e,n)),[e,n]);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(g.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:t,value:r,onChange:o,min:"0",max:"2",step:"0.1",initialPosition:void 0}),(0,h.jsx)(g.Button,{disabled:void 0===n,variant:"secondary",onClick:s,children:(0,b.__)("Reset")})]})},E=({name:e,title:t,value:n,onChange:o,onReset:s,contentRef:r,settings:a})=>{const i=(0,p.useAnchor)({editableContentElement:r.current,settings:a});return(0,h.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:!1,anchor:i,className:"sme-popover sme-popover--inline-letter-spacing components-inline-color-popover",children:(0,h.jsx)("fieldset",{children:(0,h.jsx)(B,{name:e,title:t,value:n,onChange:o,onReset:s})})})},P="snow-monkey-editor/letter-spacing",z=(0,b.__)("Letter spacing","snow-monkey-editor"),I={name:P,title:z,tagName:"span",className:"sme-letter-spacing",attributes:{style:"style"},edit:e=>{const{value:t,onChange:n,isActive:o,contentRef:s}=e,[r,a]=(0,C.useState)(!1),i=(0,C.useCallback)((()=>{a(!0)}),[a]),l=(0,C.useCallback)((()=>{a(!1)}),[a]);return(0,C.useEffect)((()=>{l()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:o?"sme-letter-spacing":void 0,title:z,className:N()("sme-toolbar-button",{"is-pressed":!!o}),onClick:i,icon:(0,h.jsx)(g.Icon,{icon:"controls-pause"})},o?"sme-letter-spacing":"sme-letter-spacing-not-active"),r&&(0,h.jsx)(E,{name:P,title:z,value:t,onReset:()=>{n((0,p.removeFormat)(t,P)),l()},onChange:e=>{n((0,p.applyFormat)(t,{type:P,attributes:{style:`letter-spacing: ${e}rem`}}))},contentRef:s,settings:{...I,isActive:o}})]})}},T=({name:e,title:t,value:n,onChange:o,onReset:s})=>{const r=(0,C.useMemo)((()=>function(e,t){const n=(0,p.getActiveFormat)(t,e);if(!n)return;const o=n.attributes.style;return o?parseFloat(o.replace(new RegExp("^line-height:\\s*"),"")):void 0}(e,n)),[e,n]);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(g.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:t,value:r,onChange:o,min:"0",max:"5",step:"0.1",initialPosition:void 0}),(0,h.jsx)(g.Button,{disabled:void 0===n,variant:"secondary",onClick:s,children:(0,b.__)("Reset")})]})},$=({name:e,title:t,value:n,onChange:o,onReset:s,contentRef:r,settings:a})=>{const i=(0,p.useAnchor)({editableContentElement:r.current,settings:a});return(0,h.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:!1,anchor:i,className:"sme-popover sme-popover--inline-line-height components-inline-color-popover",children:(0,h.jsx)("fieldset",{children:(0,h.jsx)(T,{name:e,title:t,value:n,onChange:o,onReset:s})})})},H="snow-monkey-editor/line-height",L=(0,b.__)("Line height","snow-monkey-editor"),V={name:H,title:L,tagName:"span",className:"sme-line-height",attributes:{style:"style"},edit:e=>{const{value:t,onChange:n,isActive:o,contentRef:s}=e,[r,a]=(0,C.useState)(!1),i=(0,C.useCallback)((()=>{a(!0)}),[a]),l=(0,C.useCallback)((()=>{a(!1)}),[a]);return(0,C.useEffect)((()=>{l()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:o?"sme-line-height":void 0,title:L,className:N()("sme-toolbar-button",{"is-pressed":!!o}),onClick:i,icon:(0,h.jsx)(g.Icon,{icon:"editor-insertmore"})},o?"sme-line-height":"sme-line-height-not-active"),r&&(0,h.jsx)($,{name:H,title:L,value:t,onReset:()=>{n((0,p.removeFormat)(t,H)),l()},onChange:e=>{n((0,p.applyFormat)(t,{type:H,attributes:{style:`line-height: ${e}`}}))},contentRef:s,settings:{...V,isActive:o}})]})}};function G(e,t,n){const o=(0,p.getActiveFormat)(t,e);if(!o)return;const s=o.attributes.style;if(s)return s.replace(new RegExp("^color:\\s*"),"");const r=o.attributes.class;if(r){const e=r.replace(/.*has-([^\s]*)-color.*/,"$1");return(0,d.getColorObjectByAttributeValues)(n,e).color}}const Z=({name:e,value:t,onChange:n})=>{const o=(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),s=(0,C.useMemo)((()=>G(e,t,o?.colors)),[e,t,o?.colors]);return(0,h.jsx)(d.__experimentalColorGradientControl,{label:(0,b.__)("Color","snow-monkey-editor"),colorValue:s,onColorChange:n,...o,__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},D=({name:e,value:t,onChange:n,contentRef:o,settings:s})=>{const r=(0,p.useAnchor)({editableContentElement:o.current,settings:s});return(0,h.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:!1,anchor:r,className:"sme-popover sme-popover--inline-color components-inline-color-popover",children:(0,h.jsx)(Z,{name:e,value:t,onChange:n})})},U="snow-monkey-editor/text-color",q=(0,b.__)("Text color","snow-monkey-editor"),J={name:U,title:q,tagName:"span",className:"sme-text-color",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:n,isActive:o,contentRef:s}=e,r=(0,y.useSelect)((e=>{var t;return null!==(t=e(d.store).getSettings()?.colors)&&void 0!==t?t:[]}),[]),a=(0,C.useMemo)((()=>G(U,t,r)),[t,r]),[i,l]=(0,C.useState)(!1),c=(0,C.useCallback)((()=>{l(!0)}),[l]),m=(0,C.useCallback)((()=>{l(!1)}),[l]);return(0,C.useEffect)((()=>{m()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:o?"sme-text-color":void 0,title:q,style:{color:a},className:N()("sme-toolbar-button",{"is-pressed":!!o}),onClick:c,icon:(0,h.jsx)(g.Icon,{icon:"edit"})},o?"sme-text-color":"sme-text-color-not-active"),i&&(0,h.jsx)(D,{name:U,value:t,onChange:e=>{if(e){const o=(0,d.getColorObjectByColorValue)(r,e);n((0,p.applyFormat)(t,{type:U,attributes:o?{class:(0,d.getColorClassName)("color",o.slug)}:{style:`color: ${e}`}}))}else n((0,p.removeFormat)(t,U)),m()},contentRef:s,settings:{...J,isActive:o}})]})}};function X(e,t,n){const o=(0,p.getActiveFormat)(t,e);if(!o)return;const s=o.attributes?.style;if(s)return s.replace(new RegExp("^background-image:\\s*"),"");const r=o.attributes?.class;if(r){let e=r.replace(/.*has-([^\s]*)-gradient-background.*/,"$1"),t=(0,u.find)(n,{slug:e});if(!t&&(e=e.replace(/(\d)-([^\d])/,"$1$2",e),t=(0,u.find)(n,{slug:e}),!t))return;return t.gradient}}const K=({name:e,value:t,onChange:n})=>{const o=(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),s=(0,C.useMemo)((()=>X(e,t,o?.gradients)),[e,t,o?.gradients]);return(0,h.jsx)(d.__experimentalColorGradientControl,{label:(0,b.__)("Color","snow-monkey-editor"),gradientValue:s,onGradientChange:n,...o,__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},Q=({name:e,value:t,onChange:n,contentRef:o,settings:s})=>{const r=(0,p.useAnchor)({editableContentElement:o.current,settings:s});return(0,h.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:!1,anchor:r,className:"sme-popover sme-popover--inline-gradient components-inline-gradient-popover",children:(0,h.jsx)(K,{name:e,value:t,onChange:n})})},W="snow-monkey-editor/text-gradient",Y=(0,b.__)("Text gradient","snow-monkey-editor"),ee={name:W,title:Y,tagName:"span",className:"sme-text-gradient",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:n,isActive:o,contentRef:s}=e,r=(0,y.useSelect)((e=>{var t;return null!==(t=e(d.store).getSettings()?.gradients)&&void 0!==t?t:[]}),[]),a=(0,C.useMemo)((()=>X(W,t,r)),[t,r]),[i,l]=(0,C.useState)(!1),c=(0,C.useCallback)((()=>{l(!0)}),[l]),m=(0,C.useCallback)((()=>{l(!1)}),[l]);return(0,C.useEffect)((()=>{m()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:o?"sme-text-gradient":void 0,title:Y,style:{"--sme--gradient":a},className:N()("sme-toolbar-button","sme-toolbar-button--text-gradient",{"is-pressed":!!o}),onClick:c,icon:(0,h.jsx)(g.Icon,{icon:"edit"})},o?"sme-text-gradient":"sme-text-gradient-not-active"),i&&(0,h.jsx)(Q,{name:W,value:t,onChange:e=>{if(e){const o=(0,d.getGradientSlugByValue)(r,e);n((0,p.applyFormat)(t,{type:W,attributes:o?{class:(0,d.__experimentalGetGradientClass)(o)}:{style:`background-image: ${e}`}}))}else n((0,p.removeFormat)(t,W)),m()},contentRef:s,settings:{...ee,isActive:o}})]})}};function te(e,t,n){const o=(0,p.getActiveFormat)(t,e);if(!o)return;const s=o.attributes.style;if(s)return s.replace(new RegExp("^background-color:\\s*"),"");const r=o.attributes.class;if(r){const e=r.replace(/.*has-([^\s]*)-background-color.*/,"$1");return(0,d.getColorObjectByAttributeValues)(n,e).color}}const ne=({name:e,value:t,onChange:n})=>{const o=(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),s=(0,C.useMemo)((()=>te(e,t,o?.colors)),[e,t,o?.colors]);return(0,h.jsx)(d.__experimentalColorGradientControl,{label:(0,b.__)("Color","snow-monkey-editor"),colorValue:s,onColorChange:n,...o,__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},oe=({name:e,value:t,onChange:n,contentRef:o,settings:s})=>{const r=(0,p.useAnchor)({editableContentElement:o.current,settings:s});return(0,h.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:!1,anchor:r,className:"sme-popover sme-popover--inline-background-color components-inline-color-popover",children:(0,h.jsx)(ne,{name:e,value:t,onChange:n})})},se="snow-monkey-editor/bg-color",re=(0,b.__)("Background color","snow-monkey-editor"),ae={name:se,title:re,tagName:"span",className:"sme-bg-color",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:n,isActive:o,contentRef:s}=e,r=(0,y.useSelect)((e=>{var t;return null!==(t=e(d.store).getSettings()?.colors)&&void 0!==t?t:[]}),[]),a=(0,C.useMemo)((()=>te(se,t,r)),[t,r]),[i,l]=(0,C.useState)(!1),c=(0,C.useCallback)((()=>{l(!0)}),[l]),m=(0,C.useCallback)((()=>{l(!1)}),[l]);return(0,C.useEffect)((()=>{m()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:o?"sme-bg-color":void 0,title:re,style:{color:a},className:N()("sme-toolbar-button",{"is-pressed":!!o}),onClick:c,icon:(0,h.jsx)(g.Icon,{icon:"tag"})},o?"sme-bg-color":"sme-bg-color-not-active"),i&&(0,h.jsx)(oe,{name:se,value:t,onChange:e=>{if(e){const o=(0,d.getColorObjectByColorValue)(r,e);n((0,p.applyFormat)(t,{type:se,attributes:o?{class:(0,d.getColorClassName)("background-color",o.slug)}:{style:`background-color: ${e}`}}))}else n((0,p.removeFormat)(t,se)),m()},contentRef:s,settings:{...ae,isActive:o}})]})}};var ie=n(558),le=n.n(ie),ce=n(919),me=n.n(ce);function ue(e,t){const n=(0,p.getActiveFormat)(t,e);if(!n)return;const o=n.attributes.style;if(!o)return;const s=o.match(/(#[0-9A-F]{3,6}) /i);if(s)return s;const r=o.match(/,\s*?(rgba?\([^)]+\)) /i);return r?function(e){if(!e||4===e.length)return e;const t=e.match(/^#([0-9A-F])\1([0-9A-F])\1([0-9A-F])\1$/i);return t?`#${t[1].slice(0,1)}${t[2].slice(0,1)}${t[3].slice(0,1)}`:e}(me()(r[1]).hex):void 0}const de=({name:e,value:t,onChange:n})=>{const o=(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),s=(0,C.useMemo)((()=>ue(e,t)),[e,t,o?.colors]);return(0,h.jsx)(d.__experimentalColorGradientControl,{label:(0,b.__)("Color","snow-monkey-editor"),colorValue:s,onColorChange:n,...o,__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},ge=({name:e,value:t,onChange:n,contentRef:o,settings:s})=>{const r=(0,p.useAnchor)({editableContentElement:o.current,settings:s});return(0,h.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:!1,anchor:r,className:"sme-popover sme-popover--inline-color components-inline-color-popover",children:(0,h.jsx)(de,{name:e,value:t,onChange:n})})},pe="snow-monkey-editor/highlighter",be=(0,b.__)("Highlighter","snow-monkey-editor"),he={name:pe,title:be,tagName:"span",className:"sme-highlighter",attributes:{style:"style"},edit:e=>{const{value:t,onChange:n,isActive:o,contentRef:s}=e,r=(0,y.useSelect)((e=>{var t;return null!==(t=e(d.store).getSettings()?.colors)&&void 0!==t?t:[]}),[]),a=(0,C.useMemo)((()=>ue(pe,t)),[t,r]),[i,l]=(0,C.useState)(!1),c=(0,C.useCallback)((()=>{l(!0)}),[l]),m=(0,C.useCallback)((()=>{l(!1)}),[l]);return(0,C.useEffect)((()=>{m()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:o?"sme-highlighter":void 0,title:be,style:{color:a},className:N()("sme-toolbar-button",{"is-pressed":!!o}),onClick:c,icon:(0,h.jsx)(g.Icon,{icon:"tag"})},o?"sme-highlighter":"sme-highlighter-not-active"),i&&(0,h.jsx)(ge,{name:pe,value:t,onChange:e=>{e?(e.match(/^#/)&&(e=le()(e,.5)),n((0,p.applyFormat)(t,{type:pe,attributes:{style:`background-image: linear-gradient(transparent 60%, ${e} 60%)`}}))):(n((0,p.removeFormat)(t,pe)),m())},contentRef:s,settings:{...he,isActive:o}})]})}},ve="snow-monkey-editor/badge",xe=(0,b.__)("Badge","snow-monkey-editor"),fe={name:ve,title:xe,tagName:"span",className:"sme-badge",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:n,isActive:o,contentRef:s}=e,r=(0,y.useSelect)((e=>{var t;return null!==(t=e(d.store).getSettings()?.colors)&&void 0!==t?t:[]}),[]),a=(0,C.useMemo)((()=>te(ve,t,r)),[t,r]),[i,l]=(0,C.useState)(!1),c=(0,C.useCallback)((()=>{l(!0)}),[l]),m=(0,C.useCallback)((()=>{l(!1)}),[l]);return(0,C.useEffect)((()=>{m()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:o?"sme-badge":void 0,title:xe,style:{color:a},className:N()("sme-toolbar-button",{"is-pressed":!!o}),onClick:c,icon:(0,h.jsx)(g.Icon,{icon:"tag"})},o?"sme-badge":"sme-badge-not-active"),i&&(0,h.jsx)(oe,{value:t,onChange:e=>{if(e){const o=(0,d.getColorObjectByColorValue)(r,e);n((0,p.applyFormat)(t,{type:ve,attributes:o?{class:(0,d.getColorClassName)("background-color",o.slug)}:{style:`background-color: ${e}`}}))}else n((0,p.removeFormat)(t,ve)),m()},contentRef:s,settings:{...fe,isActive:o}})]})}},ye="snow-monkey-editor/br",Ce=(0,b.__)("Line break per screen size","snow-monkey-editor"),ke={type:ye,innerHTML:"<br />"};function je({value:e,onChange:t,activeObjectAttributes:n,contentRef:o}){const s=e.replacements.slice()?.[e.start]?.attributes?.class,[r,a]=(0,C.useState)(!!s?.match(/sme-br--disable:desktop/)),[i,l]=(0,C.useState)(!!s?.match(/sme-br--disable:tablet/)),[c,m]=(0,C.useState)(!!s?.match(/sme-br--disable:mobile/)),u=(0,p.useAnchor)({editableContentElement:o.current,settings:we}),d=(0,C.useCallback)((o=>{a(!o);const s=e.replacements.slice();s[e.start]={...ke,attributes:{...n,class:N()({"sme-br--disable:desktop":!o,"sme-br--disable:tablet":i,"sme-br--disable:mobile":c})}},t({...e,replacements:s})}),[i,c]),v=(0,C.useCallback)((o=>{l(!o);const s=e.replacements.slice();s[e.start]={...ke,attributes:{...n,class:N()({"sme-br--disable:desktop":r,"sme-br--disable:tablet":!o,"sme-br--disable:mobile":c})}},t({...e,replacements:s})}),[r,c]),x=(0,C.useCallback)((o=>{m(!o);const s=e.replacements.slice();s[e.start]={...ke,attributes:{...n,class:N()({"sme-br--disable:desktop":r,"sme-br--disable:tablet":i,"sme-br--disable:mobile":!o})}},t({...e,replacements:s})}),[r,i]);return(0,h.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:!1,anchor:u,className:"sme-popover sme-popover--inline-br",children:(0,h.jsxs)("div",{style:{width:"260px"},children:[(0,h.jsx)(g.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Line breaks when on the desktop","snow-monkey-editor"),checked:!r,onChange:d,disabled:i&&c}),(0,h.jsx)(g.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Line breaks when on the tablet","snow-monkey-editor"),checked:!i,onChange:v,disabled:r&&c}),(0,h.jsx)(g.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Line breaks when on the mobile","snow-monkey-editor"),checked:!c,onChange:x,disabled:r&&i})]})})}const we={name:ye,title:Ce,tagName:"span",className:"sme-br",attributes:{class:"class"},interactive:!0,contentEditable:!1,edit:function({value:e,onChange:t,onFocus:n,isObjectActive:o,activeObjectAttributes:s,contentRef:r}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{icon:(0,h.jsx)("span",{className:"dashicon",children:(0,h.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,h.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.0224 5.25C18.4366 5.25 18.7724 5.58579 18.7724 6V15C18.7724 15.4142 18.4366 15.75 18.0224 15.75L18.0112 15.7499L18 15.75H10.0784V19L4.5 14.8349L10.0784 10.6699V14.25H17.2724V6C17.2724 5.58579 17.6082 5.25 18.0224 5.25Z",fill:"currentColor"})})}),title:Ce,onClick:()=>{const o=(0,p.insertObject)(e,{...ke},e.end,e.end);o.start=o.end-1,t(o),n()}}),o&&(0,h.jsx)(je,{value:e,onChange:t,activeObjectAttributes:s,contentRef:r})]})}};f(e),f(t),f(o),f(s),f(r),f(a),f(i),f(l),f(c),f(m);const _e=window.wp.compose,Se=window.wp.hooks;(0,Se.addFilter)("editor.BlockListBlock","snow-monkey-editor/ordered-list/orderd-styles",(0,_e.createHigherOrderComponent)((e=>t=>{const{attributes:n,name:o}=t?.block,{start:s,reversed:r,ordered:a,className:i}=n;return"core/list"!==o?(0,h.jsx)(e,{...t}):(i?.match("is-style-sme-ordered-list-square")||i?.match("is-style-sme-ordered-list-circle"))&&a?(0,h.jsx)(e,{...t,wrapperProps:{...t.wrapperProps,style:{...t.wrapperProps?.style,counterReset:r?`sme-count ${s+1}`:"sme-count "+(s-1)}}}):(0,h.jsx)(e,{...t})}),"withSnowMonkeyEditorOrderdListOrderdStyles"));const Ne=window.wp.blocks,Fe=window.wp.preferences;const Re="snow-monkey-editor/preferences",Ae=["allowedBlocks","content","templateLock","placeholder"],Me=e=>!(({name:e}={})=>!(0,Ne.hasBlockSupport)(e,"snowmonkeyeditor.blockPresets"))(e)&&(!!function(e,t){if(!e||!Object.keys(e).length)return!1;const n=function(e){return(0,Se.applyFilters)("SnowMonkeyEditor.extension.allowedRoles",["administrator","editor","author","contributor"],e)}(t);return 0<e.roles.filter((e=>-1<n.indexOf(e))).length}(snowmonkeyeditor?.currentUser,"block-presets")&&!!(0,Ne.getBlockType)(e.name)),Oe=(0,_e.createHigherOrderComponent)((e=>((0,y.dispatch)(Fe.store).setDefaults(Re,{blockPresets:{}}),t=>{if(!Me(t))return(0,h.jsx)(e,{...t});const{name:n,attributes:o,setAttributes:s}=t,[r,a]=(0,C.useState)(void 0),[i,l]=(0,C.useState)(0),c=(0,y.useSelect)((e=>e(Fe.store).get(Re,"blockPresets")),[]),m=c?.[n],u=(0,Ne.getBlockSupport)(n,"snowmonkeyeditor.blockPresets"),p=u?.ignore||[],v=({blockName:e,presetName:t,preset:n})=>(0,h.jsxs)("div",{className:"sme-editor-block-presets__preset",children:[(0,h.jsx)(g.Button,{onClick:()=>{const t=(0,Ne.getBlockType)(e),o={};Object.keys(t.attributes).forEach((e=>{o[e]=void 0})),Ae.forEach((e=>{delete o[e],delete n[e]})),p.forEach((e=>{delete o[e],delete n[e]})),s({...o,...n})},variant:"secondary",children:t}),(0,h.jsx)(g.Button,{label:(0,b.__)("Remove this preset","snow-monkey-editor"),onClick:()=>{const n={...c};delete n?.[e]?.[t],(0,y.dispatch)(Fe.store).set(Re,"blockPresets",n),l(i+1)},variant:"tertiary",children:"x"})]});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(e,{...t}),(0,h.jsx)(d.InspectorControls,{children:(0,h.jsxs)(g.PanelBody,{title:(0,b.__)("Presets","snow-monkey-editor"),children:[!!m&&!!Object.values(m)&&(0,h.jsx)("div",{className:"sme-editor-block-presets",children:Object.values(m).map(((e,t)=>{const o=Object.keys(m)[t];return(0,h.jsx)(v,{blockName:n,presetName:o,preset:e},t)}))}),(0,h.jsxs)("div",{className:"sme-editor-block-presets-inserter",children:[(0,h.jsx)("h3",{className:"sme-editor-block-presets-inserter__title",children:(0,b.__)("Save current settings as a preset","snow-monkey-editor")}),(0,h.jsxs)("div",{className:"sme-editor-block-presets-inserter__control",children:[(0,h.jsx)(g.TextControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,value:r||"",placeholder:(0,b.__)("Input the preset name.","snow-monkey-editor"),onChange:e=>a(e)}),(0,h.jsx)(g.Button,{variant:"primary",disabled:!r,onClick:async()=>{const e={...o};Ae.forEach((t=>{delete e[t]})),p.forEach((t=>{delete e[t]}));const t={...c,[n]:{...m,[r]:{...e}}};(0,y.dispatch)(Fe.store).set(Re,"blockPresets",t),a(void 0)},children:(0,b.__)("Save","snow-monkey-editor")})]})]})]})})]})})),"withInspectorControl");(0,Se.addFilter)("editor.BlockEdit","snow-monkey-editor/block-presets/with-inspector-controls",Oe,100),(0,Se.addFilter)("blocks.registerBlockType","snow-monkey-editor/block-presets/support",((e,t)=>{let n=!1;return"core/button"===t?n={ignore:["url","title","text","linkTarget","rel"]}:"core/cover"===t?n={ignore:["url"]}:"core/list"===t?n={ignore:["values"]}:"core/paragraph"!==t&&"core/group"!==t&&"core/columns"!==t&&"core/column"!==t&&"core/heading"!==t||(n=!0),!1===n?e:{...e,supports:{...e.supports,snowmonkeyeditor:{blockPresets:n}}}}))})()})(); -
snow-monkey-editor/trunk/readme.txt
r3308832 r3374099 5 5 Requires at least: 6.8 6 6 Tested up to: 6.8 7 Stable tag: 11.0. 27 Stable tag: 11.0.3 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 194 194 == Changelog == 195 195 196 = 11.0.3 = 197 * Fixed an issue where the formatting popover would not follow the page scroll. 198 196 199 = 11.0.2 = 197 200 * Adjusted the display position of the block extension settings panel popover. -
snow-monkey-editor/trunk/snow-monkey-editor.php
r3308832 r3374099 2 2 /** 3 3 * Plugin name: Snow Monkey Editor 4 * Version: 11.0. 24 * Version: 11.0.3 5 5 * Description: Extends gutenberg block editor 6 6 * Author: inc2734 -
snow-monkey-editor/trunk/src/format/badge/editor.js
r3254519 r3374099 2 2 3 3 import { 4 useSettings,5 4 getColorClassName, 6 5 getColorObjectByColorValue, 6 store as blockEditorStore, 7 7 } from '@wordpress/block-editor'; 8 8 9 9 import { Icon } from '@wordpress/components'; 10 import { useState, useMemo } from '@wordpress/element'; 10 import { useCallback, useEffect, useMemo, useState } from '@wordpress/element'; 11 import { useSelect } from '@wordpress/data'; 11 12 import { removeFormat, applyFormat } from '@wordpress/rich-text'; 12 13 import { __ } from '@wordpress/i18n'; … … 23 24 24 25 const Edit = ( props ) => { 25 const { value, onChange, isActive, activeAttributes,contentRef } = props;26 const { value, onChange, isActive, contentRef } = props; 26 27 27 const [ userPalette, themePalette, defaultPalette ] = useSettings( 28 'color.palette.custom', 29 'color.palette.theme', 30 'color.palette.default' 28 const colors = useSelect( 29 ( select ) => select( blockEditorStore ).getSettings()?.colors ?? [], 30 [] 31 31 ); 32 32 33 const colors = useMemo( 34 () => [ 35 ...( userPalette || [] ), 36 ...( themePalette || [] ), 37 ...( defaultPalette || [] ), 38 ], 39 [ userPalette, themePalette, defaultPalette ] 33 const activeColor = useMemo( 34 () => getActiveBackgroundColor( name, value, colors ), 35 [ value, colors ] 40 36 ); 41 37 42 38 const [ isAddingColor, setIsAddingColor ] = useState( false ); 43 39 44 const activeColor = useMemo( () => { 45 return getActiveBackgroundColor( name, value, colors ); 46 }, [ value, colors ] ); 40 const openModal = useCallback( () => { 41 setIsAddingColor( true ); 42 }, [ setIsAddingColor ] ); 43 44 const closeModal = useCallback( () => { 45 setIsAddingColor( false ); 46 }, [ setIsAddingColor ] ); 47 48 useEffect( () => { 49 closeModal(); 50 }, [ value.start ] ); 47 51 48 52 return ( … … 56 60 'is-pressed': !! isActive, 57 61 } ) } 58 onClick={ () => { 59 setIsAddingColor( ! isAddingColor ); 60 } } 62 onClick={ openModal } 61 63 icon={ <Icon icon="tag" /> } 62 64 /> … … 64 66 { isAddingColor && ( 65 67 <InlineColorUI 66 name={ name }67 activeAttributes={ activeAttributes }68 68 value={ value } 69 onClose={ () => setIsAddingColor( false ) }70 69 onChange={ ( newValue ) => { 71 70 if ( !! newValue ) { … … 92 91 } else { 93 92 onChange( removeFormat( value, name ) ); 94 setIsAddingColor( false);93 closeModal(); 95 94 } 96 95 } } 97 96 contentRef={ contentRef } 98 settings={ settings}97 settings={ { ...settings, isActive } } 99 98 /> 100 99 ) } -
snow-monkey-editor/trunk/src/format/bg-color/editor.js
r3254519 r3374099 2 2 3 3 import { 4 useSettings,5 4 getColorClassName, 6 5 getColorObjectByColorValue, 6 store as blockEditorStore, 7 7 } from '@wordpress/block-editor'; 8 8 9 9 import { Icon } from '@wordpress/components'; 10 import { useState, useMemo } from '@wordpress/element'; 10 import { useSelect } from '@wordpress/data'; 11 import { useCallback, useEffect, useMemo, useState } from '@wordpress/element'; 11 12 import { removeFormat, applyFormat } from '@wordpress/rich-text'; 12 13 import { __ } from '@wordpress/i18n'; … … 23 24 24 25 const Edit = ( props ) => { 25 const { value, onChange, isActive, activeAttributes,contentRef } = props;26 const { value, onChange, isActive, contentRef } = props; 26 27 27 const [ userPalette, themePalette, defaultPalette ] = useSettings( 28 'color.palette.custom', 29 'color.palette.theme', 30 'color.palette.default' 28 const colors = useSelect( 29 ( select ) => select( blockEditorStore ).getSettings()?.colors ?? [], 30 [] 31 31 ); 32 32 33 const colors = useMemo( 34 () => [ 35 ...( userPalette || [] ), 36 ...( themePalette || [] ), 37 ...( defaultPalette || [] ), 38 ], 39 [ userPalette, themePalette, defaultPalette ] 33 const activeColor = useMemo( 34 () => getActiveBackgroundColor( name, value, colors ), 35 [ value, colors ] 40 36 ); 41 37 42 38 const [ isAddingColor, setIsAddingColor ] = useState( false ); 43 39 44 const activeColor = useMemo( () => { 45 return getActiveBackgroundColor( name, value, colors ); 46 }, [ value, colors ] ); 40 const openModal = useCallback( () => { 41 setIsAddingColor( true ); 42 }, [ setIsAddingColor ] ); 43 44 const closeModal = useCallback( () => { 45 setIsAddingColor( false ); 46 }, [ setIsAddingColor ] ); 47 48 useEffect( () => { 49 closeModal(); 50 }, [ value.start ] ); 47 51 48 52 return ( … … 56 60 'is-pressed': !! isActive, 57 61 } ) } 58 onClick={ () => { 59 setIsAddingColor( ! isAddingColor ); 60 } } 62 onClick={ openModal } 61 63 icon={ <Icon icon="tag" /> } 62 64 /> … … 65 67 <InlineColorUI 66 68 name={ name } 67 activeAttributes={ activeAttributes }68 69 value={ value } 69 onClose={ () => setIsAddingColor( false ) }70 70 onChange={ ( newValue ) => { 71 71 if ( !! newValue ) { … … 92 92 } else { 93 93 onChange( removeFormat( value, name ) ); 94 setIsAddingColor( false);94 closeModal(); 95 95 } 96 96 } } 97 97 contentRef={ contentRef } 98 settings={ settings}98 settings={ { ...settings, isActive } } 99 99 /> 100 100 ) } -
snow-monkey-editor/trunk/src/format/br/editor.js
r3222617 r3374099 211 211 onFocus(); 212 212 } } 213 isActive={ isObjectActive }214 213 /> 215 214 -
snow-monkey-editor/trunk/src/format/component/inline-background-color.js
r3254519 r3374099 1 1 import { 2 2 getColorObjectByAttributeValues, 3 useCachedTruthy,4 useSettings,5 3 __experimentalColorGradientControl as ColorGradientControl, 6 4 __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients, … … 8 6 9 7 import { getActiveFormat, useAnchor } from '@wordpress/rich-text'; 10 import { withSpokenMessages,Popover } from '@wordpress/components';8 import { Popover } from '@wordpress/components'; 11 9 import { useMemo } from '@wordpress/element'; 12 10 import { __ } from '@wordpress/i18n'; … … 40 38 41 39 const ColorPicker = ( { name, value, onChange } ) => { 42 const [ userPalette, themePalette, defaultPalette ] = useSettings( 43 'color.palette.custom', 44 'color.palette.theme', 45 'color.palette.default' 46 ); 47 48 const colors = useMemo( 49 () => [ 50 ...( userPalette || [] ), 51 ...( themePalette || [] ), 52 ...( defaultPalette || [] ), 53 ], 54 [ userPalette, themePalette, defaultPalette ] 55 ); 40 const multipleOriginColorsAndGradients = 41 useMultipleOriginColorsAndGradients(); 56 42 57 43 const activeBackgroundColor = useMemo( 58 () => getActiveBackgroundColor( name, value, colors ), 59 [ name, value, colors ] 44 () => 45 getActiveBackgroundColor( 46 name, 47 value, 48 multipleOriginColorsAndGradients?.colors 49 ), 50 [ name, value, multipleOriginColorsAndGradients?.colors ] 60 51 ); 61 52 … … 65 56 colorValue={ activeBackgroundColor } 66 57 onColorChange={ onChange } 67 { ... useMultipleOriginColorsAndGradients()}58 { ...multipleOriginColorsAndGradients } 68 59 __experimentalHasMultipleOrigins={ true } 69 60 __experimentalIsRenderedInSidebar={ true } … … 76 67 value, 77 68 onChange, 78 onClose,79 69 contentRef, 80 70 settings, … … 85 75 } ); 86 76 87 const cachedRect = useCachedTruthy( popoverAnchor.getBoundingClientRect() );88 popoverAnchor.getBoundingClientRect = () => cachedRect;89 90 77 return ( 91 78 <Popover 79 placement="bottom" 80 shift={ true } 81 focusOnMount={ false } 92 82 anchor={ popoverAnchor } 93 onClose={ onClose }94 83 className="sme-popover sme-popover--inline-background-color components-inline-color-popover" 95 84 > … … 99 88 }; 100 89 101 export default withSpokenMessages( InlineBackgroundColorUI );90 export default InlineBackgroundColorUI; -
snow-monkey-editor/trunk/src/format/component/inline-color.js
r3254519 r3374099 1 1 import { 2 2 getColorObjectByAttributeValues, 3 useCachedTruthy,4 useSettings,5 3 __experimentalColorGradientControl as ColorGradientControl, 6 4 __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients, … … 8 6 9 7 import { getActiveFormat, useAnchor } from '@wordpress/rich-text'; 10 import { withSpokenMessages,Popover } from '@wordpress/components';8 import { Popover } from '@wordpress/components'; 11 9 import { useMemo } from '@wordpress/element'; 12 10 import { __ } from '@wordpress/i18n'; … … 34 32 35 33 const ColorPicker = ( { name, value, onChange } ) => { 36 const [ userPalette, themePalette, defaultPalette ] = useSettings( 37 'color.palette.custom', 38 'color.palette.theme', 39 'color.palette.default' 40 ); 41 42 const colors = useMemo( 43 () => [ 44 ...( userPalette || [] ), 45 ...( themePalette || [] ), 46 ...( defaultPalette || [] ), 47 ], 48 [ userPalette, themePalette, defaultPalette ] 49 ); 34 const multipleOriginColorsAndGradients = 35 useMultipleOriginColorsAndGradients(); 50 36 51 37 const activeColor = useMemo( 52 () => getActiveColor( name, value, colors ), 53 [ name, value, colors ] 38 () => 39 getActiveColor( 40 name, 41 value, 42 multipleOriginColorsAndGradients?.colors 43 ), 44 [ name, value, multipleOriginColorsAndGradients?.colors ] 54 45 ); 55 46 … … 59 50 colorValue={ activeColor } 60 51 onColorChange={ onChange } 61 { ... useMultipleOriginColorsAndGradients()}52 { ...multipleOriginColorsAndGradients } 62 53 __experimentalHasMultipleOrigins={ true } 63 54 __experimentalIsRenderedInSidebar={ true } … … 66 57 }; 67 58 68 const InlineColorUI = ( { 69 name, 70 value, 71 onChange, 72 onClose, 73 contentRef, 74 settings, 75 } ) => { 59 const InlineColorUI = ( { name, value, onChange, contentRef, settings } ) => { 76 60 const popoverAnchor = useAnchor( { 77 61 editableContentElement: contentRef.current, … … 79 63 } ); 80 64 81 const cachedRect = useCachedTruthy( popoverAnchor.getBoundingClientRect() );82 popoverAnchor.getBoundingClientRect = () => cachedRect;83 84 65 return ( 85 66 <Popover 67 placement="bottom" 68 shift={ true } 69 focusOnMount={ false } 86 70 anchor={ popoverAnchor } 87 value={ value }88 onClose={ onClose }89 71 className="sme-popover sme-popover--inline-color components-inline-color-popover" 90 72 > … … 94 76 }; 95 77 96 export default withSpokenMessages( InlineColorUI );78 export default InlineColorUI; -
snow-monkey-editor/trunk/src/format/component/inline-font-size.js
r3274014 r3374099 3 3 import { 4 4 FontSizePicker as BaseFontSizePicker, 5 useCachedTruthy,6 5 useSettings, 7 6 } from '@wordpress/block-editor'; 8 7 9 8 import { getActiveFormat, useAnchor } from '@wordpress/rich-text'; 10 import { withSpokenMessages,Popover, Button } from '@wordpress/components';9 import { Popover, Button } from '@wordpress/components'; 11 10 import { useMemo } from '@wordpress/element'; 12 11 import { __ } from '@wordpress/i18n'; … … 79 78 value, 80 79 onChange, 81 onClose,82 80 onReset, 83 81 contentRef, … … 89 87 } ); 90 88 91 const cachedRect = useCachedTruthy( popoverAnchor.getBoundingClientRect() );92 popoverAnchor.getBoundingClientRect = () => cachedRect;93 94 89 return ( 95 90 <Popover 91 placement="bottom" 92 shift={ true } 93 focusOnMount={ false } 96 94 anchor={ popoverAnchor } 97 onClose={ onClose }98 95 className="sme-popover sme-popover--inline-font-size components-inline-color-popover" 99 96 > … … 110 107 }; 111 108 112 export default withSpokenMessages( InlineFontSizeUI );109 export default InlineFontSizeUI; -
snow-monkey-editor/trunk/src/format/component/inline-gradient.js
r3254519 r3374099 2 2 3 3 import { 4 useSettings,5 useCachedTruthy,6 4 __experimentalColorGradientControl as ColorGradientControl, 7 5 __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients, … … 9 7 10 8 import { getActiveFormat, useAnchor } from '@wordpress/rich-text'; 11 12 import { withSpokenMessages, Popover } from '@wordpress/components'; 9 import { Popover } from '@wordpress/components'; 13 10 import { useMemo } from '@wordpress/element'; 14 11 import { __ } from '@wordpress/i18n'; … … 50 47 51 48 const GradientPicker = ( { name, value, onChange } ) => { 52 const [ userGradients, themeGradients, defaultGradients ] = useSettings( 53 'color.gradients.custom', 54 'color.gradients.theme', 55 'color.gradients.default' 56 ); 57 58 const gradients = useMemo( 59 () => [ 60 ...( userGradients || [] ), 61 ...( themeGradients || [] ), 62 ...( defaultGradients || [] ), 63 ], 64 [ userGradients, themeGradients, defaultGradients ] 65 ); 49 const multipleOriginColorsAndGradients = 50 useMultipleOriginColorsAndGradients(); 66 51 67 52 const activeGradient = useMemo( 68 () => getActiveGradient( name, value, gradients ), 69 [ name, value, gradients ] 53 () => 54 getActiveGradient( 55 name, 56 value, 57 multipleOriginColorsAndGradients?.gradients 58 ), 59 [ name, value, multipleOriginColorsAndGradients?.gradients ] 70 60 ); 71 61 … … 75 65 gradientValue={ activeGradient } 76 66 onGradientChange={ onChange } 77 { ... useMultipleOriginColorsAndGradients()}67 { ...multipleOriginColorsAndGradients } 78 68 __experimentalHasMultipleOrigins={ true } 79 69 __experimentalIsRenderedInSidebar={ true } … … 86 76 value, 87 77 onChange, 88 onClose,89 78 contentRef, 90 79 settings, … … 95 84 } ); 96 85 97 const cachedRect = useCachedTruthy( popoverAnchor.getBoundingClientRect() );98 popoverAnchor.getBoundingClientRect = () => cachedRect;99 100 86 return ( 101 87 <Popover 88 placement="bottom" 89 shift={ true } 90 focusOnMount={ false } 102 91 anchor={ popoverAnchor } 103 onClose={ onClose }104 92 className="sme-popover sme-popover--inline-gradient components-inline-gradient-popover" 105 93 > … … 113 101 }; 114 102 115 export default withSpokenMessages( InlineGradientUI );103 export default InlineGradientUI; -
snow-monkey-editor/trunk/src/format/component/inline-highlighter.js
r3254519 r3374099 2 2 3 3 import { 4 useCachedTruthy,5 useSettings,6 4 __experimentalColorGradientControl as ColorGradientControl, 7 5 __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients, … … 9 7 10 8 import { getActiveFormat, useAnchor } from '@wordpress/rich-text'; 11 12 import { withSpokenMessages, Popover } from '@wordpress/components'; 9 import { Popover } from '@wordpress/components'; 13 10 import { useMemo } from '@wordpress/element'; 14 11 import { __ } from '@wordpress/i18n'; … … 39 36 40 37 const ColorPicker = ( { name, value, onChange } ) => { 41 const [ userPalette, themePalette, defaultPalette ] = useSettings( 42 'color.palette.custom', 43 'color.palette.theme', 44 'color.palette.default' 45 ); 46 47 const colors = useMemo( 48 () => [ 49 ...( userPalette || [] ), 50 ...( themePalette || [] ), 51 ...( defaultPalette || [] ), 52 ], 53 [ userPalette, themePalette, defaultPalette ] 54 ); 38 const multipleOriginColorsAndGradients = 39 useMultipleOriginColorsAndGradients(); 55 40 56 41 const activeColor = useMemo( 57 () => getActiveColor( name, value, colors ), 58 [ name, value, colors ] 42 () => 43 getActiveColor( 44 name, 45 value, 46 multipleOriginColorsAndGradients?.colors 47 ), 48 [ name, value, multipleOriginColorsAndGradients?.colors ] 59 49 ); 60 50 … … 64 54 colorValue={ activeColor } 65 55 onColorChange={ onChange } 66 { ... useMultipleOriginColorsAndGradients()}56 { ...multipleOriginColorsAndGradients } 67 57 __experimentalHasMultipleOrigins={ true } 68 58 __experimentalIsRenderedInSidebar={ true } … … 71 61 }; 72 62 73 const InlineColorUI = ( { 74 name, 75 value, 76 onChange, 77 onClose, 78 contentRef, 79 settings, 80 } ) => { 63 const InlineColorUI = ( { name, value, onChange, contentRef, settings } ) => { 81 64 const popoverAnchor = useAnchor( { 82 65 editableContentElement: contentRef.current, … … 84 67 } ); 85 68 86 const cachedRect = useCachedTruthy( popoverAnchor.getBoundingClientRect() );87 popoverAnchor.getBoundingClientRect = () => cachedRect;88 89 69 return ( 90 70 <Popover 71 placement="bottom" 72 shift={ true } 73 focusOnMount={ false } 91 74 anchor={ popoverAnchor } 92 onClose={ onClose }93 75 className="sme-popover sme-popover--inline-color components-inline-color-popover" 94 76 > … … 98 80 }; 99 81 100 export default withSpokenMessages( InlineColorUI );82 export default InlineColorUI; -
snow-monkey-editor/trunk/src/format/component/inline-letter-spacing.js
r3274014 r3374099 1 import { 2 RangeControl, 3 withSpokenMessages, 4 Popover, 5 Button, 6 } from '@wordpress/components'; 7 1 import { RangeControl, Popover, Button } from '@wordpress/components'; 8 2 import { getActiveFormat, useAnchor } from '@wordpress/rich-text'; 9 10 import { useCachedTruthy } from '@wordpress/block-editor';11 3 import { useMemo } from '@wordpress/element'; 12 4 import { __ } from '@wordpress/i18n'; … … 54 46 disabled={ value === undefined } 55 47 variant="secondary" 56 isSmall57 48 onClick={ onReset } 58 49 > … … 68 59 value, 69 60 onChange, 70 onClose,71 61 onReset, 72 62 contentRef, … … 78 68 } ); 79 69 80 const cachedRect = useCachedTruthy( popoverAnchor.getBoundingClientRect() );81 popoverAnchor.getBoundingClientRect = () => cachedRect;82 83 70 return ( 84 71 <Popover 72 placement="bottom" 73 shift={ true } 74 focusOnMount={ false } 85 75 anchor={ popoverAnchor } 86 onClose={ onClose }87 76 className="sme-popover sme-popover--inline-letter-spacing components-inline-color-popover" 88 77 > … … 100 89 }; 101 90 102 export default withSpokenMessages( InlineLetterSpacingUI );91 export default InlineLetterSpacingUI; -
snow-monkey-editor/trunk/src/format/component/inline-line-height.js
r3274014 r3374099 1 import { 2 RangeControl, 3 withSpokenMessages, 4 Popover, 5 Button, 6 } from '@wordpress/components'; 7 1 import { RangeControl, Popover, Button } from '@wordpress/components'; 8 2 import { getActiveFormat, useAnchor } from '@wordpress/rich-text'; 9 10 import { useCachedTruthy } from '@wordpress/block-editor';11 3 import { useMemo } from '@wordpress/element'; 12 4 import { __ } from '@wordpress/i18n'; … … 49 41 disabled={ value === undefined } 50 42 variant="secondary" 51 isSmall52 43 onClick={ onReset } 53 44 > … … 63 54 value, 64 55 onChange, 65 onClose,66 56 onReset, 67 57 contentRef, … … 73 63 } ); 74 64 75 const cachedRect = useCachedTruthy( popoverAnchor.getBoundingClientRect() );76 popoverAnchor.getBoundingClientRect = () => cachedRect;77 78 65 return ( 79 66 <Popover 67 placement="bottom" 68 shift={ true } 69 focusOnMount={ false } 80 70 anchor={ popoverAnchor } 81 onClose={ onClose }82 71 className="sme-popover sme-popover--inline-line-height components-inline-color-popover" 83 72 > … … 95 84 }; 96 85 97 export default withSpokenMessages( InlineLineHeightUI );86 export default InlineLineHeightUI; -
snow-monkey-editor/trunk/src/format/font-size/editor.js
r3069302 r3374099 4 4 import { useSettings, getFontSizeClass } from '@wordpress/block-editor'; 5 5 import { Icon } from '@wordpress/components'; 6 import { use State } from '@wordpress/element';6 import { useCallback, useEffect, useState } from '@wordpress/element'; 7 7 import { removeFormat, applyFormat } from '@wordpress/rich-text'; 8 8 import { __ } from '@wordpress/i18n'; … … 15 15 16 16 const Edit = ( props ) => { 17 const { value, onChange, isActive, activeAttributes,contentRef } = props;17 const { value, onChange, isActive, contentRef } = props; 18 18 19 19 const [ fontSizes ] = useSettings( 'typography.fontSizes' ); 20 20 const [ isAddingFontSize, setIsAddingFontSize ] = useState( false ); 21 22 const openModal = useCallback( () => { 23 setIsAddingFontSize( true ); 24 }, [ setIsAddingFontSize ] ); 25 26 const closeModal = useCallback( () => { 27 setIsAddingFontSize( false ); 28 }, [ setIsAddingFontSize ] ); 29 30 useEffect( () => { 31 closeModal(); 32 }, [ value.start ] ); 21 33 22 34 return ( … … 29 41 'is-pressed': !! isActive, 30 42 } ) } 31 onClick={ () => { 32 setIsAddingFontSize( ! isAddingFontSize ); 33 } } 43 onClick={ openModal } 34 44 icon={ <Icon icon="editor-textcolor" /> } 35 45 /> … … 38 48 <InlineFontSizeUI 39 49 name={ name } 40 activeAttributes={ activeAttributes }41 50 value={ value } 42 onClose={ () => setIsAddingFontSize( false ) }43 51 onReset={ () => { 44 setIsAddingFontSize( false );45 52 onChange( removeFormat( value, name ) ); 53 closeModal(); 46 54 } } 47 55 onChange={ ( newValue ) => { … … 81 89 } else { 82 90 onChange( removeFormat( value, name ) ); 91 closeModal(); 83 92 } 84 93 } } 85 94 contentRef={ contentRef } 86 settings={ settings}95 settings={ { ...settings, isActive } } 87 96 /> 88 97 ) } -
snow-monkey-editor/trunk/src/format/highlighter/editor.js
r3254519 r3374099 2 2 import hexToRgba from 'hex-to-rgba'; 3 3 4 import { useSettings} from '@wordpress/block-editor';4 import { store as blockEditorStore } from '@wordpress/block-editor'; 5 5 import { Icon } from '@wordpress/components'; 6 import { useState, useMemo } from '@wordpress/element'; 6 import { useSelect } from '@wordpress/data'; 7 import { useCallback, useEffect, useMemo, useState } from '@wordpress/element'; 7 8 import { removeFormat, applyFormat } from '@wordpress/rich-text'; 8 9 import { __ } from '@wordpress/i18n'; … … 19 20 20 21 const Edit = ( props ) => { 21 const { value, onChange, isActive, activeAttributes,contentRef } = props;22 const { value, onChange, isActive, contentRef } = props; 22 23 23 const [ userPalette, themePalette, defaultPalette ] = useSettings( 24 'color.palette.custom', 25 'color.palette.theme', 26 'color.palette.default' 24 const colors = useSelect( 25 ( select ) => select( blockEditorStore ).getSettings()?.colors ?? [], 26 [] 27 27 ); 28 28 29 const colors = useMemo( 30 () => [ 31 ...( userPalette || [] ), 32 ...( themePalette || [] ), 33 ...( defaultPalette || [] ), 34 ], 35 [ userPalette, themePalette, defaultPalette ] 29 const activeColor = useMemo( 30 () => getActiveColor( name, value, colors ), 31 [ value, colors ] 36 32 ); 37 33 38 34 const [ isAddingColor, setIsAddingColor ] = useState( false ); 39 35 40 const activeColor = useMemo( () => { 41 return getActiveColor( name, value, colors ); 42 }, [ value, colors ] ); 36 const openModal = useCallback( () => { 37 setIsAddingColor( true ); 38 }, [ setIsAddingColor ] ); 39 40 const closeModal = useCallback( () => { 41 setIsAddingColor( false ); 42 }, [ setIsAddingColor ] ); 43 44 useEffect( () => { 45 closeModal(); 46 }, [ value.start ] ); 43 47 44 48 return ( … … 54 58 'is-pressed': !! isActive, 55 59 } ) } 56 onClick={ () => { 57 setIsAddingColor( ! isAddingColor ); 58 } } 60 onClick={ openModal } 59 61 icon={ <Icon icon="tag" /> } 60 62 /> … … 63 65 <InlineColorUI 64 66 name={ name } 65 activeAttributes={ activeAttributes }66 67 value={ value } 67 onClose={ () => setIsAddingColor( false ) }68 68 onChange={ ( newValue ) => { 69 69 if ( !! newValue ) { … … 82 82 } else { 83 83 onChange( removeFormat( value, name ) ); 84 setIsAddingColor( false);84 closeModal(); 85 85 } 86 86 } } 87 87 contentRef={ contentRef } 88 settings={ settings}88 settings={ { ...settings, isActive } } 89 89 /> 90 90 ) } -
snow-monkey-editor/trunk/src/format/letter-spacing/editor.js
r2812617 r3374099 2 2 3 3 import { Icon } from '@wordpress/components'; 4 import { use State } from '@wordpress/element';4 import { useCallback, useEffect, useState } from '@wordpress/element'; 5 5 import { removeFormat, applyFormat } from '@wordpress/rich-text'; 6 6 import { __ } from '@wordpress/i18n'; … … 13 13 14 14 const Edit = ( props ) => { 15 const { value, onChange, isActive, activeAttributes,contentRef } = props;15 const { value, onChange, isActive, contentRef } = props; 16 16 17 17 const [ isAddingLetterSpacing, setIsAddingLetterSpacing ] = 18 18 useState( false ); 19 20 const openModal = useCallback( () => { 21 setIsAddingLetterSpacing( true ); 22 }, [ setIsAddingLetterSpacing ] ); 23 24 const closeModal = useCallback( () => { 25 setIsAddingLetterSpacing( false ); 26 }, [ setIsAddingLetterSpacing ] ); 27 28 useEffect( () => { 29 closeModal(); 30 }, [ value.start ] ); 19 31 20 32 return ( … … 31 43 'is-pressed': !! isActive, 32 44 } ) } 33 onClick={ () => { 34 setIsAddingLetterSpacing( ! isAddingLetterSpacing ); 35 } } 45 onClick={ openModal } 36 46 icon={ <Icon icon="controls-pause" /> } 37 47 /> … … 41 51 name={ name } 42 52 title={ title } 43 activeAttributes={ activeAttributes }44 53 value={ value } 45 onClose={ () => {46 setIsAddingLetterSpacing( false );47 } }48 54 onReset={ () => { 49 setIsAddingLetterSpacing( false );50 55 onChange( removeFormat( value, name ) ); 56 closeModal(); 51 57 } } 52 58 onChange={ ( newValue ) => { … … 61 67 } } 62 68 contentRef={ contentRef } 63 settings={ settings}69 settings={ { ...settings, isActive } } 64 70 /> 65 71 ) } -
snow-monkey-editor/trunk/src/format/line-height/editor.js
r2812617 r3374099 2 2 3 3 import { Icon } from '@wordpress/components'; 4 import { use State } from '@wordpress/element';4 import { useCallback, useEffect, useState } from '@wordpress/element'; 5 5 import { removeFormat, applyFormat } from '@wordpress/rich-text'; 6 6 import { __ } from '@wordpress/i18n'; … … 13 13 14 14 const Edit = ( props ) => { 15 const { value, onChange, isActive, activeAttributes,contentRef } = props;15 const { value, onChange, isActive, contentRef } = props; 16 16 17 17 const [ isAddingLineHeight, setIsAddingLineHeight ] = useState( false ); 18 19 const openModal = useCallback( () => { 20 setIsAddingLineHeight( true ); 21 }, [ setIsAddingLineHeight ] ); 22 23 const closeModal = useCallback( () => { 24 setIsAddingLineHeight( false ); 25 }, [ setIsAddingLineHeight ] ); 26 27 useEffect( () => { 28 closeModal(); 29 }, [ value.start ] ); 18 30 19 31 return ( … … 28 40 'is-pressed': !! isActive, 29 41 } ) } 30 onClick={ () => { 31 setIsAddingLineHeight( ! isAddingLineHeight ); 32 } } 42 onClick={ openModal } 33 43 icon={ <Icon icon="editor-insertmore" /> } 34 44 /> … … 38 48 name={ name } 39 49 title={ title } 40 activeAttributes={ activeAttributes }41 50 value={ value } 42 onClose={ () => {43 setIsAddingLineHeight( false );44 } }45 51 onReset={ () => { 46 setIsAddingLineHeight( false );47 52 onChange( removeFormat( value, name ) ); 53 closeModal(); 48 54 } } 49 55 onChange={ ( newValue ) => { … … 58 64 } } 59 65 contentRef={ contentRef } 60 settings={ settings}66 settings={ { ...settings, isActive } } 61 67 /> 62 68 ) } -
snow-monkey-editor/trunk/src/format/text-color/editor.js
r3254519 r3374099 2 2 3 3 import { 4 useSettings,5 4 getColorClassName, 6 5 getColorObjectByColorValue, 6 store as blockEditorStore, 7 7 } from '@wordpress/block-editor'; 8 8 9 9 import { Icon } from '@wordpress/components'; 10 import { useState, useMemo } from '@wordpress/element'; 10 import { useSelect } from '@wordpress/data'; 11 import { useCallback, useEffect, useMemo, useState } from '@wordpress/element'; 11 12 import { removeFormat, applyFormat } from '@wordpress/rich-text'; 12 13 import { __ } from '@wordpress/i18n'; … … 23 24 24 25 const Edit = ( props ) => { 25 const { value, onChange, isActive, activeAttributes,contentRef } = props;26 const { value, onChange, isActive, contentRef } = props; 26 27 27 const [ userPalette, themePalette, defaultPalette ] = useSettings( 28 'color.palette.custom', 29 'color.palette.theme', 30 'color.palette.default' 28 const colors = useSelect( 29 ( select ) => select( blockEditorStore ).getSettings()?.colors ?? [], 30 [] 31 31 ); 32 32 33 const colors = useMemo( 34 () => [ 35 ...( userPalette || [] ), 36 ...( themePalette || [] ), 37 ...( defaultPalette || [] ), 38 ], 39 [ userPalette, themePalette, defaultPalette ] 33 const activeColor = useMemo( 34 () => getActiveColor( name, value, colors ), 35 [ value, colors ] 40 36 ); 41 37 42 38 const [ isAddingColor, setIsAddingColor ] = useState( false ); 43 39 44 const activeColor = useMemo( () => { 45 return getActiveColor( name, value, colors ); 46 }, [ value, colors ] ); 40 const openModal = useCallback( () => { 41 setIsAddingColor( true ); 42 }, [ setIsAddingColor ] ); 43 44 const closeModal = useCallback( () => { 45 setIsAddingColor( false ); 46 }, [ setIsAddingColor ] ); 47 48 useEffect( () => { 49 closeModal(); 50 }, [ value.start ] ); 47 51 48 52 return ( … … 58 62 'is-pressed': !! isActive, 59 63 } ) } 60 onClick={ () => { 61 setIsAddingColor( ! isAddingColor ); 62 } } 64 onClick={ openModal } 63 65 icon={ <Icon icon="edit" /> } 64 66 /> … … 67 69 <InlineColorUI 68 70 name={ name } 69 activeAttributes={ activeAttributes }70 71 value={ value } 71 onClose={ () => setIsAddingColor( false ) }72 72 onChange={ ( newValue ) => { 73 73 if ( !! newValue ) { … … 94 94 } else { 95 95 onChange( removeFormat( value, name ) ); 96 setIsAddingColor( false);96 closeModal(); 97 97 } 98 98 } } 99 99 contentRef={ contentRef } 100 settings={ settings}100 settings={ { ...settings, isActive } } 101 101 /> 102 102 ) } -
snow-monkey-editor/trunk/src/format/text-gradient/editor.js
r3254519 r3374099 2 2 3 3 import { 4 useSettings,5 4 getGradientSlugByValue, 6 5 __experimentalGetGradientClass, 6 store as blockEditorStore, 7 7 } from '@wordpress/block-editor'; 8 8 9 9 import { Icon } from '@wordpress/components'; 10 import { useState, useMemo } from '@wordpress/element'; 10 import { useSelect } from '@wordpress/data'; 11 import { useCallback, useEffect, useMemo, useState } from '@wordpress/element'; 11 12 import { removeFormat, applyFormat } from '@wordpress/rich-text'; 12 13 import { __ } from '@wordpress/i18n'; … … 23 24 24 25 const Edit = ( props ) => { 25 const { value, onChange, isActive, activeAttributes,contentRef } = props;26 const { value, onChange, isActive, contentRef } = props; 26 27 27 const [ userGradients, themeGradients, defaultGradients ] = useSettings( 28 'color.gradients.custom', 29 'color.gradients.theme', 30 'color.gradients.default' 28 const gradients = useSelect( 29 ( select ) => select( blockEditorStore ).getSettings()?.gradients ?? [], 30 [] 31 31 ); 32 33 const gradients = useMemo(34 () => [35 ...( userGradients || [] ),36 ...( themeGradients || [] ),37 ...( defaultGradients || [] ),38 ],39 [ userGradients, themeGradients, defaultGradients ]40 );41 42 const [ isAddingGradient, setIsAddingGradient ] = useState( false );43 32 44 33 const activeGradient = useMemo( () => { 45 34 return getActiveGradient( name, value, gradients ); 46 35 }, [ value, gradients ] ); 36 37 const [ isAddingGradient, setIsAddingGradient ] = useState( false ); 38 39 const openModal = useCallback( () => { 40 setIsAddingGradient( true ); 41 }, [ setIsAddingGradient ] ); 42 43 const closeModal = useCallback( () => { 44 setIsAddingGradient( false ); 45 }, [ setIsAddingGradient ] ); 46 47 useEffect( () => { 48 closeModal(); 49 }, [ value.start ] ); 47 50 48 51 return ( … … 64 67 } 65 68 ) } 66 onClick={ () => { 67 setIsAddingGradient( ! isAddingGradient ); 68 } } 69 onClick={ openModal } 69 70 icon={ <Icon icon="edit" /> } 70 71 /> … … 73 74 <InlineGradientUI 74 75 name={ name } 75 activeAttributes={ activeAttributes }76 76 value={ value } 77 onClose={ () => setIsAddingGradient( false ) }78 77 onChange={ ( newValue ) => { 79 78 if ( !! newValue ) { … … 99 98 } else { 100 99 onChange( removeFormat( value, name ) ); 101 setIsAddingGradient( false);100 closeModal(); 102 101 } 103 102 } } 104 103 contentRef={ contentRef } 105 settings={ settings}104 settings={ { ...settings, isActive } } 106 105 /> 107 106 ) } -
snow-monkey-editor/trunk/vendor/composer/platform_check.php
r2899739 r3374099 20 20 } 21 21 } 22 trigger_error( 23 'Composer detected issues in your platform: ' . implode(' ', $issues), 24 E_USER_ERROR 22 throw new \RuntimeException( 23 'Composer detected issues in your platform: ' . implode(' ', $issues) 25 24 ); 26 25 }
Note: See TracChangeset
for help on using the changeset viewer.