Skip to content

Commit

Permalink
localisation in js
Browse files Browse the repository at this point in the history
  • Loading branch information
mtoensing committed Apr 22, 2020
1 parent 87daf07 commit 8f614aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: SimpleTOC - Table of Contents Block
* Plugin URI: https://github.com/mtoensing/simpletoc
* Description: Adds a basic "Table of Contents" Gutenberg block.
* Version: 1.3
* Version: 1.4
* Author: MarcDK
* Author URI: marc.tv
* Text Domain: simpletoc
Expand Down
19 changes: 8 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
const { __, setLocaleData } = wp.i18n;
const { __ } = wp.i18n;
const el = wp.element.createElement;
const registerBlockType = wp.blocks.registerBlockType;
const BlockControls = wp.blockEditor.BlockControls;
const ServerSideRender = wp.serverSideRender;
const Toolbar = wp.components.Toolbar;
const IconButton = wp.components.Button;
const simpletoc = wp.element.createElement('svg',
{
width: 20,
Expand All @@ -10,14 +16,6 @@ const simpletoc = wp.element.createElement('svg',
}
)
);
const el = wp.element.createElement;
const registerBlockType = wp.blocks.registerBlockType;
const BlockControls = wp.blockEditor.BlockControls;
const ServerSideRender = wp.serverSideRender;
const Toolbar = wp.components.Toolbar;
const IconButton = wp.components.Button;



function sendfakeAttribute(props) {
// this acuallty triggers the ServerSideRender again ¯\_(ツ)_/¯
Expand All @@ -29,7 +27,6 @@ registerBlockType( 'simpletoc/toc', {
icon: simpletoc,
category: 'layout',
edit: function( props ) {

return [
el(
BlockControls,
Expand All @@ -41,7 +38,7 @@ registerBlockType( 'simpletoc/toc', {
IconButton,
{
className: 'components-icon-button components-toolbar__control',
label: __( 'update' , simpletoc ),
label: __( 'update' , 'simpletoc' ),
onClick: function() { sendfakeAttribute(props) },
icon: 'update'
}
Expand Down

0 comments on commit 8f614aa

Please sign in to comment.