Plugin Directory

Changeset 3396826


Ignore:
Timestamp:
11/17/2025 12:46:45 AM (4 months ago)
Author:
inc2734
Message:

Verion up. v11.0.4

Location:
snow-monkey-editor/trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • snow-monkey-editor/trunk/dist/js/editor.asset.php

    r3374099 r3396826  
    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');
     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' => 'abe616fa5fd1d034a76a');
  • snow-monkey-editor/trunk/dist/js/editor.js

    r3374099 r3396826  
    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}}}}))})()})();
     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:()=>E});var n={};o.r(n),o.d(n,{settings:()=>I});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:()=>he});var c={};o.r(c),o.d(c,{settings:()=>xe});var m={};o.r(m),o.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"})}),f={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:f})})}),["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 x=e=>{if(!e)return;const{name:t,settings:o}=e;(0,p.registerFormatType)(t,o)},C=window.wp.data,y=window.wp.element,k=window.wp.keycodes;function j({name:e,shortcutType:t,shortcutCharacter:o,...n}){let s,r="SnowMonkey.ToolbarControls";return e&&(r+=`.${e}`),t&&o&&(s=k.displayShortcut[t](o)),(0,h.jsx)(g.Fill,{name:r,children:(0,h.jsx)(g.ToolbarButton,{...n,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 o=(0,C.useSelect)((e=>e("core/rich-text").getFormatTypes()),[]),n=(0,y.useCallback)((()=>{if(0<o.length){let n=e;o.forEach((e=>{n=(0,p.removeFormat)(n,e.name)})),t({...n})}}),[e,o]);return(0,h.jsx)(j,{icon:"editor-removeformatting",title:w,onClick:n})}};var S=o(942),N=o.n(S);const F=({name:e,value:t,onChange:o,onReset:n})=>{const[s]=(0,d.useSettings)("typography.fontSizes"),r=(0,y.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,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(d.FontSizePicker,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,value:r,onChange:o,fontSizes:s}),(0,h.jsx)(g.Button,{disabled:void 0===t,variant:"secondary",size:"small",onClick:n,children:(0,b.__)("Reset")})]})},A=({name:e,value:t,onChange:o,onReset:n,onClose: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:"firstElement",anchor:i,onClose:s,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:o,onReset:n})})})},R="snow-monkey-editor/font-size",M=(0,b.__)("Font size","snow-monkey-editor"),E={name:R,title:M,tagName:"span",className:"sme-font-size",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:o,isActive:n,contentRef:s}=e,[r]=(0,d.useSettings)("typography.fontSizes"),[a,i]=(0,y.useState)(!1),l=(0,y.useCallback)((()=>{i(!0)}),[i]),c=(0,y.useCallback)((()=>{i(!1)}),[i]);return(0,y.useEffect)((()=>{c()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:n?"sme-font-size":void 0,title:M,className:N()("sme-toolbar-button",{"is-pressed":!!n}),onClick:l,icon:(0,h.jsx)(g.Icon,{icon:"editor-textcolor"})},n?"sme-font-size":"sme-font-size-not-active"),a&&(0,h.jsx)(A,{name:R,value:t,onReset:()=>{o((0,p.removeFormat)(t,R)),c()},onChange:e=>{if(e){let n;if((0,u.isString)(e)||r[0]&&(0,u.isString)(r[0].size))n=e;else{if(!(0,u.isNumber)(e))return;n=`${e}px`}const s=(0,u.find)(r,{size:e});o((0,p.applyFormat)(t,{type:R,attributes:s?{class:(0,d.getFontSizeClass)(s.slug)}:{style:`font-size: ${n}`}}))}else o((0,p.removeFormat)(t,R)),c()},contentRef:s,settings:{...E,isActive:n},onClose:c})]})}},O=({name:e,title:t,value:o,onChange:n,onReset:s})=>{const r=(0,y.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,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(g.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:t,value:r,onChange:n,min:"0",max:"2",step:"0.1",initialPosition:void 0}),(0,h.jsx)(g.Button,{disabled:void 0===o,variant:"secondary",onClick:s,children:(0,b.__)("Reset")})]})},B=({name:e,title:t,value:o,onChange:n,onReset:s,onClose:r,contentRef:a,settings:i})=>{const l=(0,p.useAnchor)({editableContentElement:a.current,settings:i});return(0,h.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:"firstElement",anchor:l,onClose:r,className:"sme-popover sme-popover--inline-letter-spacing components-inline-color-popover",children:(0,h.jsx)("fieldset",{children:(0,h.jsx)(O,{name:e,title:t,value:o,onChange:n,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:o,isActive:n,contentRef:s}=e,[r,a]=(0,y.useState)(!1),i=(0,y.useCallback)((()=>{a(!0)}),[a]),l=(0,y.useCallback)((()=>{a(!1)}),[a]);return(0,y.useEffect)((()=>{l()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:n?"sme-letter-spacing":void 0,title:z,className:N()("sme-toolbar-button",{"is-pressed":!!n}),onClick:i,icon:(0,h.jsx)(g.Icon,{icon:"controls-pause"})},n?"sme-letter-spacing":"sme-letter-spacing-not-active"),r&&(0,h.jsx)(B,{name:P,title:z,value:t,onReset:()=>{o((0,p.removeFormat)(t,P)),l()},onChange:e=>{o((0,p.applyFormat)(t,{type:P,attributes:{style:`letter-spacing: ${e}rem`}}))},contentRef:s,settings:{...I,isActive:n},onClose:l})]})}},T=({name:e,title:t,value:o,onChange:n,onReset:s})=>{const r=(0,y.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,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(g.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:t,value:r,onChange:n,min:"0",max:"5",step:"0.1",initialPosition:void 0}),(0,h.jsx)(g.Button,{disabled:void 0===o,variant:"secondary",onClick:s,children:(0,b.__)("Reset")})]})},$=({name:e,title:t,value:o,onChange:n,onReset:s,onClose:r,contentRef:a,settings:i})=>{const l=(0,p.useAnchor)({editableContentElement:a.current,settings:i});return(0,h.jsx)(g.Popover,{placement:"bottom",shift:!0,focusOnMount:"firstElement",anchor:l,onClose:r,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:o,onChange:n,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:o,isActive:n,contentRef:s}=e,[r,a]=(0,y.useState)(!1),i=(0,y.useCallback)((()=>{a(!0)}),[a]),l=(0,y.useCallback)((()=>{a(!1)}),[a]);return(0,y.useEffect)((()=>{l()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:n?"sme-line-height":void 0,title:L,className:N()("sme-toolbar-button",{"is-pressed":!!n}),onClick:i,icon:(0,h.jsx)(g.Icon,{icon:"editor-insertmore"})},n?"sme-line-height":"sme-line-height-not-active"),r&&(0,h.jsx)($,{name:H,title:L,value:t,onReset:()=>{o((0,p.removeFormat)(t,H)),l()},onChange:e=>{o((0,p.applyFormat)(t,{type:H,attributes:{style:`line-height: ${e}`}}))},contentRef:s,settings:{...V,isActive:n},onClose:l})]})}};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=(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),s=(0,y.useMemo)((()=>{var e;const t=null!==(e=n?.colors)&&void 0!==e?e:[];return Array.isArray(t)?t.reduce(((e,t)=>Array.isArray(t?.colors)?[...e,...t.colors]:t?.color?[...e,t]:e),[]):t}),[n?.colors]),r=(0,y.useMemo)((()=>G(e,t,s)),[e,t,s]);return(0,h.jsx)(d.__experimentalColorGradientControl,{label:(0,b.__)("Color","snow-monkey-editor"),colorValue:r,onColorChange:o,...n,__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},D=({name:e,value:t,onChange:o,onClose:n,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:"firstElement",anchor:a,onClose:n,className:"sme-popover sme-popover--inline-color components-inline-color-popover",children:(0,h.jsx)(Z,{name:e,value:t,onChange:o})})},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:o,isActive:n,contentRef:s}=e,r=(0,C.useSelect)((e=>{var t;return null!==(t=e(d.store).getSettings()?.colors)&&void 0!==t?t:[]}),[]),a=(0,y.useMemo)((()=>G(U,t,r)),[t,r]),[i,l]=(0,y.useState)(!1),c=(0,y.useCallback)((()=>{l(!0)}),[l]),m=(0,y.useCallback)((()=>{l(!1)}),[l]);return(0,y.useEffect)((()=>{m()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:n?"sme-text-color":void 0,title:q,style:{color:a},className:N()("sme-toolbar-button",{"is-pressed":!!n}),onClick:c,icon:(0,h.jsx)(g.Icon,{icon:"edit"})},n?"sme-text-color":"sme-text-color-not-active"),i&&(0,h.jsx)(D,{name:U,value:t,onChange:e=>{if(e){const n=(0,d.getColorObjectByColorValue)(r,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)),m()},contentRef:s,settings:{...J,isActive:n},onClose:m})]})}};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=(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),s=(0,y.useMemo)((()=>{var e;const t=null!==(e=n?.gradients)&&void 0!==e?e:[];return Array.isArray(t)?t.reduce(((e,t)=>Array.isArray(t?.gradients)?[...e,...t.gradients]:t?.gradient?[...e,t]:e),[]):t}),[n?.gradients]),r=(0,y.useMemo)((()=>X(e,t,s)),[e,t,s]);return(0,h.jsx)(d.__experimentalColorGradientControl,{label:(0,b.__)("Color","snow-monkey-editor"),gradientValue:r,onGradientChange:o,...n,__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},Q=({name:e,value:t,onChange:o,onClose:n,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:"firstElement",anchor:a,onClose:n,className:"sme-popover sme-popover--inline-gradient components-inline-gradient-popover",children:(0,h.jsx)(K,{name:e,value:t,onChange:o})})},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:o,isActive:n,contentRef:s}=e,r=(0,C.useSelect)((e=>{var t;return null!==(t=e(d.store).getSettings()?.gradients)&&void 0!==t?t:[]}),[]),a=(0,y.useMemo)((()=>X(W,t,r)),[t,r]),[i,l]=(0,y.useState)(!1),c=(0,y.useCallback)((()=>{l(!0)}),[l]),m=(0,y.useCallback)((()=>{l(!1)}),[l]);return(0,y.useEffect)((()=>{m()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:n?"sme-text-gradient":void 0,title:Y,style:{"--sme--gradient":a},className:N()("sme-toolbar-button","sme-toolbar-button--text-gradient",{"is-pressed":!!n}),onClick:c,icon:(0,h.jsx)(g.Icon,{icon:"edit"})},n?"sme-text-gradient":"sme-text-gradient-not-active"),i&&(0,h.jsx)(Q,{name:W,value:t,onChange:e=>{if(e){const n=(0,d.getGradientSlugByValue)(r,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)),m()},contentRef:s,settings:{...ee,isActive:n},onClose:m})]})}};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=(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),s=(0,y.useMemo)((()=>{var e;const t=null!==(e=n?.colors)&&void 0!==e?e:[];return Array.isArray(t)?t.reduce(((e,t)=>Array.isArray(t?.colors)?[...e,...t.colors]:t?.color?[...e,t]:e),[]):t}),[n?.colors]),r=(0,y.useMemo)((()=>te(e,t,s)),[e,t,s]);return(0,h.jsx)(d.__experimentalColorGradientControl,{label:(0,b.__)("Color","snow-monkey-editor"),colorValue:r,onColorChange:o,...n,__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},ne=({name:e,value:t,onChange:o,onClose:n,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:"firstElement",anchor:a,onClose:n,className:"sme-popover sme-popover--inline-background-color components-inline-color-popover",children:(0,h.jsx)(oe,{name:e,value:t,onChange:o})})},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:o,isActive:n,contentRef:s}=e,r=(0,C.useSelect)((e=>{var t;return null!==(t=e(d.store).getSettings()?.colors)&&void 0!==t?t:[]}),[]),a=(0,y.useMemo)((()=>te(se,t,r)),[t,r]),[i,l]=(0,y.useState)(!1),c=(0,y.useCallback)((()=>{l(!0)}),[l]),m=(0,y.useCallback)((()=>{l(!1)}),[l]);return(0,y.useEffect)((()=>{m()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:n?"sme-bg-color":void 0,title:re,style:{color:a},className:N()("sme-toolbar-button",{"is-pressed":!!n}),onClick:c,icon:(0,h.jsx)(g.Icon,{icon:"tag"})},n?"sme-bg-color":"sme-bg-color-not-active"),i&&(0,h.jsx)(ne,{name:se,value:t,onChange:e=>{if(e){const n=(0,d.getColorObjectByColorValue)(r,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)),m()},contentRef:s,settings:{...ae,isActive:n},onClose:m})]})}};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=(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),s=(0,y.useMemo)((()=>ue(e,t)),[e,t,n?.colors]);return(0,h.jsx)(d.__experimentalColorGradientControl,{label:(0,b.__)("Color","snow-monkey-editor"),colorValue:s,onColorChange:o,...n,__experimentalHasMultipleOrigins:!0,__experimentalIsRenderedInSidebar:!0})},ge=({name:e,value:t,onChange:o,onClose:n,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:"firstElement",anchor:a,onClose:n,className:"sme-popover sme-popover--inline-color components-inline-color-popover",children:(0,h.jsx)(de,{name:e,value:t,onChange:o})})},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:o,isActive:n,contentRef:s}=e,r=(0,C.useSelect)((e=>{var t;return null!==(t=e(d.store).getSettings()?.colors)&&void 0!==t?t:[]}),[]),a=(0,y.useMemo)((()=>ue(pe,t)),[t,r]),[i,l]=(0,y.useState)(!1),c=(0,y.useCallback)((()=>{l(!0)}),[l]),m=(0,y.useCallback)((()=>{l(!1)}),[l]);return(0,y.useEffect)((()=>{m()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:n?"sme-highlighter":void 0,title:be,style:{color:a},className:N()("sme-toolbar-button",{"is-pressed":!!n}),onClick:c,icon:(0,h.jsx)(g.Icon,{icon:"tag"})},n?"sme-highlighter":"sme-highlighter-not-active"),i&&(0,h.jsx)(ge,{name:pe,value:t,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)),m())},contentRef:s,settings:{...he,isActive:n},onClose:m})]})}},ve="snow-monkey-editor/badge",fe=(0,b.__)("Badge","snow-monkey-editor"),xe={name:ve,title:fe,tagName:"span",className:"sme-badge",attributes:{style:"style",class:"class"},edit:e=>{const{value:t,onChange:o,isActive:n,contentRef:s}=e,r=(0,C.useSelect)((e=>{var t;return null!==(t=e(d.store).getSettings()?.colors)&&void 0!==t?t:[]}),[]),a=(0,y.useMemo)((()=>te(ve,t,r)),[t,r]),[i,l]=(0,y.useState)(!1),c=(0,y.useCallback)((()=>{l(!0)}),[l]),m=(0,y.useCallback)((()=>{l(!1)}),[l]);return(0,y.useEffect)((()=>{m()}),[t.start]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{name:n?"sme-badge":void 0,title:fe,style:{color:a},className:N()("sme-toolbar-button",{"is-pressed":!!n}),onClick:c,icon:(0,h.jsx)(g.Icon,{icon:"tag"})},n?"sme-badge":"sme-badge-not-active"),i&&(0,h.jsx)(ne,{name:ve,value:t,onChange:e=>{if(e){const n=(0,d.getColorObjectByColorValue)(r,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)),m()},contentRef:s,settings:{...xe,isActive:n},onClose:m})]})}},Ce="snow-monkey-editor/br",ye=(0,b.__)("Line break per screen size","snow-monkey-editor"),ke={type:Ce,innerHTML:"<br />"};function je({value:e,onChange:t,activeObjectAttributes:o,contentRef:n}){const s=e.replacements.slice()?.[e.start]?.attributes?.class,[r,a]=(0,y.useState)(!!s?.match(/sme-br--disable:desktop/)),[i,l]=(0,y.useState)(!!s?.match(/sme-br--disable:tablet/)),[c,m]=(0,y.useState)(!!s?.match(/sme-br--disable:mobile/)),u=(0,p.useAnchor)({editableContentElement:n.current,settings:we}),d=(0,y.useCallback)((n=>{a(!n);const s=e.replacements.slice();s[e.start]={...ke,attributes:{...o,class:N()({"sme-br--disable:desktop":!n,"sme-br--disable:tablet":i,"sme-br--disable:mobile":c})}},t({...e,replacements:s})}),[i,c]),v=(0,y.useCallback)((n=>{l(!n);const s=e.replacements.slice();s[e.start]={...ke,attributes:{...o,class:N()({"sme-br--disable:desktop":r,"sme-br--disable:tablet":!n,"sme-br--disable:mobile":c})}},t({...e,replacements:s})}),[r,c]),f=(0,y.useCallback)((n=>{m(!n);const s=e.replacements.slice();s[e.start]={...ke,attributes:{...o,class:N()({"sme-br--disable:desktop":r,"sme-br--disable:tablet":i,"sme-br--disable:mobile":!n})}},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:f,disabled:r&&i})]})})}const we={name:Ce,title:ye,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,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:ye,onClick:()=>{const n=(0,p.insertObject)(e,{...ke},e.end,e.end);n.start=n.end-1,t(n),o()}}),n&&(0,h.jsx)(je,{value:e,onChange:t,activeObjectAttributes:s,contentRef:r})]})}};x(e),x(t),x(n),x(s),x(r),x(a),x(i),x(l),x(c),x(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,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 Ae="snow-monkey-editor/preferences",Re=["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 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,Ne.getBlockType)(e.name)),Ee=(0,_e.createHigherOrderComponent)((e=>((0,C.dispatch)(Fe.store).setDefaults(Ae,{blockPresets:{}}),t=>{if(!Me(t))return(0,h.jsx)(e,{...t});const{name:o,attributes:n,setAttributes:s}=t,[r,a]=(0,y.useState)(void 0),[i,l]=(0,y.useState)(0),c=(0,C.useSelect)((e=>e(Fe.store).get(Ae,"blockPresets")),[]),m=c?.[o],u=(0,Ne.getBlockSupport)(o,"snowmonkeyeditor.blockPresets"),p=u?.ignore||[],v=({blockName:e,presetName:t,preset:o})=>(0,h.jsxs)("div",{className:"sme-editor-block-presets__preset",children:[(0,h.jsx)(g.Button,{onClick:()=>{const t=(0,Ne.getBlockType)(e),n={};Object.keys(t.attributes).forEach((e=>{n[e]=void 0})),Re.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,h.jsx)(g.Button,{label:(0,b.__)("Remove this preset","snow-monkey-editor"),onClick:()=>{const o={...c};delete o?.[e]?.[t],(0,C.dispatch)(Fe.store).set(Ae,"blockPresets",o),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 n=Object.keys(m)[t];return(0,h.jsx)(v,{blockName:o,presetName:n,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={...n};Re.forEach((t=>{delete e[t]})),p.forEach((t=>{delete e[t]}));const t={...c,[o]:{...m,[r]:{...e}}};(0,C.dispatch)(Fe.store).set(Ae,"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",Ee,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}}}}))})()})();
  • snow-monkey-editor/trunk/readme.txt

    r3374099 r3396826  
    55Requires at least: 6.8
    66Tested up to: 6.8
    7 Stable tag: 11.0.3
     7Stable tag: 11.0.4
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    194194== Changelog ==
    195195
     196= 11.0.4 =
     197* Fixed a bug where the clear button on the color picker for each format was not enabled.
     198* Fixed popovers for each format to close properly.
     199
    196200= 11.0.3 =
    197201* Fixed an issue where the formatting popover would not follow the page scroll.
  • snow-monkey-editor/trunk/snow-monkey-editor.php

    r3374099 r3396826  
    22/**
    33 * Plugin name: Snow Monkey Editor
    4  * Version: 11.0.3
     4 * Version: 11.0.4
    55 * Description: Extends gutenberg block editor
    66 * Author: inc2734
  • snow-monkey-editor/trunk/src/format/badge/editor.js

    r3374099 r3396826  
    6666            { isAddingColor && (
    6767                <InlineColorUI
     68                    name={ name }
    6869                    value={ value }
    6970                    onChange={ ( newValue ) => {
     
    9697                    contentRef={ contentRef }
    9798                    settings={ { ...settings, isActive } }
     99                    onClose={ closeModal }
    98100                />
    99101            ) }
  • snow-monkey-editor/trunk/src/format/bg-color/editor.js

    r3374099 r3396826  
    9797                    contentRef={ contentRef }
    9898                    settings={ { ...settings, isActive } }
     99                    onClose={ closeModal }
    99100                />
    100101            ) }
  • snow-monkey-editor/trunk/src/format/component/inline-background-color.js

    r3374099 r3396826  
    4141        useMultipleOriginColorsAndGradients();
    4242
     43    const colors = useMemo( () => {
     44        const origins = multipleOriginColorsAndGradients?.colors ?? [];
     45
     46        if ( Array.isArray( origins ) ) {
     47            return origins.reduce( ( acc, origin ) => {
     48                if ( Array.isArray( origin?.colors ) ) {
     49                    return [ ...acc, ...origin.colors ];
     50                }
     51
     52                if ( origin?.color ) {
     53                    return [ ...acc, origin ];
     54                }
     55
     56                return acc;
     57            }, [] );
     58        }
     59
     60        return origins;
     61    }, [ multipleOriginColorsAndGradients?.colors ] );
     62
    4363    const activeBackgroundColor = useMemo(
    44         () =>
    45             getActiveBackgroundColor(
    46                 name,
    47                 value,
    48                 multipleOriginColorsAndGradients?.colors
    49             ),
    50         [ name, value, multipleOriginColorsAndGradients?.colors ]
     64        () => getActiveBackgroundColor( name, value, colors ),
     65        [ name, value, colors ]
    5166    );
    5267
     
    6782    value,
    6883    onChange,
     84    onClose,
    6985    contentRef,
    7086    settings,
     
    7995            placement="bottom"
    8096            shift={ true }
    81             focusOnMount={ false }
     97            focusOnMount="firstElement"
    8298            anchor={ popoverAnchor }
     99            onClose={ onClose }
    83100            className="sme-popover sme-popover--inline-background-color components-inline-color-popover"
    84101        >
  • snow-monkey-editor/trunk/src/format/component/inline-color.js

    r3374099 r3396826  
    3535        useMultipleOriginColorsAndGradients();
    3636
     37    const colors = useMemo( () => {
     38        const origins = multipleOriginColorsAndGradients?.colors ?? [];
     39
     40        if ( Array.isArray( origins ) ) {
     41            return origins.reduce( ( acc, origin ) => {
     42                if ( Array.isArray( origin?.colors ) ) {
     43                    return [ ...acc, ...origin.colors ];
     44                }
     45
     46                if ( origin?.color ) {
     47                    return [ ...acc, origin ];
     48                }
     49
     50                return acc;
     51            }, [] );
     52        }
     53
     54        return origins;
     55    }, [ multipleOriginColorsAndGradients?.colors ] );
     56
    3757    const activeColor = useMemo(
    38         () =>
    39             getActiveColor(
    40                 name,
    41                 value,
    42                 multipleOriginColorsAndGradients?.colors
    43             ),
    44         [ name, value, multipleOriginColorsAndGradients?.colors ]
     58        () => getActiveColor( name, value, colors ),
     59        [ name, value, colors ]
    4560    );
    4661
     
    5772};
    5873
    59 const InlineColorUI = ( { name, value, onChange, contentRef, settings } ) => {
     74const InlineColorUI = ( {
     75    name,
     76    value,
     77    onChange,
     78    onClose,
     79    contentRef,
     80    settings,
     81} ) => {
    6082    const popoverAnchor = useAnchor( {
    6183        editableContentElement: contentRef.current,
     
    6789            placement="bottom"
    6890            shift={ true }
    69             focusOnMount={ false }
     91            focusOnMount="firstElement"
    7092            anchor={ popoverAnchor }
     93            onClose={ onClose }
    7194            className="sme-popover sme-popover--inline-color components-inline-color-popover"
    7295        >
  • snow-monkey-editor/trunk/src/format/component/inline-font-size.js

    r3374099 r3396826  
    7979    onChange,
    8080    onReset,
     81    onClose,
    8182    contentRef,
    8283    settings,
     
    9192            placement="bottom"
    9293            shift={ true }
    93             focusOnMount={ false }
     94            focusOnMount="firstElement"
    9495            anchor={ popoverAnchor }
     96            onClose={ onClose }
    9597            className="sme-popover sme-popover--inline-font-size components-inline-color-popover"
    9698        >
  • snow-monkey-editor/trunk/src/format/component/inline-gradient.js

    r3374099 r3396826  
    5050        useMultipleOriginColorsAndGradients();
    5151
     52    const gradients = useMemo( () => {
     53        const origins = multipleOriginColorsAndGradients?.gradients ?? [];
     54
     55        if ( Array.isArray( origins ) ) {
     56            return origins.reduce( ( acc, origin ) => {
     57                if ( Array.isArray( origin?.gradients ) ) {
     58                    return [ ...acc, ...origin.gradients ];
     59                }
     60
     61                if ( origin?.gradient ) {
     62                    return [ ...acc, origin ];
     63                }
     64
     65                return acc;
     66            }, [] );
     67        }
     68
     69        return origins;
     70    }, [ multipleOriginColorsAndGradients?.gradients ] );
     71
    5272    const activeGradient = useMemo(
    53         () =>
    54             getActiveGradient(
    55                 name,
    56                 value,
    57                 multipleOriginColorsAndGradients?.gradients
    58             ),
    59         [ name, value, multipleOriginColorsAndGradients?.gradients ]
     73        () => getActiveGradient( name, value, gradients ),
     74        [ name, value, gradients ]
    6075    );
    6176
     
    7691    value,
    7792    onChange,
     93    onClose,
    7894    contentRef,
    7995    settings,
     
    88104            placement="bottom"
    89105            shift={ true }
    90             focusOnMount={ false }
     106            focusOnMount="firstElement"
    91107            anchor={ popoverAnchor }
     108            onClose={ onClose }
    92109            className="sme-popover sme-popover--inline-gradient components-inline-gradient-popover"
    93110        >
  • snow-monkey-editor/trunk/src/format/component/inline-highlighter.js

    r3374099 r3396826  
    6161};
    6262
    63 const InlineColorUI = ( { name, value, onChange, contentRef, settings } ) => {
     63const InlineColorUI = ( {
     64    name,
     65    value,
     66    onChange,
     67    onClose,
     68    contentRef,
     69    settings,
     70} ) => {
    6471    const popoverAnchor = useAnchor( {
    6572        editableContentElement: contentRef.current,
     
    7178            placement="bottom"
    7279            shift={ true }
    73             focusOnMount={ false }
     80            focusOnMount="firstElement"
    7481            anchor={ popoverAnchor }
     82            onClose={ onClose }
    7583            className="sme-popover sme-popover--inline-color components-inline-color-popover"
    7684        >
  • snow-monkey-editor/trunk/src/format/component/inline-letter-spacing.js

    r3374099 r3396826  
    6060    onChange,
    6161    onReset,
     62    onClose,
    6263    contentRef,
    6364    settings,
     
    7273            placement="bottom"
    7374            shift={ true }
    74             focusOnMount={ false }
     75            focusOnMount="firstElement"
    7576            anchor={ popoverAnchor }
     77            onClose={ onClose }
    7678            className="sme-popover sme-popover--inline-letter-spacing components-inline-color-popover"
    7779        >
  • snow-monkey-editor/trunk/src/format/component/inline-line-height.js

    r3374099 r3396826  
    5555    onChange,
    5656    onReset,
     57    onClose,
    5758    contentRef,
    5859    settings,
     
    6768            placement="bottom"
    6869            shift={ true }
    69             focusOnMount={ false }
     70            focusOnMount="firstElement"
    7071            anchor={ popoverAnchor }
     72            onClose={ onClose }
    7173            className="sme-popover sme-popover--inline-line-height components-inline-color-popover"
    7274        >
  • snow-monkey-editor/trunk/src/format/font-size/editor.js

    r3374099 r3396826  
    9494                    contentRef={ contentRef }
    9595                    settings={ { ...settings, isActive } }
     96                    onClose={ closeModal }
    9697                />
    9798            ) }
  • snow-monkey-editor/trunk/src/format/highlighter/editor.js

    r3374099 r3396826  
    8787                    contentRef={ contentRef }
    8888                    settings={ { ...settings, isActive } }
     89                    onClose={ closeModal }
    8990                />
    9091            ) }
  • snow-monkey-editor/trunk/src/format/letter-spacing/editor.js

    r3374099 r3396826  
    6868                    contentRef={ contentRef }
    6969                    settings={ { ...settings, isActive } }
     70                    onClose={ closeModal }
    7071                />
    7172            ) }
  • snow-monkey-editor/trunk/src/format/line-height/editor.js

    r3374099 r3396826  
    6565                    contentRef={ contentRef }
    6666                    settings={ { ...settings, isActive } }
     67                    onClose={ closeModal }
    6768                />
    6869            ) }
  • snow-monkey-editor/trunk/src/format/text-color/editor.js

    r3374099 r3396826  
    9999                    contentRef={ contentRef }
    100100                    settings={ { ...settings, isActive } }
     101                    onClose={ closeModal }
    101102                />
    102103            ) }
  • snow-monkey-editor/trunk/src/format/text-gradient/editor.js

    r3374099 r3396826  
    103103                    contentRef={ contentRef }
    104104                    settings={ { ...settings, isActive } }
     105                    onClose={ closeModal }
    105106                />
    106107            ) }
  • snow-monkey-editor/trunk/vendor/composer/autoload_static.php

    r3254519 r3396826  
    88{
    99    public static $prefixLengthsPsr4 = array (
    10         'S' => 
     10        'S' =>
    1111        array (
    1212            'Snow_Monkey\\Plugin\\Editor\\' => 26,
     
    1515
    1616    public static $prefixDirsPsr4 = array (
    17         'Snow_Monkey\\Plugin\\Editor\\' => 
     17        'Snow_Monkey\\Plugin\\Editor\\' =>
    1818        array (
    1919            0 => __DIR__ . '/../..' . '/',
Note: See TracChangeset for help on using the changeset viewer.