Skip to content
Snippets Groups Projects
Commit 1f035e37 authored by Erick Hitter's avatar Erick Hitter
Browse files

Prepare for variation in block editor

parent 41e054f4
Branches
Tags
1 merge request!2Add `core/embed` variation in Block Editor
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
<?php return array('dependencies' => array(), 'version' => '31d6cfe0d16ae931b73c');
......@@ -47,5 +47,7 @@ add_action( 'plugins_loaded', __NAMESPACE__ . '\action_plugins_loaded' );
*/
require_once __DIR__ . '/inc/trait-singleton.php';
require_once __DIR__ . '/inc/class-plugin.php';
require_once __DIR__ . '/inc/class-block-editor.php';
Plugin::get_instance();
Block_Editor::get_instance();
<?php
/**
* Block Editor integration.
*
* @package ETH_Embed_Anchor_FM
*/
namespace ETH_Embed_Anchor_FM;
/**
* Class Block_Editor.
*/
class Block_Editor {
use Singleton;
/**
* Register hooks.
*
* @return void
*/
protected function _setup(): void {
add_action(
'enqueue_block_editor_assets',
[ $this, 'action_enqueue_block_editor_assets' ]
);
}
/**
* Enqueue block editor assets.
*
* @return void
*/
public function action_enqueue_block_editor_assets(): void {
$asset_data = require dirname( __FILE__, 2 )
. '/assets/build/index.asset.php';
wp_enqueue_script(
'eth-embed-anchor-fm-block-editor',
plugins_url(
'assets/build/index.js',
dirname( __FILE__, 2 )
. '/eth-embed-anchor-fm.php'
),
$asset_data['dependencies'],
$asset_data['version'],
true
);
}
}
......@@ -46,7 +46,7 @@ class Plugin {
*
* @return void
*/
private function _setup(): void {
protected function _setup(): void {
add_action( 'init', [ $this, 'action_init' ] );
add_filter(
......
......@@ -44,5 +44,5 @@ trait Singleton {
*
* @return void
*/
abstract function _setup(): void;
abstract protected function _setup(): void;
}
This diff is collapsed.
......@@ -3,7 +3,24 @@
"version": "0.1.0",
"main": "Gruntfile.js",
"author": "Erick Hitter",
"scripts": {
"build": "wp-scripts build",
"check-engines": "wp-scripts check-engines",
"check-licenses": "wp-scripts check-licenses",
"format": "wp-scripts format",
"lint:css": "wp-scripts lint-style",
"lint:js": "wp-scripts lint-js",
"lint:md:docs": "wp-scripts lint-md-docs",
"lint:pkg-json": "wp-scripts lint-pkg-json",
"packages-update": "wp-scripts packages-update",
"plugin-zip": "wp-scripts plugin-zip",
"start": "wp-scripts start",
"test": "npm run test:e2e && npm run test:unit",
"test:e2e": "wp-scripts test-e2e --passWithNoTests",
"test:unit": "wp-scripts test-unit-js --passWithNoTests"
},
"devDependencies": {
"@wordpress/scripts": "^23.5.0",
"grunt": "^1.5.3",
"grunt-wp-i18n": "^1.0.3",
"grunt-wp-readme-to-markdown": "^2.1.0"
......
const config = require( './node_modules/@wordpress/scripts/config/webpack.config' );
const { resolve } = require( 'path' );
config.entry = {
index: './assets/src/index.js',
};
config.output.path = resolve( process.cwd(), 'assets/build' );
module.exports = config;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment