Files

1 line
5.4 KiB
JavaScript

(()=>{"use strict";var e,l={363:(e,l,t)=>{const n=window.wp.blocks,a=window.React,o=window.wp.i18n,r=window.wp.serverSideRender;var i=t.n(r);const c=window.wp.blockEditor,d=window.wp.components,m=JSON.parse('{"UU":"document-gallery/document-gallery-block"}');(0,n.registerBlockType)(m.UU,{edit:function({attributes:e,setAttributes:l}){const t=(0,c.useBlockProps)(),n=window.dgBlockConfig.dgDefaults,r=l=>void 0!==e[l]?e[l]:n[l],m=(e,t)=>{l({[e]:t})},u=r("mime_types"),s="string"==typeof u?u.split(","):[];return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.InspectorControls,null,(0,a.createElement)(d.PanelBody,{title:(0,o.__)("Gallery Settings","document-gallery"),initialOpen:!1},(0,a.createElement)(d.ToggleControl,{label:(0,o.__)("Limit to Current Post","document-gallery"),checked:r("localpost"),onChange:e=>m("localpost",e),help:(0,o.__)("Only show attachments uploaded to this post.","document-gallery")}),(0,a.createElement)(d.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,o.__)("Columns","document-gallery"),value:r("columns"),onChange:e=>m("columns",parseInt(e)),min:1,step:1,help:(0,o.__)("The number of columns to display when not rendering descriptions.","document-gallery")}),(0,a.createElement)(d.ToggleControl,{label:(0,o.__)("Fancy","document-gallery"),checked:r("fancy"),onChange:e=>m("fancy",e),help:(0,o.__)("Use auto-generated document thumbnails.","document-gallery")}),(0,a.createElement)(d.SelectControl,{label:(0,o.__)("Relation","document-gallery"),value:r("relation"),onChange:e=>m("relation",e),options:[{label:"OR",value:"OR"},{label:"AND",value:"AND"}],help:(0,o.__)("Whether matched documents must have all taxa_names (AND) or at least one (OR).","document-gallery")}),(0,a.createElement)(d.__experimentalNumberControl,{__next40pxDefaultSize:!0,label:(0,o.__)("Limit","document-gallery"),value:r("limit"),onChange:e=>m("limit",parseInt(e)),min:-1,step:1,help:(0,o.__)("Limit the number of documents included. -1 means no limit.","document-gallery")}),(0,a.createElement)(d.ToggleControl,{label:(0,o.__)("Paginate","document-gallery"),checked:r("paginate"),onChange:e=>m("paginate",e),help:(0,o.__)("When a limit exists, paginate rather than truncating gallery.","document-gallery")}),(0,a.createElement)(d.SelectControl,{label:(0,o.__)("Order By","document-gallery"),value:r("orderby"),onChange:e=>m("orderby",e),options:[{label:"Menu Order",value:"menu_order"},{label:"Title",value:"title"},{label:"Date",value:"date"},{label:"Modified",value:"modified"},{label:"Random",value:"rand"}],help:(0,o.__)("Which field to order documents by.","document-gallery")}),(0,a.createElement)(d.SelectControl,{label:(0,o.__)("Order","document-gallery"),value:r("order"),onChange:e=>m("order",e),options:[{label:"Ascending",value:"ASC"},{label:"Descending",value:"DESC"}],help:(0,o.__)("Ascending or descending sorting of documents.","document-gallery")}),(0,a.createElement)(d.ToggleControl,{label:(0,o.__)("Descriptions","document-gallery"),checked:r("descriptions"),onChange:e=>m("descriptions",e),help:(0,o.__)("Include document descriptions.","document-gallery")}),(0,a.createElement)(d.ToggleControl,{label:(0,o.__)("Open in New Window","document-gallery"),checked:r("new_window"),onChange:e=>m("new_window",e),help:(0,o.__)("Open thumbnail links in new window.","document-gallery")}),(0,a.createElement)(d.ToggleControl,{label:(0,o.__)("Show Attachment Page Link","document-gallery"),checked:r("attachment_pg"),onChange:e=>m("attachment_pg",e),help:(0,o.__)("Link to attachment page rather than to file.","document-gallery")}))),(0,a.createElement)("div",{...t},(0,a.createElement)(c.MediaUpload,{title:(0,o.__)("Select Document Gallery Files (Optional)","document-gallery"),gallery:!0,allowedTypes:s,multiple:!0,value:r("ids")?r("ids").split(",").map(e=>parseInt(e)):[],render:({open:e})=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(d.Button,{variant:"secondary",onClick:e},r("ids")?(0,o.__)("Edit selected documents","document-gallery"):(0,o.__)("Select specific documents (optional)","document-gallery")),r("ids")&&(0,a.createElement)(d.Button,{variant:"link",isDestructive:!0,onClick:()=>l({ids:""}),style:{marginLeft:"8px"}},(0,o.__)("Clear selection","document-gallery"))),onSelect:e=>{if(e&&e.length>0){const t=e.map(e=>e.id).join(",");l({ids:t})}else l({ids:""})}}),(0,a.createElement)(i(),{block:"document-gallery/document-gallery-block",attributes:e})))}})}},t={};function n(e){var a=t[e];if(void 0!==a)return a.exports;var o=t[e]={exports:{}};return l[e](o,o.exports,n),o.exports}n.m=l,e=[],n.O=(l,t,a,o)=>{if(!t){var r=1/0;for(m=0;m<e.length;m++){for(var[t,a,o]=e[m],i=!0,c=0;c<t.length;c++)(!1&o||r>=o)&&Object.keys(n.O).every(e=>n.O[e](t[c]))?t.splice(c--,1):(i=!1,o<r&&(r=o));if(i){e.splice(m--,1);var d=a();void 0!==d&&(l=d)}}return l}o=o||0;for(var m=e.length;m>0&&e[m-1][2]>o;m--)e[m]=e[m-1];e[m]=[t,a,o]},n.n=e=>{var l=e&&e.__esModule?()=>e.default:()=>e;return n.d(l,{a:l}),l},n.d=(e,l)=>{for(var t in l)n.o(l,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:l[t]})},n.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),(()=>{var e={63:0,295:0};n.O.j=l=>0===e[l];var l=(l,t)=>{var a,o,[r,i,c]=t,d=0;if(r.some(l=>0!==e[l])){for(a in i)n.o(i,a)&&(n.m[a]=i[a]);if(c)var m=c(n)}for(l&&l(t);d<r.length;d++)o=r[d],n.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return n.O(m)},t=globalThis.webpackChunkdocument_gallery=globalThis.webpackChunkdocument_gallery||[];t.forEach(l.bind(null,0)),t.push=l.bind(null,t.push.bind(t))})();var a=n.O(void 0,[295],()=>n(363));a=n.O(a)})();