@teft/editor-tools

5.1.3 • 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>
		</>
	);
}

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @teft/editor-tools

    Weekly Downloads

    18

    Version

    5.1.3

    License

    GPL-2.0-or-later

    Unpacked Size

    352 kB

    Total Files

    90

    Last publish

    Collaborators

    • stian-overasen
    • peroks
    • walbo
    • olethomas