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