/** * Random Quote Block Editor */ import { registerBlockType } from '@wordpress/blocks'; import { ToggleControl, RangeControl } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { BlockEditor } from '../components/BlockEditor'; import { CategoryControl } from '../components/CategoryControl'; import { DisableStylingControl } from '../components/DisableStylingControl'; interface RandomQuoteAttributes { categories: string; sequence: boolean; multi: number; disableaspect: boolean; enableAjax: boolean; timer: number; cacheBypass: boolean; } interface RandomQuoteProps { attributes: RandomQuoteAttributes; setAttributes: (attributes: Partial) => void; } registerBlockType('xv-random-quotes/random-quote', { edit: (props: RandomQuoteProps) => { const { attributes, setAttributes } = props; return ( setAttributes({ categories: value })} /> setAttributes({ multi: value || 1 })} min={1} max={10} help={__('How many quotes to display', 'xv-random-quotes')} /> setAttributes({ sequence: value })} help={__('Show quotes in order instead of random', 'xv-random-quotes')} /> setAttributes({ disableaspect: value })} /> setAttributes({ enableAjax: value })} /> {attributes.enableAjax && ( <> setAttributes({ timer: value })} min={0} max={300} help={__('0 = no auto-refresh', 'xv-random-quotes')} /> setAttributes({ cacheBypass: value })} help={__('Fetch a fresh quote on every page load, even when the page is cached', 'xv-random-quotes')} /> )} ); }, save: () => null, // Server-side rendered });