From 1a5221ed3a8a80f7dbde2d7460fe0b0cb1255e94 Mon Sep 17 00:00:00 2001 From: YvetteNikolov Date: Wed, 11 Dec 2024 15:04:23 +0100 Subject: [PATCH] (chore): add core/heading to tab template --- build/Blocks/tabs-item/index.asset.php | 2 +- build/Blocks/tabs-item/index.js | 2 +- src/Blocks/tabs-item/edit.js | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build/Blocks/tabs-item/index.asset.php b/build/Blocks/tabs-item/index.asset.php index e0c7ca8..5a0f96d 100644 --- a/build/Blocks/tabs-item/index.asset.php +++ b/build/Blocks/tabs-item/index.asset.php @@ -1 +1 @@ - array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => 'e3b916a1b061e5a22f6a'); + array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices'), 'version' => '8e7e066e1ec55667370a'); diff --git a/build/Blocks/tabs-item/index.js b/build/Blocks/tabs-item/index.js index b41e12d..c61a3f9 100644 --- a/build/Blocks/tabs-item/index.js +++ b/build/Blocks/tabs-item/index.js @@ -1 +1 @@ -(()=>{"use strict";var e,t={696:()=>{const e=window.wp.blocks,t=window.wp.blockEditor,n=window.wp.data,s=window.wp.element,o=window.wp.hooks,r=window.wp.i18n,a=window.wp.compose,l=window.wp.components,i=window.wp.editor,c=(window.wp.coreData,()=>{const{clientId:e}=(0,t.useBlockEditContext)(),o=(0,n.useSelect)((n=>n(t.store).getBlockParents(e))).at(-1),r=(0,n.useSelect)((e=>e(t.store).getBlock(o))),a=(0,n.useSelect)((e=>e(t.store).getBlockAttributes(o))),{updateBlockAttributes:l,selectBlock:i}=(0,n.useDispatch)(t.store);return{parentBlock:r,parentAttributes:a,setParentAttributes:(0,s.useCallback)((e=>{l(o,e)}),[l,o]),selectParentBlock:(0,s.useCallback)((()=>{i(o)}),[i,o])}}),d=window.ReactJSXRuntime,u=((0,a.createHigherOrderComponent)((e=>t=>{const{media:a}=t;if(!a)return(0,d.jsx)(e,{...t});const{currentPostType:c}={currentPostType:(0,n.useSelect)((e=>e(i.store).getCurrentPostType()))},[u,p]=(e=>{const t=(0,n.useSelect)((e=>e(i.store).getEditedPostAttribute("meta"))),{editPost:o}=(0,n.useDispatch)(i.store),r=(0,s.useCallback)((t=>o({meta:{[e]:t}})),[o,e]);return[t?.[e],r]})("featured_image_focal_point"),h=(0,o.applyFilters)("yard.featured-image-focal-point-picker-allowed-post-types",[]),y=(0,s.useCallback)(((e={x:.5,y:.5})=>{p(e)}),[p]);return(0,s.useEffect)((()=>{0===u?.length&&y()}),[u,y]),h.includes(c)&&u&&a?.source_url?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(e,{...t}),(0,d.jsx)("div",{style:{marginTop:"1rem"},children:(0,d.jsx)(l.FocalPointPicker,{label:(0,r.__)("Kies een focuspunt voor de uitgelichte afbeelding."),url:a?.source_url,value:u,onChange:y,onDrag:y})})]}):(0,d.jsx)(e,{...t})}),"FeaturedImageFocalPointPicker"),e=>{const{attributes:t}=e,{icon:n,iconAltText:s}=t;return(0,d.jsx)("i",{className:`wp-block-yard-icon-component fa-fw ${n} `,title:s||null,"aria-hidden":"true"})}),p=window.wp.notices,h=({handleRemove:e})=>(0,d.jsx)(l.Button,{variant:"secondary",onClick:e,className:"icon-picker-control-delete-icon-btn",isDestructive:!0,children:"Verwijder icoon"}),y=({searchResults:e,handleIconClick:t})=>(0,d.jsxs)("div",{className:"icon-picker-control-results-container",children:[e?.map(((e,n)=>(0,d.jsx)("div",{className:"icon-picker-control-icon-btn-container",children:(0,d.jsx)(l.Button,{onClick:()=>t(e),children:(0,d.jsx)("i",{className:e})})},n))),!e?.length&&(0,d.jsx)("p",{children:(0,r.__)("Er zijn geen iconen gevonden")})]}),b=({onChange:e,icon:t,displayIconPreview:a=!0,displayAsPopover:i=!0,displayDeleteIcon:c=!1,handleRemove:u})=>{const[b,g]=(0,s.useState)(!1),[k,m]=(0,s.useState)(""),[f,x]=(0,s.useState)([]),[v,w]=(0,s.useState)(),{createNotice:j}=(0,n.useDispatch)(p.store),_=(0,o.applyFilters)("yard.fontawesome-family-styles",[{family:"classic",style:"solid"},{family:"classic",style:"regular"},{family:"classic",style:"light"},{family:"classic",style:"thin"},{family:"classic",style:"brands"},{family:"duotone",style:"solid"},{family:"sharp",style:"solid"},{family:"sharp",style:"regular"},{family:"sharp",style:"light"},{family:"sharp",style:"thin"}]),B=()=>{j("error",(0,r.__)("Momenteel kunnen er geen iconen worden opgehaald, probeer het later nog een keer."),{isDismissible:!0,type:"snackbar",id:"icon-picker-control-error"})},C=t=>{e(t),m((()=>"")),g((()=>!1))};return(0,d.jsxs)(d.Fragment,{children:[a&&t&&(0,d.jsx)("i",{className:t+" icon-picker-control-preview-icon"}),(0,d.jsx)(l.SearchControl,{placeholder:(0,r.__)("Zoek een icoon"),value:k,help:(0,r.__)("Gebruik Engelse termen om een icoon te zoeken."),onChange:e=>{m(e),(async e=>{try{const t=await(async e=>{const t=`{ search(version: "6.x", first: 100, query: "${e}")\n\t\t{\n\t\t\tid\n\t\t\tfamilyStylesByLicense {\n\t\t\t\tfree {\n\t\t\t\t\tfamily\n\t\t\t\t\tstyle\n\t\t\t\t}\n\t\t\t\tpro {\n\t\t\t\t\tfamily\n\t\t\t\t\tstyle\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}`;try{return(await fetch("https://api.fontawesome.com",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({query:t})})).json()}catch(e){throw new Error(e)}})(e);if(!t)return;const n=t?.data?.search.reduce(((e,t)=>(((e,t)=>(e=>{const t=e.familyStylesByLicense.free,n=e.familyStylesByLicense.pro,s=t.concat(n);return s.filter(((e,t)=>s.findIndex((t=>t.family===e.family&&t.style===e.style))===t))})(e).filter((e=>((e,t)=>t.some((t=>t.family===e.family&&t.style===e.style)))(e,t))).map((t=>`fa-${t.family} fa-${t.style} fa-${e.id}`)))(t,_).forEach((t=>{e.push(t)})),e)),[]);if(!n)return;x(n),g(!0)}catch(e){return B()}})(e)},ref:w}),i&&k&&b&&(0,d.jsx)(l.Popover,{anchor:v,title:(0,r.__)("Kies een icoon"),onClose:()=>g(!1),focusOnMount:!1,children:(0,d.jsx)(y,{searchResults:f,handleIconClick:C})}),!i&&k&&(0,d.jsx)(y,{searchResults:f,handleIconClick:C}),c&&t&&(0,d.jsx)(h,{handleRemove:u})]})},g=({icon:e,onChange:t,displayDeleteIcon:n=!1,handleRemove:s})=>(0,d.jsx)(b,{icon:e,onChange:t,displayIconPreview:!0,displayAsPopover:!0,displayDeleteIcon:n,handleRemove:s}),k=({icon:e,onChange:n})=>(0,d.jsx)(t.BlockControls,{children:(0,d.jsx)(l.Dropdown,{contentClassName:"icon-picker-control-popover",renderToggle:({isOpen:e,onToggle:t})=>(0,d.jsx)(l.ToolbarGroup,{children:(0,d.jsx)(l.ToolbarButton,{onClick:t,"aria-expanded":e,children:(0,r.__)("Kies icoon")})}),renderContent:()=>(0,d.jsx)(b,{icon:e,onChange:n,displayIconPreview:!1,displayAsPopover:!1})})}),m=e=>{const{attributes:n,setAttributes:s,enableIcon:o}=e,{icon:a,iconAltText:i}=n,{selectParentBlock:u}=c();return(0,d.jsxs)(t.InspectorControls,{children:[o&&(0,d.jsxs)(l.PanelBody,{title:(0,r.__)("Icoon instellingen","yard-gutenberg"),children:[(0,d.jsx)(g,{icon:a,onChange:e=>{void 0!==e&&s({icon:e})},displayDeleteIcon:!0,handleRemove:()=>s({icon:""})}),(0,d.jsx)(l.TextControl,{label:(0,r.__)("Alternatieve tekst","yard-gutenberg"),value:i,onChange:e=>s({iconAltText:e}),help:(0,r.__)("Voeg een alternatieve tekst toe als een icoon betekenis heeft.","yard-gutenberg")})]}),(0,d.jsxs)(l.PanelBody,{title:(0,r.__)("Toegankelijkheid","yard-gutenberg"),initialOpen:!1,children:[(0,d.jsx)("p",{children:(0,r.__)("Pas de koptekst niveaus aan via het hoofdblok (Tabbladen).","yard-gutenberg")}),(0,d.jsx)(l.Button,{variant:"secondary",onClick:u,children:(0,r.__)("Selecteer hoofdblok (Tabbladen)","yard-gutenberg")})]})]})},f=[["core/paragraph",{placeholder:(0,r.__)("Vul hier de tabblad inhoud in","yard-gutenberg")}]],x={src:(0,d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 0 512 512",children:(0,d.jsx)("path",{d:"M64 64C46.3 64 32 78.3 32 96V416c0 17.7 14.3 32 32 32H448c17.7 0 32-14.3 32-32V160c0-17.7-14.3-32-32-32H291.9c-17 0-33.3-6.7-45.3-18.7L210.7 73.4c-6-6-14.1-9.4-22.6-9.4H64zM0 96C0 60.7 28.7 32 64 32H188.1c17 0 33.3 6.7 45.3 18.7l35.9 35.9c6 6 14.1 9.4 22.6 9.4H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96z"})}),foreground:"#00a49e"},v=JSON.parse('{"UU":"yard/tabs-item"}');(0,e.registerBlockType)(v.UU,{edit:e=>{const{attributes:r,clientId:a,context:l,setAttributes:i,isSelected:p}=e,{headingText:h,icon:y,id:b}=r,g=(0,o.applyFilters)("yard.tabs-item-enable-icon",!1),[x,v]=(0,s.useState)(!1),{currentBlockHasSelectedInnerBlock:w}=(()=>{const{clientId:e}=(0,t.useBlockEditContext)(),o=(0,n.useSelect)((n=>n(t.store).getBlock(e))),r=(0,s.useMemo)((()=>{var e;return null!==(e=o.innerBlocks)&&void 0!==e?e:[]}),[o.innerBlocks]),a=(0,n.useSelect)((e=>e(t.store).getBlockAttributes(o.clientId))),l=(0,n.useSelect)((e=>e(t.store).hasSelectedInnerBlock(o.clientId,!0))),{updateBlockAttributes:i}=(0,n.useDispatch)(t.store),c=(0,s.useCallback)((e=>{r.forEach((t=>i(t.clientId,e)))}),[r,i]);return{currentBlock:o,currentBlockAttributes:a,currentBlockInnerBlocks:r,currentBlockHasSelectedInnerBlock:l,setAllCurrentBlockInnerBlocksAttributes:c}})(),{parentAttributes:j,setParentAttributes:_}=c(),{getClientIdsWithDescendants:B,getBlockAttributes:C}=(0,n.useSelect)((e=>({getClientIdsWithDescendants:e("core/block-editor").getClientIdsWithDescendants(),getBlockAttributes:e("core/block-editor").getBlockAttributes}))),I=(0,s.useCallback)((()=>{const e=B?.some((e=>{const{id:t}=C(e);return a!==e&&b===t}));return!b||b.length<=0||e?a:b}),[a,b,B,C]);return(0,s.useEffect)((()=>{i({id:I()})}),[i,I]),(0,s.useEffect)((()=>{var e;i({headingLevel:null!==(e=j.headingLevel)&&void 0!==e?e:"h3"})}),[i,j.headingLevel]),(0,s.useEffect)((()=>{v(l["yard/tabs-current-tab"]===b)}),[l,b]),(0,s.useEffect)((()=>{(p||w)&&(_({currentTab:I()}),v(!0))}),[p,w,_,I]),(0,s.useEffect)((()=>{g||i({icon:"",iconAltText:""})}),[i,g]),(0,d.jsxs)(d.Fragment,{children:[g&&(0,d.jsx)(k,{icon:y,onChange:e=>{void 0!==e&&i({icon:e})}}),(0,d.jsx)(m,{...e,enableIcon:g}),(0,d.jsx)("div",{className:"wp-block-yard-tabs-item__heading",children:(0,d.jsxs)("div",{className:"wp-block-yard-tabs-item__button "+(x?"active":""),children:[y&&(0,d.jsx)(u,{...e}),(0,d.jsx)(t.PlainText,{...(0,t.useBlockProps)({className:"wp-block-yard-tabs-item__heading-input"}),onChange:e=>i({headingText:e}),value:h})]})}),(0,d.jsx)("div",{className:"wp-block-yard-tabs-item__panel",style:{display:x?"block":"none"},children:(0,d.jsx)(t.InnerBlocks,{template:f})})]})},icon:x,save:e=>{const{attributes:n}=e,{headingLevel:s,headingText:o,icon:r,id:a}=n,l=s;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l,{...t.useBlockProps.save({className:"wp-block-yard-tabs-item__heading"}),children:(0,d.jsxs)("button",{id:`tabs-item-button-${a}`,className:"wp-block-yard-tabs-item__button","aria-controls":`tabs-item-panel-${a}`,"aria-selected":"false",children:[r&&(0,d.jsx)(u,{...e}),o]})}),(0,d.jsx)("div",{...t.useBlockProps.save({className:"wp-block-yard-tabs-item__panel"}),id:`tabs-item-panel-${a}`,"aria-hidden":"true","aria-labelledby":`tabs-item-button-${a}`,children:(0,d.jsx)(t.InnerBlocks.Content,{})})]})},usesContext:["yard/tabs-current-tab"]})}},n={};function s(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,s),r.exports}s.m=t,e=[],s.O=(t,n,o,r)=>{if(!n){var a=1/0;for(d=0;d=r)&&Object.keys(s.O).every((e=>s.O[e](n[i])))?n.splice(i--,1):(l=!1,r0&&e[d-1][2]>r;d--)e[d]=e[d-1];e[d]=[n,o,r]},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={761:0,525:0};s.O.j=t=>0===e[t];var t=(t,n)=>{var o,r,a=n[0],l=n[1],i=n[2],c=0;if(a.some((t=>0!==e[t]))){for(o in l)s.o(l,o)&&(s.m[o]=l[o]);if(i)var d=i(s)}for(t&&t(n);cs(696)));o=s.O(o)})(); \ No newline at end of file +(()=>{"use strict";var e,t={696:()=>{const e=window.wp.blocks,t=window.wp.blockEditor,n=window.wp.data,s=window.wp.element,o=window.wp.hooks,r=window.wp.i18n,a=window.wp.compose,l=window.wp.components,i=window.wp.editor,c=(window.wp.coreData,()=>{const{clientId:e}=(0,t.useBlockEditContext)(),o=(0,n.useSelect)((n=>n(t.store).getBlockParents(e))).at(-1),r=(0,n.useSelect)((e=>e(t.store).getBlock(o))),a=(0,n.useSelect)((e=>e(t.store).getBlockAttributes(o))),{updateBlockAttributes:l,selectBlock:i}=(0,n.useDispatch)(t.store);return{parentBlock:r,parentAttributes:a,setParentAttributes:(0,s.useCallback)((e=>{l(o,e)}),[l,o]),selectParentBlock:(0,s.useCallback)((()=>{i(o)}),[i,o])}}),d=window.ReactJSXRuntime,u=((0,a.createHigherOrderComponent)((e=>t=>{const{media:a}=t;if(!a)return(0,d.jsx)(e,{...t});const{currentPostType:c}={currentPostType:(0,n.useSelect)((e=>e(i.store).getCurrentPostType()))},[u,p]=(e=>{const t=(0,n.useSelect)((e=>e(i.store).getEditedPostAttribute("meta"))),{editPost:o}=(0,n.useDispatch)(i.store),r=(0,s.useCallback)((t=>o({meta:{[e]:t}})),[o,e]);return[t?.[e],r]})("featured_image_focal_point"),h=(0,o.applyFilters)("yard.featured-image-focal-point-picker-allowed-post-types",[]),y=(0,s.useCallback)(((e={x:.5,y:.5})=>{p(e)}),[p]);return(0,s.useEffect)((()=>{0===u?.length&&y()}),[u,y]),h.includes(c)&&u&&a?.source_url?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(e,{...t}),(0,d.jsx)("div",{style:{marginTop:"1rem"},children:(0,d.jsx)(l.FocalPointPicker,{label:(0,r.__)("Kies een focuspunt voor de uitgelichte afbeelding."),url:a?.source_url,value:u,onChange:y,onDrag:y})})]}):(0,d.jsx)(e,{...t})}),"FeaturedImageFocalPointPicker"),e=>{const{attributes:t}=e,{icon:n,iconAltText:s}=t;return(0,d.jsx)("i",{className:`wp-block-yard-icon-component fa-fw ${n} `,title:s||null,"aria-hidden":"true"})}),p=window.wp.notices,h=({handleRemove:e})=>(0,d.jsx)(l.Button,{variant:"secondary",onClick:e,className:"icon-picker-control-delete-icon-btn",isDestructive:!0,children:"Verwijder icoon"}),y=({searchResults:e,handleIconClick:t})=>(0,d.jsxs)("div",{className:"icon-picker-control-results-container",children:[e?.map(((e,n)=>(0,d.jsx)("div",{className:"icon-picker-control-icon-btn-container",children:(0,d.jsx)(l.Button,{onClick:()=>t(e),children:(0,d.jsx)("i",{className:e})})},n))),!e?.length&&(0,d.jsx)("p",{children:(0,r.__)("Er zijn geen iconen gevonden")})]}),b=({onChange:e,icon:t,displayIconPreview:a=!0,displayAsPopover:i=!0,displayDeleteIcon:c=!1,handleRemove:u})=>{const[b,g]=(0,s.useState)(!1),[k,m]=(0,s.useState)(""),[f,x]=(0,s.useState)([]),[v,w]=(0,s.useState)(),{createNotice:j}=(0,n.useDispatch)(p.store),_=(0,o.applyFilters)("yard.fontawesome-family-styles",[{family:"classic",style:"solid"},{family:"classic",style:"regular"},{family:"classic",style:"light"},{family:"classic",style:"thin"},{family:"classic",style:"brands"},{family:"duotone",style:"solid"},{family:"sharp",style:"solid"},{family:"sharp",style:"regular"},{family:"sharp",style:"light"},{family:"sharp",style:"thin"}]),B=()=>{j("error",(0,r.__)("Momenteel kunnen er geen iconen worden opgehaald, probeer het later nog een keer."),{isDismissible:!0,type:"snackbar",id:"icon-picker-control-error"})},C=t=>{e(t),m((()=>"")),g((()=>!1))};return(0,d.jsxs)(d.Fragment,{children:[a&&t&&(0,d.jsx)("i",{className:t+" icon-picker-control-preview-icon"}),(0,d.jsx)(l.SearchControl,{placeholder:(0,r.__)("Zoek een icoon"),value:k,help:(0,r.__)("Gebruik Engelse termen om een icoon te zoeken."),onChange:e=>{m(e),(async e=>{try{const t=await(async e=>{const t=`{ search(version: "6.x", first: 100, query: "${e}")\n\t\t{\n\t\t\tid\n\t\t\tfamilyStylesByLicense {\n\t\t\t\tfree {\n\t\t\t\t\tfamily\n\t\t\t\t\tstyle\n\t\t\t\t}\n\t\t\t\tpro {\n\t\t\t\t\tfamily\n\t\t\t\t\tstyle\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}`;try{return(await fetch("https://api.fontawesome.com",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({query:t})})).json()}catch(e){throw new Error(e)}})(e);if(!t)return;const n=t?.data?.search.reduce(((e,t)=>(((e,t)=>(e=>{const t=e.familyStylesByLicense.free,n=e.familyStylesByLicense.pro,s=t.concat(n);return s.filter(((e,t)=>s.findIndex((t=>t.family===e.family&&t.style===e.style))===t))})(e).filter((e=>((e,t)=>t.some((t=>t.family===e.family&&t.style===e.style)))(e,t))).map((t=>`fa-${t.family} fa-${t.style} fa-${e.id}`)))(t,_).forEach((t=>{e.push(t)})),e)),[]);if(!n)return;x(n),g(!0)}catch(e){return B()}})(e)},ref:w}),i&&k&&b&&(0,d.jsx)(l.Popover,{anchor:v,title:(0,r.__)("Kies een icoon"),onClose:()=>g(!1),focusOnMount:!1,children:(0,d.jsx)(y,{searchResults:f,handleIconClick:C})}),!i&&k&&(0,d.jsx)(y,{searchResults:f,handleIconClick:C}),c&&t&&(0,d.jsx)(h,{handleRemove:u})]})},g=({icon:e,onChange:t,displayDeleteIcon:n=!1,handleRemove:s})=>(0,d.jsx)(b,{icon:e,onChange:t,displayIconPreview:!0,displayAsPopover:!0,displayDeleteIcon:n,handleRemove:s}),k=({icon:e,onChange:n})=>(0,d.jsx)(t.BlockControls,{children:(0,d.jsx)(l.Dropdown,{contentClassName:"icon-picker-control-popover",renderToggle:({isOpen:e,onToggle:t})=>(0,d.jsx)(l.ToolbarGroup,{children:(0,d.jsx)(l.ToolbarButton,{onClick:t,"aria-expanded":e,children:(0,r.__)("Kies icoon")})}),renderContent:()=>(0,d.jsx)(b,{icon:e,onChange:n,displayIconPreview:!1,displayAsPopover:!1})})}),m=e=>{const{attributes:n,setAttributes:s,enableIcon:o}=e,{icon:a,iconAltText:i}=n,{selectParentBlock:u}=c();return(0,d.jsxs)(t.InspectorControls,{children:[o&&(0,d.jsxs)(l.PanelBody,{title:(0,r.__)("Icoon instellingen","yard-gutenberg"),children:[(0,d.jsx)(g,{icon:a,onChange:e=>{void 0!==e&&s({icon:e})},displayDeleteIcon:!0,handleRemove:()=>s({icon:""})}),(0,d.jsx)(l.TextControl,{label:(0,r.__)("Alternatieve tekst","yard-gutenberg"),value:i,onChange:e=>s({iconAltText:e}),help:(0,r.__)("Voeg een alternatieve tekst toe als een icoon betekenis heeft.","yard-gutenberg")})]}),(0,d.jsxs)(l.PanelBody,{title:(0,r.__)("Toegankelijkheid","yard-gutenberg"),initialOpen:!1,children:[(0,d.jsx)("p",{children:(0,r.__)("Pas de koptekst niveaus aan via het hoofdblok (Tabbladen).","yard-gutenberg")}),(0,d.jsx)(l.Button,{variant:"secondary",onClick:u,children:(0,r.__)("Selecteer hoofdblok (Tabbladen)","yard-gutenberg")})]})]})},f=[["core/heading",{placeholder:(0,r.__)("Titel van het tabblad","yard-gutenberg")}],["core/paragraph",{placeholder:(0,r.__)("Voeg de rest van de inhoud toe.","yard-gutenberg")}]],x={src:(0,d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",viewBox:"0 0 512 512",children:(0,d.jsx)("path",{d:"M64 64C46.3 64 32 78.3 32 96V416c0 17.7 14.3 32 32 32H448c17.7 0 32-14.3 32-32V160c0-17.7-14.3-32-32-32H291.9c-17 0-33.3-6.7-45.3-18.7L210.7 73.4c-6-6-14.1-9.4-22.6-9.4H64zM0 96C0 60.7 28.7 32 64 32H188.1c17 0 33.3 6.7 45.3 18.7l35.9 35.9c6 6 14.1 9.4 22.6 9.4H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96z"})}),foreground:"#00a49e"},v=JSON.parse('{"UU":"yard/tabs-item"}');(0,e.registerBlockType)(v.UU,{edit:e=>{const{attributes:r,clientId:a,context:l,setAttributes:i,isSelected:p}=e,{headingText:h,icon:y,id:b}=r,g=(0,o.applyFilters)("yard.tabs-item-enable-icon",!1),[x,v]=(0,s.useState)(!1),{currentBlockHasSelectedInnerBlock:w}=(()=>{const{clientId:e}=(0,t.useBlockEditContext)(),o=(0,n.useSelect)((n=>n(t.store).getBlock(e))),r=(0,s.useMemo)((()=>{var e;return null!==(e=o.innerBlocks)&&void 0!==e?e:[]}),[o.innerBlocks]),a=(0,n.useSelect)((e=>e(t.store).getBlockAttributes(o.clientId))),l=(0,n.useSelect)((e=>e(t.store).hasSelectedInnerBlock(o.clientId,!0))),{updateBlockAttributes:i}=(0,n.useDispatch)(t.store),c=(0,s.useCallback)((e=>{r.forEach((t=>i(t.clientId,e)))}),[r,i]);return{currentBlock:o,currentBlockAttributes:a,currentBlockInnerBlocks:r,currentBlockHasSelectedInnerBlock:l,setAllCurrentBlockInnerBlocksAttributes:c}})(),{parentAttributes:j,setParentAttributes:_}=c(),{getClientIdsWithDescendants:B,getBlockAttributes:C}=(0,n.useSelect)((e=>({getClientIdsWithDescendants:e("core/block-editor").getClientIdsWithDescendants(),getBlockAttributes:e("core/block-editor").getBlockAttributes}))),I=(0,s.useCallback)((()=>{const e=B?.some((e=>{const{id:t}=C(e);return a!==e&&b===t}));return!b||b.length<=0||e?a:b}),[a,b,B,C]);return(0,s.useEffect)((()=>{i({id:I()})}),[i,I]),(0,s.useEffect)((()=>{var e;i({headingLevel:null!==(e=j.headingLevel)&&void 0!==e?e:"h3"})}),[i,j.headingLevel]),(0,s.useEffect)((()=>{v(l["yard/tabs-current-tab"]===b)}),[l,b]),(0,s.useEffect)((()=>{(p||w)&&(_({currentTab:I()}),v(!0))}),[p,w,_,I]),(0,s.useEffect)((()=>{g||i({icon:"",iconAltText:""})}),[i,g]),(0,d.jsxs)(d.Fragment,{children:[g&&(0,d.jsx)(k,{icon:y,onChange:e=>{void 0!==e&&i({icon:e})}}),(0,d.jsx)(m,{...e,enableIcon:g}),(0,d.jsx)("div",{className:"wp-block-yard-tabs-item__heading",children:(0,d.jsxs)("div",{className:"wp-block-yard-tabs-item__button "+(x?"active":""),children:[y&&(0,d.jsx)(u,{...e}),(0,d.jsx)(t.PlainText,{...(0,t.useBlockProps)({className:"wp-block-yard-tabs-item__heading-input"}),onChange:e=>i({headingText:e}),value:h})]})}),(0,d.jsx)("div",{className:"wp-block-yard-tabs-item__panel",style:{display:x?"block":"none"},children:(0,d.jsx)(t.InnerBlocks,{template:f})})]})},icon:x,save:e=>{const{attributes:n}=e,{headingLevel:s,headingText:o,icon:r,id:a}=n,l=s;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l,{...t.useBlockProps.save({className:"wp-block-yard-tabs-item__heading"}),children:(0,d.jsxs)("button",{id:`tabs-item-button-${a}`,className:"wp-block-yard-tabs-item__button","aria-controls":`tabs-item-panel-${a}`,"aria-selected":"false",children:[r&&(0,d.jsx)(u,{...e}),o]})}),(0,d.jsx)("div",{...t.useBlockProps.save({className:"wp-block-yard-tabs-item__panel"}),id:`tabs-item-panel-${a}`,"aria-hidden":"true","aria-labelledby":`tabs-item-button-${a}`,children:(0,d.jsx)(t.InnerBlocks.Content,{})})]})},usesContext:["yard/tabs-current-tab"]})}},n={};function s(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,s),r.exports}s.m=t,e=[],s.O=(t,n,o,r)=>{if(!n){var a=1/0;for(d=0;d=r)&&Object.keys(s.O).every((e=>s.O[e](n[i])))?n.splice(i--,1):(l=!1,r0&&e[d-1][2]>r;d--)e[d]=e[d-1];e[d]=[n,o,r]},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={761:0,525:0};s.O.j=t=>0===e[t];var t=(t,n)=>{var o,r,a=n[0],l=n[1],i=n[2],c=0;if(a.some((t=>0!==e[t]))){for(o in l)s.o(l,o)&&(s.m[o]=l[o]);if(i)var d=i(s)}for(t&&t(n);cs(696)));o=s.O(o)})(); \ No newline at end of file diff --git a/src/Blocks/tabs-item/edit.js b/src/Blocks/tabs-item/edit.js index 1927b5f..99f3255 100644 --- a/src/Blocks/tabs-item/edit.js +++ b/src/Blocks/tabs-item/edit.js @@ -23,11 +23,17 @@ import Inspector from './components/inspector'; import './editor.scss'; const TEMPLATE = [ + [ + 'core/heading', + { + placeholder: __( 'Titel van het tabblad', 'yard-gutenberg' ), + }, + ], [ 'core/paragraph', { placeholder: __( - 'Vul hier de tabblad inhoud in', + 'Voeg de rest van de inhoud toe.', 'yard-gutenberg' ), },