Skip to content

Commit 71c0a3c

Browse files
committed
Reorg
1 parent cd8b899 commit 71c0a3c

File tree

13 files changed

+90
-65
lines changed

13 files changed

+90
-65
lines changed

includes/MslsPlugin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function filter_string( $pref = '<p id="msls">', $post = '</p>' ) {
217217
*/
218218
public function block_init() {
219219
if ( ! $this->options->is_excluded() ) {
220-
register_block_type( self::plugin_dir_path('dist/msls-widget-block' ) );
220+
register_block_type( self::plugin_dir_path('js/msls-widget-block' ) );
221221
add_shortcode( 'sc_msls_widget', [ $this, 'block_render' ] );
222222

223223
return true;
@@ -251,15 +251,15 @@ public function custom_enqueue() {
251251
return false;
252252
}
253253

254-
$ver = defined( 'MSLS_PLUGIN_VERSION' ) ? constant( 'MSLS_PLUGIN_VERSION' ) : false;
255-
$postfix = defined( 'SCRIPT_DEBUG' ) && constant( 'SCRIPT_DEBUG' ) ? '' : '.min';
254+
$ver = defined( 'MSLS_PLUGIN_VERSION' ) ? constant( 'MSLS_PLUGIN_VERSION' ) : false;
255+
$folder = defined( 'SCRIPT_DEBUG' ) && constant( 'SCRIPT_DEBUG' ) ? 'src' : 'js';
256256

257257
wp_enqueue_style( 'msls-styles', self::plugins_url( 'css/msls.css' ), [], $ver );
258258
wp_enqueue_style( 'msls-flags', self::plugins_url( 'css-flags/css/flag-icon.min.css' ), [], $ver );
259259

260260
if ( $this->options->activate_autocomplete ) {
261261
wp_enqueue_script( 'msls-autocomplete',
262-
self::plugins_url( "js/msls{$postfix}.js" ),
262+
self::plugins_url( "$folder/msls.js" ),
263263
[ 'jquery-ui-autocomplete' ],
264264
$ver );
265265

js/msls-widget-block/index.asset.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components'), 'version' => '627848d7182ac425e62c');

js/msls-widget-block/index.js

Lines changed: 1 addition & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/msls.js

Lines changed: 1 addition & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/msls.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"scripts": {
3-
"uglify": "uglifyjs js/msls.js > js/msls.min.js",
3+
"uglify": "uglifyjs src/msls.js > js/msls.js",
44
"less": "lessc css/msls.less css/msls.css --clean-css=\"--s1 --advanced\"",
5-
"build-msls-block": "wp-scripts build js/msls-widget-block/index.js --webpack-src-dir=js/msls-widget-block --output-path=dist/msls-widget-block",
5+
"build-msls-block": "wp-scripts build src/msls-widget-block/index.js --webpack-src-dir=src/msls-widget-block --output-path=js/msls-widget-block",
66
"build": "npm run uglify && npm run less && npm run build-msls-block"
77
},
88
"dependencies": {
File renamed without changes.

src/msls-widget-block/block.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://schemas.wp.org/trunk/block.json",
3+
"apiVersion": 3,
4+
"title": "Multisite Language Switcher",
5+
"icon": "translation",
6+
"category": "widgets",
7+
"name": "lloc/msls-widget-block",
8+
"version": "2.6.4",
9+
"description": "This is the output form the_msls() that comes with the Multisite Language Switcher plugin as a Gutenberg block.",
10+
"example": {},
11+
"supports": {
12+
"html": false
13+
},
14+
"textdomain": "multisite-language-switcher",
15+
"editorScript": "file:./index.js",
16+
"render": "file:./render.php"
17+
}
File renamed without changes.

src/msls-widget-block/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { registerBlockType } from '@wordpress/blocks';
2+
3+
import Edit from './edit';
4+
import metadata from './block.json';
5+
6+
registerBlockType(metadata.name, {
7+
edit: Edit
8+
} );

0 commit comments

Comments
 (0)