PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
← All changes | blocks/table/build/index.js +5 -1 2.2.5 → 3.4 View file →
@@ -1 +1,5 @@
1 -!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,r=window.wp.shortcode,a=e.n(r),n=JSON.parse('{"u2":"tablepress/table"}');const l=e=>{let t=Object.entries(e.named).map((([e,t])=>{let r="";return t=t.replace(/“([^”]*)”/g,"$1"),(/\s/.test(t)||""===t)&&(r='"'),t.includes('"')&&(r="'"),`${e}=${r}${t}${r}`})).join(" ");return e.numeric.forEach((e=>{/\s/.test(e)?t+=' "'+e+'"':t+=" "+e})),t},s=function(e){let r=a().next(tp.table.shortcode,e).shortcode.attrs;r={named:{...r.named},numeric:[...r.numeric]};const s=r.named.id;delete r.named.id;let o=l(r);return o=o.replace(/=“([^”]*)”/g,'="$1"'),(0,t.createBlock)(n.u2,{id:s,parameters:o})};var o={from:[{type:"shortcode",tag:tp.table.shortcode,attributes:{id:{type:"string",shortcode:({named:{id:e=""}})=>e},parameters:{type:"string",shortcode:e=>(delete(e={named:{...e.named},numeric:[...e.numeric]}).named.id,l(e))}}},{type:"enter",regExp:a().regexp(tp.table.shortcode),transform:({content:e})=>s(e)},{type:"block",blocks:["core/shortcode"],transform:({text:e})=>s(e),isMatch:({text:e})=>void 0!==a().next(tp.table.shortcode,e),isMultiBlock:!1}],to:[{type:"block",blocks:["core/shortcode"],transform:({id:e,parameters:r})=>{""!==(r=r.trim())&&(r+=" ");const a=`[${tp.table.shortcode} id=${e} ${r}/]`;return(0,t.createBlock)("core/shortcode",{text:a})}}]},c=window.React,i=window.wp.i18n,d=window.wp.serverSideRender,p=e.n(d),b=window.wp.blockEditor,m=window.wp.components;const u=Object.entries(tp.tables).map((([e,t])=>({value:e,label:(0,i.sprintf)((0,i.__)("ID %1$s: “%2$s”","tablepress"),e,t)}))),h=function(){return""!==tp.url&&(0,c.createElement)(m.ExternalLink,{href:tp.url},(0,i.__)("Manage your tables.","tablepress"))};var w=window.wp.element;let f=null;const _=Object.keys(tp.tables);_.length&&(f={attributes:{id:_[Math.floor(Math.random()*_.length)],parameters:""}});var g=f;(0,t.registerBlockType)(n.u2,{transforms:o,edit:function({attributes:e,setAttributes:t}){const r=(0,b.useBlockProps)();let s;if(e.id&&tp.tables.hasOwnProperty(e.id))s=(0,c.createElement)("div",{...r},tp.load_block_preview&&(0,c.createElement)(p(),{block:n.u2,attributes:e,className:"render-wrapper"}),(0,c.createElement)("div",{className:"table-overlay"},(0,i.sprintf)((0,i.__)("TablePress table %1$s: “%2$s”","tablepress"),e.id,tp.tables[e.id])));else{let t=0<u.length?(0,i.__)("Select the TablePress table that you want to embed in the Settings sidebar.","tablepress"):(0,i.__)("There are no TablePress tables on this site yet.","tablepress");e.id&&(t=(0,i.sprintf)((0,i.__)("There is a problem: The TablePress table with the ID “%1$s” could not be found.","tablepress"),e.id)+" "+t),s=(0,c.createElement)("div",{...r},(0,c.createElement)(m.Placeholder,{icon:(0,c.createElement)(m.Icon,{icon:"list-view"}),label:(0,i.__)("TablePress table","tablepress"),instructions:t},(0,c.createElement)(h,null)))}const o=(0,c.createElement)(c.Fragment,null,(0,c.createElement)(b.InspectorControls,null,(0,c.createElement)(m.PanelBody,{opened:!0},0<u.length?(0,c.createElement)(m.ComboboxControl,{label:(0,i.__)("Table:","tablepress"),help:(0,c.createElement)(c.Fragment,null,(0,i.__)("Select the TablePress table that you want to embed.","tablepress"),""!==tp.url&&" ",(0,c.createElement)(h,null)),value:e.id,options:u,onChange:e=>{var r;null!==(r=e)&&void 0!==r||(e=""),t({id:e.replace(/[^0-9a-zA-Z-_]/g,"")})}}):(0,c.createElement)(c.Fragment,null,(0,i.__)("There are no TablePress tables on this site yet.","tablepress"),""!==tp.url&&" ",(0,c.createElement)(h,null)))),e.id&&tp.tables.hasOwnProperty(e.id)&&(0,c.createElement)(b.InspectorAdvancedControls,null,(0,c.createElement)(m.TextControl,{label:(0,i.__)("Configuration parameters:","tablepress"),help:(0,i.__)("These additional parameters can be used to modify specific table features.","tablepress")+" "+(0,i.__)("See the TablePress Documentation for more information.","tablepress"),value:e.parameters,onChange:e=>{e=(e=a().replace(tp.table.shortcode,e,(({attrs:e})=>(delete(e={named:{...e.named},numeric:[...e.numeric]}).named.id," "+l(e)+" ")))).replace(/=“([^”]*)”/g,'="$1"'),t({parameters:e})},onBlur:e=>{const r=e.target.value.trim();t({parameters:r})}})));return(0,c.createElement)(c.Fragment,null,s,o)},save:function({attributes:{id:e="",parameters:t=""}}){return""===e?"":(""!==(t=t.trim())&&(t+=" "),(0,c.createElement)(w.RawHTML,null,`[${tp.table.shortcode} id=${e} ${t}/]`))},example:g})}();
1 +(()=>{"use strict";const e={n:t=>{const r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.hasOwn(e,t)},t=window.wp.blocks,r=window.wp.shortcode;var s=e.n(r);const a=JSON.parse('{"UU":"tablepress/table"}'),l=e=>{let t=Object.entries(e.named).map(([e,t])=>{let r="";return t=t.replace(/“([^”]*)”/g,"$1"),(/\s/.test(t)||""===t)&&(r='"'),t.includes('"')&&(r="'"),`${e}=${r}${t}${r}`}).join(" ");return e.numeric.forEach(e=>{/\s/.test(e)?t+=' "'+e+'"':t+=" "+e}),t},n=e=>{delete e.named.id;let t=l(e);return t=t.replace(/=“([^”]*)”/g,'="$1"'),t=t.replaceAll("&amp;","&").replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&lsqb;","[").replaceAll("&rsqb;","]"),t},o=e=>{let r=s().next(tp.table.shortcode,e).shortcode.attrs;r={named:{...r.named},numeric:[...r.numeric]};const l=r.named.id,o=n(r);return(0,t.createBlock)(a.UU,{id:l,parameters:o})},i={from:[{type:"shortcode",tag:tp.table.shortcode,attributes:{id:{type:"string",shortcode:({named:{id:e=""}})=>e},parameters:{type:"string",shortcode:e=>(e={named:{...e.named},numeric:[...e.numeric]},n(e))}}},{type:"enter",regExp:s().regexp(tp.table.shortcode),transform:({content:e})=>o(e)},{type:"block",blocks:["core/shortcode"],transform:({text:e})=>o(e),isMatch:({text:e})=>void 0!==s().next(tp.table.shortcode,e),isMultiBlock:!1}],to:[{type:"block",blocks:["core/shortcode"],transform:({id:e,parameters:r})=>{""!==(r=r.trim())&&(r=(r+=" ").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll("[","&lsqb;").replaceAll("]","&rsqb;"));const s=`[${tp.table.shortcode} id=${e} ${r}/]`;return(0,t.createBlock)("core/shortcode",{text:s})}}]},c=window.wp.i18n,p=window.wp.serverSideRender;var d=e.n(p);const b=window.wp.blockEditor,h=window.wp.components,m=window.wp.element,u=window.wp.primitives,x=window.ReactJSXRuntime,w=(0,x.jsxs)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-32 -32 64 64",fill:"#50575e",children:[(0,x.jsx)(u.Path,{d:"M0-25.854h-25.854v51.708h51.708V0H21v21h-42v-42H0Z"}),(0,x.jsx)(u.Path,{d:"M-18-18h10v10h-10zM-18-5h10V5h-10zM-5-5H5V5H-5zM-18 8h10v10h-10zM-5 8H5v10H-5zM8 8h10v10H8zM5-31h6.18v6.18H5zM19-25h6.18v6.18H19zM0-15h3.82v3.82H0zM10-20h3.82v3.82H10zM25-12h3.82v3.82H25zM8-13h10v10H8z"})]}),_=Object.entries(tp.tables).map(([e,t])=>({value:e,
2 +/* translators: %1$s: Table ID, %2$s: Table name */
3 +label:(0,c.sprintf)((0,c.__)("ID %1$s: “%2$s”","tablepress"),e,t)})),g=function(){return""!==tp.url&&(0,x.jsx)(h.ExternalLink,{href:tp.url,children:(0,c.__)("Manage your tables.","tablepress")})};let v=null;const f=Object.keys(tp.tables);f.length&&(v={attributes:{id:f[Math.floor(Math.random()*f.length)],parameters:""}});const j=v;(0,t.registerBlockType)(a.UU,{transforms:i,edit:({attributes:e,setAttributes:t})=>{const r=(0,b.useBlockProps)();let n;if(e.id&&tp.tables.hasOwnProperty(e.id))n=(0,x.jsxs)("div",{...r,children:[tp.load_block_preview&&(0,x.jsx)(d(),{block:a.UU,attributes:{id:e.id,parameters:`block_preview=true ${e.parameters}`.trim()},className:"render-wrapper"}),(0,x.jsx)("div",{className:"table-overlay",children:(0,c.sprintf)((0,c.__)("TablePress table %1$s: “%2$s”","tablepress"),e.id,tp.tables[e.id])})]});else{let t=0<_.length?(0,c.__)("Select the TablePress table that you want to embed in the Settings sidebar.","tablepress"):(0,c.__)("There are no TablePress tables on this site yet.","tablepress");e.id&&(
4 +/* translators: %1$s: Table ID */
5 +t=(0,c.sprintf)((0,c.__)("There is a problem: The TablePress table with the ID “%1$s” could not be found.","tablepress"),e.id)+" "+t),n=(0,x.jsx)("div",{...r,children:(0,x.jsx)(h.Placeholder,{icon:(0,x.jsx)(h.Icon,{icon:w}),label:(0,c.__)("TablePress table","tablepress"),instructions:t,children:(0,x.jsx)(g,{})})})}const o=(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(b.InspectorControls,{children:(0,x.jsx)(h.PanelBody,{opened:!0,children:0<_.length?(0,x.jsx)(h.ComboboxControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,c.__)("Table:","tablepress"),help:(0,x.jsxs)(x.Fragment,{children:[(0,c.__)("Select the TablePress table that you want to embed.","tablepress"),""!==tp.url&&" ",(0,x.jsx)(g,{})]}),value:e.id,options:_,onChange:e=>{e??="",t({id:e.replace(/[^0-9a-zA-Z-_]/g,"")})}}):(0,x.jsxs)(x.Fragment,{children:[(0,c.__)("There are no TablePress tables on this site yet.","tablepress"),""!==tp.url&&" ",(0,x.jsx)(g,{})]})})}),e.id&&tp.tables.hasOwnProperty(e.id)&&(0,x.jsx)(b.InspectorAdvancedControls,{children:(0,x.jsx)(h.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,c.__)("Configuration parameters:","tablepress"),help:(0,m.createInterpolateElement)((0,c.__)("These additional parameters can be used to modify specific table features.","tablepress")+" "+(0,c.__)("See the <a>TablePress Documentation</a> for more information.","tablepress"),{a:(0,x.jsx)("a",{href:"https://tablepress.org/faq/configuration-parameter-reference/"})}),value:e.parameters,onChange:e=>{e=(e=s().replace(tp.table.shortcode,e,({attrs:e})=>(delete(e={named:{...e.named},numeric:[...e.numeric]}).named.id," "+l(e)+" "))).replace(/=“([^”]*)”/g,'="$1"'),t({parameters:e})},onBlur:e=>{const r=e.target.value.trim();t({parameters:r})}})})]});return(0,x.jsxs)(x.Fragment,{children:[n,o]})},save:({attributes:{id:e="",parameters:t=""}})=>""===e?"":(""!==(t=t.trim())&&(t+=" "),(0,x.jsx)(m.RawHTML,{children:`[${tp.table.shortcode} id=${e} ${t}/]`})),example:j,icon:w})})();