%PDF- %PDF-
Direktori : /var/www/projetos/romanian.ongrace.com/wp-content/plugins/otter-blocks/build/css/ |
Current File : /var/www/projetos/romanian.ongrace.com/wp-content/plugins/otter-blocks/build/css/index.js |
!function(){"use strict";var e=window.wp.element,t=window.lodash,s=window.wp.i18n,l=window.wp.blocks,n=window.wp.blockEditor,o=window.wp.components,r=window.wp.compose,c=window.wp.data,i=window.wp.hooks;let a=null;window.otterCSSLintIgnored=[];var u=(0,e.memo)((t=>{let{attributes:l,setAttributes:n,clientId:r}=t;const c=(0,e.useRef)(null),[i,u]=(0,e.useState)([]),[d,m]=(0,e.useState)(null),[p,w]=(0,e.useState)(null),S=()=>{const e=r.substr(0,8);return(null==d?void 0:d.replace(/\s+/g,""))==="selector {\n}\n".replace(/\s+/g,"")?l.className:l.className?l.className.includes("ticss-")?l.className:[...l.className.split(" "),`ticss-${e}`].join(" "):`ticss-${e}`},b=function(e){var t,s,l,n,o,r,c;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=null==e||null===(t=e.state)||void 0===t||null===(s=t.lint)||void 0===s||null===(l=s.marked)||void 0===l||null===(n=l.filter((e=>{let{__annotation:t}=e;return"error"===(null==t?void 0:t.severity)})))||void 0===n?void 0:n.map((e=>{let{__annotation:t}=e;return null==t?void 0:t.message}));i&&0<(null===(o=a)||void 0===o?void 0:o.length)&&(window.otterCSSLintIgnored=a),a=null===(r=a)||void 0===r?void 0:r.filter((e=>!window.otterCSSLintIgnored.includes(e))),u(a),!i&&0<(null===(c=a)||void 0===c?void 0:c.length)||w(null==e?void 0:e.getValue())};return(0,e.useEffect)((()=>{var e;const t=l.customCSS&&null!==(e=l.className)&&void 0!==e&&e.includes("ticss-")?l.className.split(" ").find((e=>e.includes("ticss"))):null;let s="selector {\n}\n";if(l.customCSS){const e=new RegExp("."+t,"g");s=l.customCSS.replace(e,"selector")}c.current=wp.CodeMirror(document.getElementById("o-css-editor"),{value:s,autoCloseBrackets:!0,continueComments:!0,lineNumbers:!0,lineWrapping:!0,matchBrackets:!0,lint:!0,gutters:["CodeMirror-lint-markers"],styleActiveLine:!0,styleActiveSelected:!0,mode:"css",extraKeys:{"Ctrl-Space":"autocomplete","Alt-F":"findPersistent","Cmd-F":"findPersistent"}}),c.current.on("change",(()=>{clearTimeout(a),a=setTimeout((()=>{b(c.current)}),500)}))}),[]),(0,e.useEffect)((()=>{const e=new RegExp("selector","g");m(null==p?void 0:p.replace(e,`.${S().split(" ").find((e=>e.includes("ticss")))}`))}),[p]),(0,e.useEffect)((()=>{"selector {\n}\n".replace(/\s+/g,"")!==(null==d?void 0:d.replace(/\s+/g,""))?d&&n({customCSS:d}):n({customCSS:null})}),[d]),(0,e.useEffect)((()=>{n({hasCustomCSS:!0,className:S()})}),[l]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("p",null,(0,s.__)("Add your custom CSS.","otter-blocks")),(0,e.createElement)("div",{id:"o-css-editor",className:"o-css-editor"}),0<(null==i?void 0:i.length)&&(0,e.createElement)("div",{className:"o-css-errors"},(0,e.createElement)(o.Notice,{status:"error",isDismissible:!1},(0,s.__)("Attention needed! We found following errors with your code:","otter-blocks")),(0,e.createElement)("pre",null,(0,e.createElement)("ul",null,i.map(((t,s)=>(0,e.createElement)("li",{key:s},t))))),(0,e.createElement)(o.Button,{variant:"secondary",onClick:()=>b(c.current,!0),style:{width:"max-content",marginBottom:"20px"}},(0,s.__)("Override","otter-blocks"))),(0,e.createElement)("p",null,(0,s.__)("Use","otter-blocks")," ",(0,e.createElement)("code",null,"selector")," ",(0,s.__)("to target block wrapper.","otter-blocks")),(0,e.createElement)("br",null),(0,e.createElement)("p",null,(0,s.__)("Example:","otter-blocks")),(0,e.createElement)("pre",{className:"o-css-editor-help"},"selector {\n background: #000;\n}\n\nselector img {\n border-radius: 100%;\n}"),(0,e.createElement)("p",null,(0,s.__)("You can also use other CSS syntax here, such as media queries.","otter-blocks")))}));let d=[];(0,c.subscribe)((()=>{const{getBlocks:e}=(0,c.select)("core/block-editor"),s=e(),n=(0,c.select)("core").getEntityRecords("postType","wp_block");if(!(0,t.isEqual)(d,s)){d=s;const e=((e,s)=>{if(!e)return"";const n=e=>{const t=[];if("core/block"===e.name&&null!==s){const o=s.find((t=>e.attributes.ref===t.id));if(o&&o.content){const e=o.content.hasOwnProperty("raw")?o.content.raw:o.content;t.push((0,l.parse)(e).map((e=>[e,n(e)])))}}return void 0!==e.innerBlocks&&0<e.innerBlocks.length&&t.push(e.innerBlocks.map((e=>[e,n(e)]))),t},o=e.map((e=>[e,n(e)]));return(0,t.flattenDeep)(o).map((e=>e.attributes&&e.attributes.hasCustomCSS&&e.attributes.customCSS&&null!==e.attributes.customCSS?e.attributes.customCSS+"\n":"")).reduce(((e,t)=>e+t),"")})(s,n);e&&(e=>{let t=document.getElementById("o-css-editor-styles");null===t&&(t=document.createElement("style"),t.setAttribute("type","text/css"),t.setAttribute("id","o-css-editor-styles"),document.getElementsByTagName("head")[0].appendChild(t)),t.textContent===e||(t.textContent=e)})(e)}}));const m=(0,r.createHigherOrderComponent)((t=>r=>(0,l.hasBlockSupport)(r.name,"customClassName",!0)&&r.isSelected?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(t,r),(0,e.createElement)(n.InspectorControls,null,(0,e.createElement)(o.PanelBody,{title:(0,s.__)("Custom CSS","otter-blocks"),initialOpen:!1},(0,e.createElement)(u,{clientId:r.clientId,setAttributes:r.setAttributes,attributes:r.attributes}),(0,i.applyFilters)("otter.poweredBy","")))):(0,e.createElement)(t,r)),"withInspectorControl");(0,c.select)("core/edit-site")||((0,i.addFilter)("blocks.registerBlockType","themeisle-custom-css/attribute",(e=>((0,l.hasBlockSupport)(e,"customClassName",!0)&&(e.attributes=(0,t.assign)(e.attributes,{hasCustomCSS:{type:"boolean",default:!1},customCSS:{type:"string",default:null}})),e))),(0,i.addFilter)("editor.BlockEdit","themeisle-custom-css/with-inspector-controls",m))}();