index.js
1 lines
| 1 | (()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var o in a)e.o(a,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:a[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.blocks,a=window.wp.i18n,o=window.wp.blockEditor,l=window.wp.components,s=window.wp.serverSideRender;var i=e.n(s);const r=window.wp.element,n=window.ReactJSXRuntime,u=JSON.parse('{"apiVersion":3,"name":"awt/author-pro-book-synopsis","version":"1.0.1","title":"Book Synopsis [Author Pro]","category":"author-website-templates","icon":"text-page","description":"A dynamic synopsis section with book details and author profile.","supports":{"html":false,"anchor":true,"align":["full"]},"textdomain":"author-website-templates","attributes":{"align":{"type":"string","default":"full"},"blockId":{"type":"string"},"anchor":{"type":"string"},"headline":{"type":"string","default":"A System for Transformation"},"showQuote":{"type":"boolean","default":true},"quoteText":{"type":"string","default":"This book completely changed my perspective on daily habits."},"quoteAuthor":{"type":"string","default":"- Reader Review"},"authorImage":{"type":"object","default":{}},"authorSubtitle":{"type":"string","default":"Author"},"viewProfileLabel":{"type":"string","default":"View Profile"},"synopsisLabel":{"type":"string","default":"Synopsis"},"detailsLabel":{"type":"string","default":"Book Details"},"categoriesLabel":{"type":"string","default":"Categories"},"seriesLabel":{"type":"string","default":"Series"}},"editorScript":"file:./index.js","render":"file:./render.php"}');(0,t.registerBlockType)(u.name,{...u,edit:function({attributes:e,setAttributes:t,clientId:s}){const{blockId:u,anchor:d,headline:p,showQuote:h,quoteText:b,quoteAuthor:c,authorImage:w,authorSubtitle:g,viewProfileLabel:m,synopsisLabel:x,detailsLabel:y,categoriesLabel:_,seriesLabel:j}=e;(0,r.useEffect)(()=>{u||t({blockId:`awt-book-synopsis-${s}`})},[u,s]);const f=()=>{t({authorImage:{}})};return(0,n.jsxs)("div",{...(0,o.useBlockProps)({id:d?void 0:u}),children:[(0,n.jsxs)(o.InspectorControls,{children:[(0,n.jsx)(l.PanelBody,{title:(0,a.__)("Content Settings","author-website-templates"),initialOpen:!0,children:(0,n.jsx)(l.TextControl,{label:(0,a.__)("Headline","author-website-templates"),value:p,onChange:e=>t({headline:e})})}),(0,n.jsxs)(l.PanelBody,{title:(0,a.__)("Quote Settings","author-website-templates"),initialOpen:!1,children:[(0,n.jsx)(l.ToggleControl,{label:(0,a.__)("Show Quote Box","author-website-templates"),checked:h,onChange:e=>t({showQuote:e})}),h&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.TextareaControl,{label:(0,a.__)("Quote Text","author-website-templates"),value:b,onChange:e=>t({quoteText:e})}),(0,n.jsx)(l.TextControl,{label:(0,a.__)("Quote Author","author-website-templates"),value:c,onChange:e=>t({quoteAuthor:e})})]})]}),(0,n.jsxs)(l.PanelBody,{title:(0,a.__)("Author Settings","author-website-templates"),initialOpen:!1,children:[(0,n.jsx)(l.TextControl,{label:(0,a.__)("Subtitle / Role","author-website-templates"),value:g,onChange:e=>t({authorSubtitle:e})}),(0,n.jsx)(l.TextControl,{label:(0,a.__)("View Profile Label","author-website-templates"),value:m,onChange:e=>t({viewProfileLabel:e})}),(0,n.jsxs)("div",{className:"awt-author-image-control",style:{marginTop:"1rem"},children:[(0,n.jsx)("label",{className:"components-base-control__label",children:(0,a.__)("Author Image","author-website-templates")}),(0,n.jsx)(o.MediaUploadCheck,{children:(0,n.jsx)(o.MediaUpload,{onSelect:e=>{t({authorImage:{id:e.id,url:e.url,alt:e.alt}})},allowedTypes:["image"],value:w?w.id:null,render:({open:e})=>(0,n.jsx)(n.Fragment,{children:w&&w.url?(0,n.jsxs)("div",{className:"awt-author-image-preview",style:{marginBottom:"10px"},children:[(0,n.jsx)("img",{src:w.url,alt:w.alt,style:{maxWidth:"100%",height:"auto",borderRadius:"4px"}}),(0,n.jsx)(l.Button,{onClick:f,isDestructive:!0,variant:"link",style:{marginTop:"5px"},children:(0,a.__)("Remove Image","author-website-templates")})]}):(0,n.jsx)(l.Button,{onClick:e,variant:"secondary",children:(0,a.__)("Upload Author Image","author-website-templates")})})})})]})]})]}),(0,n.jsx)(o.InspectorControls,{children:(0,n.jsxs)(l.PanelBody,{title:(0,a.__)("Label Settings","author-website-templates"),initialOpen:!1,children:[(0,n.jsx)(l.TextControl,{label:(0,a.__)("Synopsis Label","author-website-templates"),value:x,onChange:e=>t({synopsisLabel:e})}),(0,n.jsx)(l.TextControl,{label:(0,a.__)("Book Details Label","author-website-templates"),value:y,onChange:e=>t({detailsLabel:e})}),(0,n.jsx)(l.TextControl,{label:(0,a.__)("Categories Label","author-website-templates"),value:_,onChange:e=>t({categoriesLabel:e})}),(0,n.jsx)(l.TextControl,{label:(0,a.__)("Series Label","author-website-templates"),value:j,onChange:e=>t({seriesLabel:e})})]})}),(0,n.jsx)(i(),{block:"awt/author-pro-book-synopsis",attributes:e})]})}})})(); |