Changeset 2887836
- Timestamp:
- 03/27/2023 07:34:54 PM (3 years ago)
- Location:
- besan-block
- Files:
-
- 32 added
- 6 edited
-
tags/1.3 (added)
-
tags/1.3/besan-block.php (added)
-
tags/1.3/build (added)
-
tags/1.3/build/besan-block-editor.min.css (added)
-
tags/1.3/build/besan-block.min.js (added)
-
tags/1.3/inc (added)
-
tags/1.3/inc/assets.php (added)
-
tags/1.3/inc/options-page.php (added)
-
tags/1.3/inc/plugins-page.php (added)
-
tags/1.3/inc/template-options-page.php (added)
-
tags/1.3/readme.txt (added)
-
tags/1.3/source (added)
-
tags/1.3/source/blocks (added)
-
tags/1.3/source/blocks/chart (added)
-
tags/1.3/source/blocks/chart/bar-horizontal.php (added)
-
tags/1.3/source/blocks/chart/bar-vertical.php (added)
-
tags/1.3/source/blocks/chart/block.json (added)
-
tags/1.3/source/blocks/chart/edit.js (added)
-
tags/1.3/source/blocks/chart/icons.js (added)
-
tags/1.3/source/blocks/chart/index.js (added)
-
tags/1.3/source/blocks/chart/register.php (added)
-
tags/1.3/source/blocks/chart/sheet-data.php (added)
-
tags/1.3/source/scss (added)
-
tags/1.3/source/scss/component (added)
-
tags/1.3/source/scss/component/_block-editor.scss (added)
-
tags/1.3/source/scss/component/_editor-note.scss (added)
-
tags/1.3/source/scss/component/_form.scss (added)
-
tags/1.3/source/scss/component/_instructions.scss (added)
-
tags/1.3/source/scss/editor.scss (added)
-
tags/1.3/source/scss/global (added)
-
tags/1.3/source/scss/global/_colors.scss (added)
-
trunk/besan-block.php (modified) (1 diff)
-
trunk/build/besan-block.min.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/source/blocks/chart/block.json (added)
-
trunk/source/blocks/chart/edit.js (modified) (3 diffs)
-
trunk/source/blocks/chart/index.js (modified) (2 diffs)
-
trunk/source/blocks/chart/register.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
besan-block/trunk/besan-block.php
r2662402 r2887836 4 4 * Plugin Name: Besan Block 5 5 * Description: This WordPress plugin adds a charting block to the post editor. 6 * Version: 1. 2.16 * Version: 1.3 7 7 * Author: Joni Halabi 8 8 * Author URI: https://jhalabi.com -
besan-block/trunk/build/besan-block.min.js
r2809361 r2887836 1 !function l(n,c,r){function o(t,e){if(!c[t]){if(!n[t]){var a="function"==typeof require&&require;if(!e&&a)return a(t,!0);if(i)return i(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}a=c[t]={exports:{}},n[t][0].call(a.exports,function(e){return o(n[t][1][e]||e)},a,a.exports,l,n,c,r)}return c[t].exports}for(var i="function"==typeof require&&require,e=0;e<r.length;e++)o(r[e]);return o}({1:[function(e,t,a){ "use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var p=(e=e("./icons.js"))&&e.__esModule?e:{default:e};a.default=function(e){var t=wp.blockEditor.InspectorControls,a=wp.components,l=a.ColorPicker,n=a.Panel,c=a.PanelBody,r=a.SelectControl,a=a.TextControl,o=wp.element.Fragment,i=e.setAttributes,e=e.attributes,s=e.data,h=e.column,u=e.type,d=e.title,m=e.caption,e=e.color;return React.createElement(o,null,React.createElement(t,null,React.createElement(n,null,React.createElement(c,{title:"Data source"},React.createElement("p",{className:"besan-editor-note info"},"Enter your Google Sheet URL and the letter of the column to be included in this chart. The Google Sheet ",React.createElement("em",null,"must")," be publicly viewable."),!besanOptions.apiKey&&React.createElement("p",{className:"besan-editor-note warning"},React.createElement("strong",null,"Important!")," ",React.createElement("br",null),"You have no Google Sheets API key defined. The chart will not display without this key. Please enter your API key on the",React.createElement("a",{href:"/wp-admin/options-general.php?page=besan_options"},"Besan Block settings page"),"."),React.createElement(a,{label:"Google Sheets URL",value:s,onChange:function(e){i({data:e})}}),React.createElement(a,{label:"Column",value:h,onChange:function(e){i({column:e})}}))),React.createElement(n,null,React.createElement(c,{title:"Display options"},React.createElement(r,{label:"Chart type",value:u,options:[{label:"Vertical Bar",value:"bar-vertical"},{label:"Horizontal Bar",value:"bar-horizontal"}],onChange:function(e){i({type:e})}}),React.createElement("label",null,"Chart color",React.createElement(l,{color:e,onChangeComplete:function(e){i({color:e.hex})},disableAlpha:!0})))),React.createElement(n,null,React.createElement(c,{title:"Accessibility"},React.createElement("p",{className:"besan-editor-note info"},"Type a short description of the chart. This should be different from the caption. The title will not be visible to sighted users, but will be used as the internal title of the chart to make it more accessible for screen reader users."),React.createElement(a,{label:"Chart title",value:d,onChange:function(e){i({title:e})}})))),React.createElement("div",{id:"besan-chart-edit"},"bar-vertical"==u&&React.createElement("div",{className:"besan-placeholder",style:{fill:e}},p.default.barVertical),"bar-horizontal"==u&&React.createElement("div",{className:"besan-placeholder",style:{fill:e}},p.default.barHorizontal),React.createElement(a,{value:m,placeholder:"Write chart caption...",onChange:function(e){i({caption:e})},className:"besan-edit-caption"})))}},{"./icons.js":2}],2:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0,a.default={block:React.createElement("svg",{height:"20px",width:"20px",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96"},React.createElement("polygon",{points:"65.002,81.921 58.469,81.921 37.532,81.921 30.998,81.921 10.063,81.921 6.25,81.921 6.25,85.086 89.75,85.086 89.75,81.921 85.938,81.921"}),React.createElement("rect",{x:"11.563",y:"47.454",width:"17.936",height:"32.967"}),React.createElement("rect",{x:"66.502",y:"36.569",width:"17.936",height:"43.852"}),React.createElement("rect",{x:"39.032",y:"10.914",width:"17.937",height:"69.507"})),barVertical:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M4.667 12.666H21.333V79H4.667z"}),React.createElement("path",{d:"M29.333 40H46V79H29.333z"}),React.createElement("path",{d:"M78.667 29.666H95.333V79H78.667z"}),React.createElement("path",{d:"M53.999 19.333H70.667V79H53.999z"}),React.createElement("path",{d:"M5.667 85.334H94.333V87.334H5.667z"}))),barHorizontal:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",transform:"rotate(90)",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M4.667 12.666H21.333V79H4.667z"}),React.createElement("path",{d:"M29.333 40H46V79H29.333z"}),React.createElement("path",{d:"M78.667 29.666H95.333V79H78.667z"}),React.createElement("path",{d:"M53.999 19.333H70.667V79H53.999z"}),React.createElement("path",{d:"M5.667 85.334H94.333V87.334H5.667z"}))),pie:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M51.326 51.792l6.885 39.892c12.571-2.471 23.174-10.497 29.127-21.412l-36.012-18.48z"}),React.createElement("path",{d:"M50 92.487c2.12 0 4.203-.161 6.241-.462L49 49.987V7.513C26.027 8.048 7.5 26.888 7.5 49.987c0 23.435 19.065 42.5 42.5 42.5z"}),React.createElement("path",{d:"M51 7.513v41.864l37.253 19.117A42.242 42.242 0 0092.5 49.988c0-23.1-18.527-41.94-41.5-42.475z"})))}},{}],3:[function(e,t,a){"use strict";var l=n(e("./icons.js")),e=n(e("./edit.js"));function n(e){return e&&e.__esModule?e:{default:e}}(0,wp.blocks.registerBlockType)("tdg/chart",{title:"Chart",description:"Create a chart from data in a Google sheet.",category:"widgets",keywords:["chart","graph","data"],icon:l.default.block,edit:e.default,save:function(){return null}})},{"./edit.js":1,"./icons.js":2}]},{},[3]);1 !function l(n,c,r){function o(t,e){if(!c[t]){if(!n[t]){var a="function"==typeof require&&require;if(!e&&a)return a(t,!0);if(i)return i(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}a=c[t]={exports:{}},n[t][0].call(a.exports,function(e){return o(n[t][1][e]||e)},a,a.exports,l,n,c,r)}return c[t].exports}for(var i="function"==typeof require&&require,e=0;e<r.length;e++)o(r[e]);return o}({1:[function(e,t,a){t.exports={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:2,name:"tdg/chart",title:"Chart",category:"widgets",description:"A block to create a chart from data in a Google sheet.",keywords:["besan block","graph","data"],attributes:{data:{type:"string",default:""},column:{type:"string",default:"A"},type:{type:"string",default:"bar-vertical"},title:{type:"string",default:""},caption:{type:"string",default:""},color:{type:"string",default:"#000000"}},example:{}}},{}],2:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var m=(e=e("./icons.js"))&&e.__esModule?e:{default:e};a.default=function(e){var t=wp.blockEditor,a=t.InspectorControls,t=t.useBlockProps,l=wp.components,n=l.ColorPicker,c=l.Panel,r=l.PanelBody,o=l.SelectControl,l=l.TextControl,i=e.setAttributes,e=e.attributes,s=e.data,h=e.column,u=e.type,d=e.title,p=e.caption,e=e.color,t=t();return React.createElement("div",t,React.createElement(a,null,React.createElement(c,null,React.createElement(r,{title:"Data source"},React.createElement("p",{className:"besan-editor-note info"},"Enter your Google Sheet URL and the letter of the column to be included in this chart. The Google Sheet ",React.createElement("em",null,"must")," be publicly viewable."),!besanOptions.apiKey&&React.createElement("p",{className:"besan-editor-note warning"},React.createElement("strong",null,"Important!")," ",React.createElement("br",null),"You have no Google Sheets API key defined. The chart will not display without this key. Please enter your API key on the",React.createElement("a",{href:"/wp-admin/options-general.php?page=besan_options"},"Besan Block settings page"),"."),React.createElement(l,{label:"Google Sheets URL",value:s,onChange:function(e){i({data:e})}}),React.createElement(l,{label:"Column",value:h,onChange:function(e){i({column:e})}}))),React.createElement(c,null,React.createElement(r,{title:"Display options"},React.createElement(o,{label:"Chart type",value:u,options:[{label:"Vertical Bar",value:"bar-vertical"},{label:"Horizontal Bar",value:"bar-horizontal"}],onChange:function(e){i({type:e})}}),React.createElement("label",null,"Chart color",React.createElement(n,{color:e,onChangeComplete:function(e){i({color:e.hex})},disableAlpha:!0})))),React.createElement(c,null,React.createElement(r,{title:"Accessibility"},React.createElement("p",{className:"besan-editor-note info"},"Type a short description of the chart. This should be different from the caption. The title will not be visible to sighted users, but will be used as the internal title of the chart to make it more accessible for screen reader users."),React.createElement(l,{label:"Chart title",value:d,onChange:function(e){i({title:e})}})))),React.createElement("div",{id:"besan-chart-edit"},"bar-vertical"==u&&React.createElement("div",{className:"besan-placeholder",style:{fill:e}},m.default.barVertical),"bar-horizontal"==u&&React.createElement("div",{className:"besan-placeholder",style:{fill:e}},m.default.barHorizontal),React.createElement(l,{value:p,placeholder:"Write chart caption...",onChange:function(e){i({caption:e})},className:"besan-edit-caption"})))}},{"./icons.js":3}],3:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0,a.default={block:React.createElement("svg",{height:"20px",width:"20px",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96"},React.createElement("polygon",{points:"65.002,81.921 58.469,81.921 37.532,81.921 30.998,81.921 10.063,81.921 6.25,81.921 6.25,85.086 89.75,85.086 89.75,81.921 85.938,81.921"}),React.createElement("rect",{x:"11.563",y:"47.454",width:"17.936",height:"32.967"}),React.createElement("rect",{x:"66.502",y:"36.569",width:"17.936",height:"43.852"}),React.createElement("rect",{x:"39.032",y:"10.914",width:"17.937",height:"69.507"})),barVertical:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M4.667 12.666H21.333V79H4.667z"}),React.createElement("path",{d:"M29.333 40H46V79H29.333z"}),React.createElement("path",{d:"M78.667 29.666H95.333V79H78.667z"}),React.createElement("path",{d:"M53.999 19.333H70.667V79H53.999z"}),React.createElement("path",{d:"M5.667 85.334H94.333V87.334H5.667z"}))),barHorizontal:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",transform:"rotate(90)",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M4.667 12.666H21.333V79H4.667z"}),React.createElement("path",{d:"M29.333 40H46V79H29.333z"}),React.createElement("path",{d:"M78.667 29.666H95.333V79H78.667z"}),React.createElement("path",{d:"M53.999 19.333H70.667V79H53.999z"}),React.createElement("path",{d:"M5.667 85.334H94.333V87.334H5.667z"}))),pie:React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1200",height:"1200",viewBox:"0 0 1200 1200"},React.createElement("rect",{width:"100%",height:"100%",fill:"#eee"}),React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",viewBox:"0 0 100 100"},React.createElement("path",{d:"M51.326 51.792l6.885 39.892c12.571-2.471 23.174-10.497 29.127-21.412l-36.012-18.48z"}),React.createElement("path",{d:"M50 92.487c2.12 0 4.203-.161 6.241-.462L49 49.987V7.513C26.027 8.048 7.5 26.888 7.5 49.987c0 23.435 19.065 42.5 42.5 42.5z"}),React.createElement("path",{d:"M51 7.513v41.864l37.253 19.117A42.242 42.242 0 0092.5 49.988c0-23.1-18.527-41.94-41.5-42.475z"})))}},{}],4:[function(e,t,a){"use strict";var l=c(e("./icons.js")),n=c(e("./edit.js")),e=c(e("./block.json"));function c(e){return e&&e.__esModule?e:{default:e}}(0,wp.blocks.registerBlockType)(e.default,{icon:l.default.block,edit:n.default,save:function(){return null}})},{"./block.json":1,"./edit.js":2,"./icons.js":3}]},{},[4]); -
besan-block/trunk/readme.txt
r2809361 r2887836 5 5 Requires at least: 5.0 6 6 Requires PHP: 7.0 7 Tested up to: 6. 18 Stable tag: 1. 27 Tested up to: 6.2 8 Stable tag: 1.3 9 9 10 10 Add a responsive and accessible data chart block to posts and pages. … … 54 54 == Changelog == 55 55 56 = 1.3 = 57 * Tested plugin with WordPress core 6.2. 58 * Block code refactoring to keep up with current Gutenberg API standards. 59 56 60 = 1.2 = 57 61 * Tested plugin with WordPress core 5.7. -
besan-block/trunk/source/blocks/chart/edit.js
r2447722 r2887836 7 7 const besanEdit = ( props ) => { 8 8 9 const { InspectorControls } = wp.blockEditor;9 const { InspectorControls, useBlockProps } = wp.blockEditor; 10 10 const { ColorPicker, Panel, PanelBody, SelectControl, TextControl } = wp.components; 11 const { Fragment } = wp.element;12 11 13 12 // Get the values needed from props. 14 13 const { setAttributes } = props; 15 14 const { data, column, type, title, caption, color } = props.attributes; 15 const blockProps = useBlockProps(); 16 16 17 17 // Declare change event handlers. … … 25 25 // Return the edit UI. 26 26 return ( 27 < Fragment>27 <div { ...blockProps }> 28 28 29 29 <InspectorControls> … … 142 142 </div> 143 143 144 </ Fragment>144 </div> 145 145 ); 146 146 }; -
besan-block/trunk/source/blocks/chart/index.js
r2447722 r2887836 3 3 */ 4 4 5 import besanIcons from './icons.js'; 6 import besanEdit from './edit.js'; 5 import { default as Icons } from './icons.js'; 6 import { default as Edit } from './edit.js'; 7 import { default as Metadata } from './block.json'; 7 8 8 9 ( function() { … … 10 11 const { registerBlockType } = wp.blocks; 11 12 12 registerBlockType( 'tdg/chart', { 13 title: 'Chart', 14 description: 'Create a chart from data in a Google sheet.', 15 category: 'widgets', 16 keywords: [ 'chart', 'graph', 'data' ], 17 icon: besanIcons.block, 18 edit: besanEdit, 13 registerBlockType( Metadata, { 14 icon: Icons.block, 15 edit: Edit, 19 16 save: () => { return null; } 20 17 } ); -
besan-block/trunk/source/blocks/chart/register.php
r2447722 r2887836 31 31 */ 32 32 public function register(): void { 33 register_block_type( 'tdg/chart', [ 34 // Set up block attributes. 35 'attributes' => [ 36 'data' => [ 'type' => 'string', 'default' => '' ], 37 'column' => [ 'type' => 'string', 'default' => 'A' ], 38 'type' => [ 'type' => 'string', 'default' => 'bar-vertical' ], 39 'title' => [ 'type' => 'string', 'default' => '' ], 40 'caption' => [ 'type' => 'string', 'default' => '' ], 41 'color' => [ 'type' => 'string', 'default' => '#000000' ] 42 ], 43 44 // Declare render callback function. 33 register_block_type( __DIR__, [ 45 34 'render_callback' => [ $this, 'render' ] 46 35 ] );
Note: See TracChangeset
for help on using the changeset viewer.