| 1 |
!function(){"use strict";var e=window.wp.escapeHtml;const t=wp.element.createElement,o={};o.spspIcon=t("img",{src:(0,e.escapeAttribute)(smartPostShowGbScript.url+"admin/GutenbergBlock/src/smart-post-show-icon.svg")});var s=o,r=window.wp.element,a=window.wp.i18n;const c=wp.element.createElement;var l=t=>{let{attributes:{shortcode:o},shortCodeList:s,shortcodeUpdate:l}=t;return(0,r.createElement)(r.Fragment,null,c("div",{className:"spsp-gutenberg-shortcode editor-styles-wrapper"},c("select",{className:"spsp-shortcode-selector",onChange:e=>l(e),value:(0,e.escapeAttribute)(o)},c("option",{value:(0,e.escapeAttribute)("0")},(0,e.escapeHTML)((0,a.__)("-- Select a Show --","post-carousel"))),s.map((t=>{var o=t.title.length>35?t.title.substring(0,30)+".... #("+t.id+")":t.title+" #("+t.id+")";return c("option",{value:(0,e.escapeAttribute)(t.id.toString()),key:(0,e.escapeAttribute)(t.id.toString())},(0,e.escapeHTML)(o))})))))},n=window.wp.blocks,p=window.wp.components,i=window.wp.blockEditor;const m=wp.serverSideRender,d=r.createElement;(0,n.registerBlockType)("smart-post-show-pro/shortcode",{title:(0,e.escapeHTML)((0,a.__)("Smart Post Show","post-carousel")),description:(0,e.escapeHTML)((0,a.__)("Use Smart Post Show to insert a show in your page","post-carousel")),icon:s.spspIcon,category:"common",supports:{html:!0},edit:t=>{const{attributes:o,setAttributes:s}=t,c=smartPostShowGbScript.shortCodeList;let n=e=>{let t=!1,o=setInterval((function(){let s=jQuery("#pcp_wrapper-"+e).parents().attr("id");document.getElementById(s)&&(jQuery("#pcp_wrapper-"+e+" #pcp-preloader").css({opacity:0,display:"none"}),jQuery("#pcp_wrapper-"+e+" #pcp-preloader").animate({opacity:1},600),jQuery.getScript(smartPostShowGbScript.loadScript),t=!0,s=""),t&&clearInterval(o),0==e&&clearInterval(o)}),10)},u=t=>{var o;o=t,s({shortcode:(0,e.escapeAttribute)(o.target.value)});let r=(0,e.escapeAttribute)(t.target.value);n(r)};return document.addEventListener("readystatechange",(t=>{if("complete"===t.target.readyState){let t=(0,e.escapeAttribute)(o.shortcode);n(t)}})),o.preview?d("div",{className:"spsp_shortcode_block_preview_image"},d("img",{src:(0,e.escapeAttribute)(smartPostShowGbScript.url+"admin/GutenbergBlock/src/smart-post-show-block-preview.svg")})):0===c.length?(0,r.createElement)(r.Fragment,null,d("div",{className:"components-placeholder components-placeholder is-large"},d("div",{className:"components-placeholder__label"},d("img",{className:"block-editor-block-icon",src:(0,e.escapeAttribute)(smartPostShowGbScript.url+"admin/GutenbergBlock/src/smart-post-show-icon.svg")}),(0,e.escapeHTML)((0,a.__)("Smart Post Show","post-carousel"))),d("div",{className:"components-placeholder__instructions"},(0,e.escapeHTML)((0,a.__)("No shortcode found. ","post-carousel")),d("a",{href:(0,e.escapeAttribute)(smartPostShowGbScript.link)},(0,e.escapeHTML)((0,a.__)("Create a shortcode now!","post-carousel")))))):o.shortcode&&0!=o.shortcode?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.InspectorControls,null,(0,r.createElement)(p.PanelBody,{title:"Select a Show"},(0,r.createElement)(p.PanelRow,null,(0,r.createElement)(l,{attributes:o,shortCodeList:c,shortcodeUpdate:u})))),(0,r.createElement)(m,{block:"smart-post-show-pro/shortcode",attributes:o})):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(i.InspectorControls,null,(0,r.createElement)(p.PanelBody,{title:"Select a Show"},(0,r.createElement)(p.PanelRow,null,(0,r.createElement)(l,{attributes:o,shortCodeList:c,shortcodeUpdate:u})))),d("div",{className:"components-placeholder components-placeholder is-large"},d("div",{className:"components-placeholder__label"},d("img",{className:"block-editor-block-icon",src:(0,e.escapeAttribute)(smartPostShowGbScript.url+"admin/GutenbergBlock/src/smart-post-show-icon.svg")}),(0,e.escapeHTML)((0,a.__)("Smart Post Show","post-carousel"))),d("div",{className:"components-placeholder__instructions"},(0,e.escapeHTML)((0,a.__)("Select a Show","post-carousel"))),(0,r.createElement)(l,{attributes:o,shortCodeList:c,shortcodeUpdate:u})))},save:()=>null})}(); |