wp_back/wp-content/plugins/visual-portfolio/build/gutenberg/layouts-editor.js

1 line
8.8 KiB
JavaScript
Raw Normal View History

2024-05-20 15:37:46 +03:00
!function(){"use strict";var t,e={7366:function(t,e,o){var r={};o.r(r),o.d(r,{apiFetch:function(){return l},setBlockData:function(){return s},updateBlockData:function(){return c}});var n={};o.r(n),o.d(n,{API_FETCH:function(){return d}});var a={};o.r(a),o.d(a,{getBlockData:function(){return v}});var i=window.wp.data;function l(t){return{type:"API_FETCH",request:t}}function s(t){return{type:"SET_BLOCK_DATA",data:t}}function c(t){return{type:"UPDATE_BLOCK_DATA",data:t}}const{apiFetch:u}=wp;function d({request:t}){return u(t).then((t=>!!(t&&t.success&&t.response)&&t.response))}const{VPSavedLayoutVariables:p}=window;const{VPSavedLayoutVariables:f}=window;function v(t){return t.data||f.data}const h=(0,i.createReduxStore)("visual-portfolio/saved-layout-data",{reducer:function(t={data:p.data},e={}){switch(e.type){case"SET_BLOCK_DATA":if(e.data)return t?{...t,data:e.data}:e;break;case"UPDATE_BLOCK_DATA":if(e.data&&t)return{...t,data:{...t.data,...e.data}}}return t},selectors:a,actions:r,controls:n});(0,i.register)(h);var m=window.wp.element,k=window.wp.blockEditor,g=window.wp.blocks,w=window.wp.components,E=window.wp.hooks,y=window.wp.i18n;const{navigator:_}=window;let b;function S(t){const[e,o]=(0,m.useState)(!1);return(0,m.createElement)("div",{className:"vpf-layout-shortcode-copy"},(0,m.createElement)("strong",null,t.label,":"),(0,m.createElement)("div",null,(0,m.createElement)("pre",null,t.content),(0,m.createElement)(w.Button,{isSmall:!0,onClick:()=>{_.clipboard.writeText(t.content).then((()=>{o(!0),clearTimeout(b),b=setTimeout((()=>{o(!1)}),450)}))}},(0,m.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},(0,m.createElement)("path",{d:"M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"}),(0,m.createElement)("path",{d:"M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"})),e?(0,m.createElement)("div",{className:"vpf-layout-shortcode-copied"},(0,y.__)("Copied!","visual-portfolio")):null)))}(0,g.registerBlockType)("visual-portfolio/saved-editor",{icon:{foreground:"#2540CC",src:(0,m.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,m.createElement)("mask",{id:"mask0","mask-type":"alpha",maskUnits:"userSpaceOnUse",x:"9",y:"8",width:"5",height:"6"},(0,m.createElement)("path",{d:"M11.1409 14L13.0565 8.49994H11.2789L9.55397 14H11.1409Z",fill:"url(#paint0_linear)"})),(0,m.createElement)("g",{mask:"url(#mask0)"},(0,m.createElement)("path",{d:"M11.1409 14L13.0565 8.49994H11.2789L9.55397 14H11.1409Z",fill:"currentColor"})),(0,m.createElement)("path",{d:"M8.90795 14L6.9923 8.49994H8.76989L10.4948 14H8.90795Z",fill:"currentColor"}),(0,m.createElement)("path",{d:"M19 16.2222C19 16.6937 18.8104 17.1459 18.4728 17.4793C18.1352 17.8127 17.6774 18 17.2 18H2.8C2.32261 18 1.86477 17.8127 1.52721 17.4793C1.18964 17.1459 1 16.6937 1 16.2222V3.77778C1 3.30628 1.18964 2.8541 1.52721 2.5207C1.86477 2.1873 2.32261 2 2.8 2H7.3L9.1 4.66667H17.2C17.6774 4.66667 18.1352 4.85397 18.4728 5.18737C18.8104 5.52076 19 5.97295 19 6.44444V16.2222Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}),(0,m.createElement)("defs",null,(0,m.createElement)("linearGradient",{id:"paint0_linear",x1:"12.191",y1:"8.49994",x2:"7.44436",y2:"15.1301",gradientUnits:"userSpaceOnUse"},(0,m.createElement)("stop",null),(0,m.createElement)("stop",{offset:"1",stopOpacity:"0"}))))},edit:function(t){const{clientId:e}=t,[o,r]=(0,m.useState)(!1),{postId:n,blockData:a,VisualPortfolioBlockEdit:l}=(0,i.useSelect)((t=>{const{getBlockData:e}=t("visual-portfolio/saved-layout-data"),{getCurrentPostId:o}=t("core/editor"),{getBlockType:r}=t("core/blocks");return{postId:o(),blockData:e(),VisualPortfolioBlockEdit:r("visual-portfolio/block")?.edit||(()=>null)}})),{updateBlockData:s}