@teft/editor-tools

5.1.2 • Public • Published

Editor tools

Installation

Install the module

npm install @teft/editor-tools

Post Selector

image

Example:

import { PostSelector } from '@teft/editor-tools';
import { useState } from '@wordpress/element';

const [ postIds, setPostIds ] = useState( [] );
const [ visible, setVisible ] = useState( false );

{ visible && (
	<PostSelector
		ids={ postIds }
		onSelect={ ( ids ) => setPostIds( ids ) }
		onClose={ () => setVisible( false ) }
		postTypes={ [ 'post', 'page' ] }
	/>
) }

Query Sidebar

Example:

import { QuerySidebarOptions, queryServerAttributes } from '@teft/editor-tools';

function Edit( { attributes, setAttributes } ) {
	return (
		<>
			<QuerySidebarOptions
				attributes={ attributes }
				setAttributes={ setAttributes }
			/>

			<Disabled>
				<ServerSideRender
					block="teft/cards-query"
					attributes={ queryServerAttributes( attributes ) }
				/>
			</Disabled>
		</>
	);
}

Readme

Keywords

Package Sidebar

Install

npm i @teft/editor-tools

Weekly Downloads

27

Version

5.1.2

License

GPL-2.0-or-later

Unpacked Size

352 kB

Total Files

90

Last publish

Collaborators

  • peroks
  • walbo
  • olethomas