mirror of
https://github.com/proelements/proelements.git
synced 2026-04-22 19:52:16 +00:00
1 line
2.2 KiB
JavaScript
1 line
2.2 KiB
JavaScript
!function(){"use strict";var e=window.elementorV2.editorCanvas,t=window.elementorV2.editorControlsExtended,n=window.elementorV2.editorEditingPanel,o=window.elementorV2.editorProps,i=window.React,s=window.wp.i18n,r=window.elementorV2.editorControls,a=window.elementorV2.ui;const l=({children:e})=>i.createElement(r.ControlAdornmentsProvider,{items:[{id:"custom-css-indicator",Adornment:n.CustomCssIndicator}]},e),d=()=>{const{id:e,meta:o}=(0,n.useStyle)(),{customCss:d,setCustomCss:c}=(0,n.useCustomCss)(),m=`${o.breakpoint||"desktop"}-${o.state||"default"}-${e}`,[u,w]=(0,i.useState)({}),[p,C]=(0,i.useState)(!0);(0,i.useEffect)((()=>{u[m]||w((e=>({...e,[m]:{value:d?.raw||"",isValid:!0}})))}),[m]),(0,i.useEffect)((()=>{(async()=>{const e=await(0,t.getIsLicenseExpired)(!0);C(!e)})()}),[]);const y=(0,i.useMemo)((()=>u[m]||{value:d?.raw||"",isValid:!0}),[u,m,d?.raw]),E=(0,i.useMemo)((()=>{if(!o.breakpoint||"desktop"===o.breakpoint)return{rules:{mediaQuery:!1}}}),[o.breakpoint]);return i.createElement(n.SectionContent,{gap:1},i.createElement(l,null,i.createElement(a.Stack,{direction:"row",alignItems:"center",gap:1},i.createElement(r.ControlFormLabel,null,(0,s.__)("CSS code","elementor-pro")),i.createElement(r.ControlAdornments,null))),i.createElement(t.CssEditor,{value:y.value,onChange:(e,t)=>{w((n=>({...n,[m]:{value:e,isValid:t}}))),t&&c(e,{history:{propDisplayName:"Custom CSS"}})},syntaxRuleOptions:E,readOnly:!p}))},c=()=>i.createElement(n.StyleTabSection,{section:{component:d,name:"Custom CSS",title:(0,s.__)("Custom CSS","elementor-pro")},fields:["custom_css"],unmountOnExit:!1}),m=(0,e.createTransformer)((e=>e.map((e=>e.key&&e.value?`${e.key}="${e.value}"`:"")).join(" ")));(async()=>{await async function(){e.settingsTransformersRegistry.register("attributes",m),n.controlsRegistry.register("attributes",t.AttributesControl,"full",o.keyValuePropTypeUtil),await(0,t.licenseApi)("atomic-custom-css")&&(0,n.injectIntoStyleTab)({id:"custom-css",component:c,options:{overwrite:!0}}),n.controlsRegistry.register("display-conditions",t.DisplayConditionsControl,"two-columns",t.displayConditionsPropTypeUtil)}()})(),(window.elementorV2=window.elementorV2||{}).editorEditingPanelExtended={}}(),window.elementorV2.editorEditingPanelExtended?.init?.(); |