Skip to content

Commit

Permalink
Run format script
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Apr 14, 2021
1 parent 1bd5870 commit d4afc4d
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 195 deletions.
6 changes: 3 additions & 3 deletions packages/e2e-tests/plugins/align-hook/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
( function() {
( function () {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.blockEditor.InnerBlocks;
Expand All @@ -10,14 +10,14 @@
var baseBlock = {
icon: 'cart',
category: 'text',
edit: function( props ) {
edit: function ( props ) {
return el(
'div',
{ style: { outline: '1px solid gray', padding: 5 } },
'Test Align Hook'
);
},
save: function() {
save: function () {
return el(
'div',
{ style: { outline: '1px solid gray', padding: 5 } },
Expand Down
24 changes: 12 additions & 12 deletions packages/e2e-tests/plugins/block-icons/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
( function() {
( function () {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.blockEditor.InnerBlocks;
Expand All @@ -21,7 +21,7 @@
icon: svg,
category: 'text',

edit: function() {
edit: function () {
return el(
'div',
{
Expand All @@ -42,7 +42,7 @@
);
},

save: function() {
save: function () {
return el(
'div',
{
Expand All @@ -59,7 +59,7 @@
icon: 'cart',
category: 'text',

edit: function() {
edit: function () {
return el(
'div',
{
Expand All @@ -80,7 +80,7 @@
);
},

save: function() {
save: function () {
return el(
'div',
{
Expand All @@ -94,12 +94,12 @@

registerBlockType( 'test/test-function-icon', {
title: 'TestFunctionIcon',
icon: function() {
icon: function () {
return svg;
},
category: 'text',

edit: function() {
edit: function () {
return el(
'div',
{
Expand All @@ -120,7 +120,7 @@
);
},

save: function() {
save: function () {
return el(
'div',
{
Expand All @@ -141,7 +141,7 @@
},
category: 'text',

edit: function() {
edit: function () {
return el(
'div',
{
Expand All @@ -162,7 +162,7 @@
);
},

save: function() {
save: function () {
return el(
'div',
{
Expand All @@ -182,7 +182,7 @@
},
category: 'text',

edit: function() {
edit: function () {
return el(
'div',
{
Expand All @@ -203,7 +203,7 @@
);
},

save: function() {
save: function () {
return el(
'div',
{
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/block-variations/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
( function() {
( function () {
var el = wp.element.createElement;
var registerBlockVariation = wp.blocks.registerBlockVariation;
var __ = wp.i18n.__;
Expand Down
39 changes: 9 additions & 30 deletions packages/e2e-tests/plugins/child-blocks/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
( function() {
( function () {
const { InnerBlocks } = wp.blockEditor;
const { createElement: el } = wp.element;
const { registerBlockType } = wp.blocks;
Expand All @@ -9,19 +9,11 @@
category: 'text',

edit() {
return el(
'div',
{},
el( InnerBlocks )
);
return el( 'div', {}, el( InnerBlocks ) );
},

save() {
return el(
'div',
{},
el( InnerBlocks.Content )
);
return el( 'div', {}, el( InnerBlocks.Content ) );
},
} );

Expand All @@ -34,19 +26,14 @@
return el(
'div',
{},
el(
InnerBlocks,
{ allowedBlocks: [ 'core/paragraph', 'core/image' ] }
)
el( InnerBlocks, {
allowedBlocks: [ 'core/paragraph', 'core/image' ],
} )
);
},

save() {
return el(
'div',
{},
el( InnerBlocks.Content )
);
return el( 'div', {}, el( InnerBlocks.Content ) );
},
} );

Expand All @@ -61,19 +48,11 @@
],

edit() {
return el(
'div',
{},
'Child'
);
return el( 'div', {}, 'Child' );
},

save() {
return el(
'div',
{},
'Child'
);
return el( 'div', {}, 'Child' );
},
} );
} )();
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
( function() {
( function () {
wp.blocks.registerBlockType( 'test/container-without-paragraph', {
title: 'Container without paragraph',
category: 'text',
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/custom-grouping-block/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
( function() {
( function () {
wp.blocks.registerBlockType( 'test/alternative-group-block', {
title: 'Alternative Group Block',
category: 'design',
Expand Down
18 changes: 9 additions & 9 deletions packages/e2e-tests/plugins/deprecated-node-matcher/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
( function() {
( function () {
var registerBlockType = wp.blocks.registerBlockType;
var RichText = wp.blockEditor.RichText;
var el = wp.element.createElement;
Expand All @@ -13,16 +13,16 @@
},
},
category: 'text',
edit: function( { attributes, setAttributes } ) {
edit: function ( { attributes, setAttributes } ) {
return el( RichText, {
tagName: 'p',
value: attributes.value,
onChange: function( nextValue ) {
onChange: function ( nextValue ) {
setAttributes( { value: nextValue } );
},
} );
},
save: function( { attributes } ) {
save: function ( { attributes } ) {
return el( RichText.Content, {
tagName: 'p',
value: attributes.value,
Expand All @@ -31,13 +31,13 @@
} );

function toRichTextValue( value ) {
return _.map( value, function( subValue ) {
return _.map( value, function ( subValue ) {
return subValue.children;
} );
}

function fromRichTextValue( value ) {
return _.map( value, function( subValue ) {
return _.map( value, function ( subValue ) {
return {
children: subValue,
};
Expand All @@ -59,22 +59,22 @@
},
},
category: 'text',
edit: function( { attributes, setAttributes } ) {
edit: function ( { attributes, setAttributes } ) {
return el(
'blockquote',
{},
el( RichText, {
multiline: 'p',
value: toRichTextValue( attributes.value ),
onChange: function( nextValue ) {
onChange: function ( nextValue ) {
setAttributes( {
value: fromRichTextValue( nextValue ),
} );
},
} )
);
},
save: function( { attributes } ) {
save: function ( { attributes } ) {
return el(
'blockquote',
{},
Expand Down
61 changes: 29 additions & 32 deletions packages/e2e-tests/plugins/format-api/index.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
( function() {
wp.richText.registerFormatType(
'my-plugin/link', {
title: 'Custom Link',
tagName: 'a',
attributes: {
url: 'href',
},
className: 'my-plugin-link',
edit: function( props ) {
return wp.element.createElement(
wp.blockEditor.RichTextToolbarButton, {
icon: 'admin-links',
title: 'Custom Link',
onClick: function() {
props.onChange(
wp.richText.toggleFormat(
props.value, {
type: 'my-plugin/link',
attributes: {
url: 'https://example.com',
}
}
)
);
},
isActive: props.isActive,
}
);
}
}
);
( function () {
wp.richText.registerFormatType( 'my-plugin/link', {
title: 'Custom Link',
tagName: 'a',
attributes: {
url: 'href',
},
className: 'my-plugin-link',
edit: function ( props ) {
return wp.element.createElement(
wp.blockEditor.RichTextToolbarButton,
{
icon: 'admin-links',
title: 'Custom Link',
onClick: function () {
props.onChange(
wp.richText.toggleFormat( props.value, {
type: 'my-plugin/link',
attributes: {
url: 'https://example.com',
},
} )
);
},
isActive: props.isActive,
}
);
},
} );
} )();
24 changes: 9 additions & 15 deletions packages/e2e-tests/plugins/hooks-api/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
( function() {
( function () {
var el = wp.element.createElement;
var Fragment = wp.element.Fragment;
var Button = wp.components.Button;
Expand All @@ -18,36 +18,30 @@
className: 'e2e-reset-block-button',
isSecondary: true,
isLarge: true,
onClick: function() {
onClick: function () {
var emptyBlock = createBlock( props.name );
props.onReplace( emptyBlock );
}
},
},
__( 'Reset Block' )
)
);
}

function addResetBlockButton( BlockEdit ) {
return function( props ) {
return function ( props ) {
return el(
Fragment,
{},
el(
InspectorControls,
{},
el(
ResetBlockButton,
{
name: props.name,
onReplace: props.onReplace
}
)
el( ResetBlockButton, {
name: props.name,
onReplace: props.onReplace,
} )
),
el(
BlockEdit,
props
)
el( BlockEdit, props )
);
};
}
Expand Down
Loading

0 comments on commit d4afc4d

Please sign in to comment.