Editor Tools

Usage

@t2/editor is available under the global variable t2.editor. Easiest way to add support in your project is to use the @wordpress/dependency-extraction-webpack-plugin and add it to your webpack config.
new DependencyExtractionWebpackPlugin({
	injectPolyfill: true,
	requestToHandle(request) {
		if (request === '@t2/editor') {
			return 't2-editor';
		}
	},
	requestToExternal(request) {
		if (request === '@t2/editor') {
			return ['t2', 'editor'];
		}
	},
})
This will add @t2/editor to the external assets and include it as a dependency in your script.assets.php file. It also makes it possible to import it a a module without the source code beeing bundled with your script.

Available Packages

Iconsarrow_forward

JavaScript utilities for working with icons in T2.

Media Placeholderarrow_forward

Media placeholder component.

Media Previewerarrow_forward

Media previewer component.

Media Replacerarrow_forward

Media replacer component.

PostSelectorarrow_forward

Post Selector component.

URL Pickerarrow_forward

URL picker component.

T2 Config utilitiesarrow_forward

T2 Config utilities for getting t2 config variables.

Block height controlarrow_forward

Control for setting block min height.

Image size selectorarrow_forward

Control for selecting the image size.

T2 Background Media Supportsarrow_forward

Custom background media support for blocks.

T2 Grid Supportsarrow_forward

Custom block support for grid layouts.

T2 Minimum Height Supportsarrow_forward

Custom minimum height support for blocks.

Horizontal Align Dropdownarrow_forward

A dropdown displaying options for horizontal alignments.

Inspector Dropdownarrow_forward

Base control for displaying dropdowns in the inspector panel.

Layout Dropdownarrow_forward

A dropdown displaying layout options for a block.

Size Range Controlarrow_forward

A generic range control for selecting sizes.

Vertical Align Dropdownarrow_forward

A dropdown displaying options for vertical alignments.

BlockIconSelectorarrow_forward

Block toolbar component for selecting T2 Icons.

IconSelectorarrow_forward

Icon Selector component for selecting T2 Icons.