diff --git a/build/blocks/icon/index.asset.php b/build/blocks/icon/index.asset.php index 290f051bd..ae3aaff65 100644 --- a/build/blocks/icon/index.asset.php +++ b/build/blocks/icon/index.asset.php @@ -1 +1 @@ - array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '1b4ece6e84f08bd51024'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'bde5c36600fbb0593248'); diff --git a/build/blocks/icon/index.js b/build/blocks/icon/index.js index da726fe0f..2a6a79b01 100644 --- a/build/blocks/icon/index.js +++ b/build/blocks/icon/index.js @@ -1 +1 @@ -(()=>{"use strict";var e,t={8166:()=>{const e=window.wp.blocks,t=window.wp.blockEditor,r=window.wp.components,s=window.wp.i18n,n=window.wp.element,a=window.ReactJSXRuntime,i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"gatherpress/icon","version":"1.0.0","title":"Icon","category":"gatherpress","icon":"format-image","example":{},"description":"Adds customizable icons to visually enhance your content.","attributes":{"icon":{"type":"string","default":"nametag"},"iconColor":{"type":"string","default":""},"iconSize":{"type":"number","default":24}},"supports":{"align":["left","center","right"],"anchor":true,"html":false,"spacing":{"margin":true},"shadow":{"__experimentalSkipSerialization":true}},"textdomain":"gatherpress","editorScript":"file:./index.js","style":"file:./style-index.css","render":"file:./render.php"}');(0,e.registerBlockType)(i,{edit:({attributes:e,setAttributes:i})=>{const o=(0,t.useBlockProps)(),{icon:l,iconColor:c,iconSize:p}=e,[h,u]=(0,n.useState)(""),g=`${function(){if("object"==typeof GatherPress)return"urls.pluginUrl".split(".").reduce(((e,t)=>e&&e[t]),GatherPress)}()}assets/svg/`,d=[{label:(0,s.__)("Calendar","gatherpress"),value:"calendar"},{label:(0,s.__)("Dismiss","gatherpress"),value:"dismiss"},{label:(0,s.__)("Editor Help","gatherpress"),value:"editor-help"},{label:(0,s.__)("Location","gatherpress"),value:"location"},{label:(0,s.__)("Nametag","gatherpress"),value:"nametag"},{label:(0,s.__)("Yes Alt","gatherpress"),value:"yes-alt"}];return(0,n.useEffect)((()=>{l&&fetch(`${g}${l}.svg`).then((e=>e.text())).then((e=>u(e))).catch((()=>u(`${(0,s.__)("SVG Error","gatherpress")}`)))}),[l,g]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.InspectorControls,{children:(0,a.jsxs)(r.PanelBody,{title:(0,s.__)("Icon Settings","gatherpress"),children:[(0,a.jsx)(r.SelectControl,{label:(0,s.__)("Icon","gatherpress"),value:l,options:d,onChange:e=>i({icon:e})}),(0,a.jsx)(r.ColorPalette,{label:(0,s.__)("Color","gatherpress"),value:c,clearable:!0,onChange:e=>i({iconColor:e})}),(0,a.jsx)(r.RangeControl,{label:(0,s.__)("Size","gatherpress"),value:p,onChange:e=>i({iconSize:e}),min:8,max:240,initialPosition:24})]})}),(0,a.jsx)("div",{...o,children:(0,a.jsx)("div",{style:{fill:c||"inherit",width:`${p}px`,height:`${p}px`,lineHeight:0},dangerouslySetInnerHTML:{__html:h}})})]})},save:()=>null})}},r={};function s(e){var n=r[e];if(void 0!==n)return n.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,s),a.exports}s.m=t,e=[],s.O=(t,r,n,a)=>{if(!r){var i=1/0;for(p=0;p=a)&&Object.keys(s.O).every((e=>s.O[e](r[l])))?r.splice(l--,1):(o=!1,a0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[r,n,a]},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={22:0,690:0};s.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,i=r[0],o=r[1],l=r[2],c=0;if(i.some((t=>0!==e[t]))){for(n in o)s.o(o,n)&&(s.m[n]=o[n]);if(l)var p=l(s)}for(t&&t(r);cs(8166)));n=s.O(n)})(); \ No newline at end of file +(()=>{"use strict";var e,t={8166:()=>{const e=window.wp.blocks,t=window.wp.blockEditor,r=window.wp.components,s=window.wp.i18n,n=window.wp.element,a=window.ReactJSXRuntime,i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"gatherpress/icon","version":"1.0.0","title":"Icon","category":"gatherpress","icon":"format-image","example":{},"description":"Adds customizable icons to visually enhance your content.","attributes":{"icon":{"type":"string","default":"nametag"},"iconColor":{"type":"string","default":""},"iconSize":{"type":"number","default":24}},"supports":{"align":["left","center","right"],"anchor":true,"html":false,"spacing":{"margin":true},"shadow":{"__experimentalSkipSerialization":true}},"textdomain":"gatherpress","editorScript":"file:./index.js","style":"file:./style-index.css","render":"file:./render.php"}');(0,e.registerBlockType)(i,{edit:({attributes:e,setAttributes:i})=>{const o=(0,t.useBlockProps)(),{icon:l,iconColor:c,iconSize:p}=e,[h,u]=(0,n.useState)(""),g=`${function(){if("object"==typeof GatherPress)return"urls.pluginUrl".split(".").reduce(((e,t)=>e&&e[t]),GatherPress)}()}includes/assets/svg/`,d=[{label:(0,s.__)("Calendar","gatherpress"),value:"calendar"},{label:(0,s.__)("Dismiss","gatherpress"),value:"dismiss"},{label:(0,s.__)("Editor Help","gatherpress"),value:"editor-help"},{label:(0,s.__)("Location","gatherpress"),value:"location"},{label:(0,s.__)("Nametag","gatherpress"),value:"nametag"},{label:(0,s.__)("Yes Alt","gatherpress"),value:"yes-alt"}];return(0,n.useEffect)((()=>{l&&fetch(`${g}${l}.svg`).then((e=>e.text())).then((e=>u(e))).catch((()=>u(`${(0,s.__)("SVG Error","gatherpress")}`)))}),[l,g]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.InspectorControls,{children:(0,a.jsxs)(r.PanelBody,{title:(0,s.__)("Icon Settings","gatherpress"),children:[(0,a.jsx)(r.SelectControl,{label:(0,s.__)("Icon","gatherpress"),value:l,options:d,onChange:e=>i({icon:e})}),(0,a.jsx)(r.ColorPalette,{label:(0,s.__)("Color","gatherpress"),value:c,clearable:!0,onChange:e=>i({iconColor:e})}),(0,a.jsx)(r.RangeControl,{label:(0,s.__)("Size","gatherpress"),value:p,onChange:e=>i({iconSize:e}),min:8,max:240,initialPosition:24})]})}),(0,a.jsx)("div",{...o,children:(0,a.jsx)("div",{style:{fill:c||"inherit",width:`${p}px`,height:`${p}px`,lineHeight:0},dangerouslySetInnerHTML:{__html:h}})})]})},save:()=>null})}},r={};function s(e){var n=r[e];if(void 0!==n)return n.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,s),a.exports}s.m=t,e=[],s.O=(t,r,n,a)=>{if(!r){var i=1/0;for(p=0;p=a)&&Object.keys(s.O).every((e=>s.O[e](r[l])))?r.splice(l--,1):(o=!1,a0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[r,n,a]},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={22:0,690:0};s.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,i=r[0],o=r[1],l=r[2],c=0;if(i.some((t=>0!==e[t]))){for(n in o)s.o(o,n)&&(s.m[n]=o[n]);if(l)var p=l(s)}for(t&&t(r);cs(8166)));n=s.O(n)})(); \ No newline at end of file diff --git a/build/blocks/icon/render.php b/build/blocks/icon/render.php index 2542ff6f9..e5520838c 100644 --- a/build/blocks/icon/render.php +++ b/build/blocks/icon/render.php @@ -11,7 +11,7 @@ $gatherpress_icon = ! empty( $attributes['icon'] ) ? $attributes['icon'] : 'nametag'; $gatherpress_icon_color = ! empty( $attributes['iconColor'] ) ? $attributes['iconColor'] : 'inherit'; $gatherpress_icon_size = ! empty( $attributes['iconSize'] ) ? $attributes['iconSize'] : 20; -$gatherpress_svg_base_url = GATHERPRESS_CORE_URL . '/assets/svg/'; +$gatherpress_svg_base_url = GATHERPRESS_CORE_URL . '/includes/assets/svg/'; $gatherpress_svg_url = $gatherpress_svg_base_url . $gatherpress_icon . '.svg'; $gatherpress_svg_content = '' . esc_html__( 'SVG Error', 'gatherpress' ) . ''; $gatherpress_response = wp_safe_remote_get( $gatherpress_svg_url ); diff --git a/assets/svg/calendar.svg b/includes/assets/svg/calendar.svg similarity index 100% rename from assets/svg/calendar.svg rename to includes/assets/svg/calendar.svg diff --git a/assets/svg/dismiss.svg b/includes/assets/svg/dismiss.svg similarity index 100% rename from assets/svg/dismiss.svg rename to includes/assets/svg/dismiss.svg diff --git a/assets/svg/editor-help.svg b/includes/assets/svg/editor-help.svg similarity index 100% rename from assets/svg/editor-help.svg rename to includes/assets/svg/editor-help.svg diff --git a/assets/svg/location.svg b/includes/assets/svg/location.svg similarity index 100% rename from assets/svg/location.svg rename to includes/assets/svg/location.svg diff --git a/assets/svg/nametag.svg b/includes/assets/svg/nametag.svg similarity index 100% rename from assets/svg/nametag.svg rename to includes/assets/svg/nametag.svg diff --git a/assets/svg/yes-alt.svg b/includes/assets/svg/yes-alt.svg similarity index 100% rename from assets/svg/yes-alt.svg rename to includes/assets/svg/yes-alt.svg diff --git a/src/blocks/icon/edit.js b/src/blocks/icon/edit.js index 084b57d54..e580ce794 100644 --- a/src/blocks/icon/edit.js +++ b/src/blocks/icon/edit.js @@ -17,7 +17,7 @@ const Edit = ({ attributes, setAttributes }) => { const blockProps = useBlockProps(); const { icon, iconColor, iconSize } = attributes; const [svgContent, setSvgContent] = useState(''); - const svgBaseUrl = `${getFromGlobal('urls.pluginUrl')}assets/svg/`; + const svgBaseUrl = `${getFromGlobal('urls.pluginUrl')}includes/assets/svg/`; // Icon original source: https://github.com/WordPress/dashicons/tree/master/svg-min. const ICON_OPTIONS = [ diff --git a/src/blocks/icon/render.php b/src/blocks/icon/render.php index 2542ff6f9..e5520838c 100644 --- a/src/blocks/icon/render.php +++ b/src/blocks/icon/render.php @@ -11,7 +11,7 @@ $gatherpress_icon = ! empty( $attributes['icon'] ) ? $attributes['icon'] : 'nametag'; $gatherpress_icon_color = ! empty( $attributes['iconColor'] ) ? $attributes['iconColor'] : 'inherit'; $gatherpress_icon_size = ! empty( $attributes['iconSize'] ) ? $attributes['iconSize'] : 20; -$gatherpress_svg_base_url = GATHERPRESS_CORE_URL . '/assets/svg/'; +$gatherpress_svg_base_url = GATHERPRESS_CORE_URL . '/includes/assets/svg/'; $gatherpress_svg_url = $gatherpress_svg_base_url . $gatherpress_icon . '.svg'; $gatherpress_svg_content = '' . esc_html__( 'SVG Error', 'gatherpress' ) . ''; $gatherpress_response = wp_safe_remote_get( $gatherpress_svg_url );