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