Skip to content

Commit

Permalink
Issue #9 - add transform from core blocks. Change text attr to Textar…
Browse files Browse the repository at this point in the history
…eaControl to allow transformation from CSS block
  • Loading branch information
bobbingwide committed Jan 9, 2020
1 parent ae7fc8c commit 9713d12
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion blocks/oik-geshi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const {
FormToggle,

TextControl,
TextareaControl,
SelectControl,

} = wp.components;
Expand Down Expand Up @@ -121,6 +122,17 @@ export default registerBlockType(
},
},
],
from: [
{
type: 'block',
blocks: ['core/paragraph', 'core/code', 'core/preformatted'],
transform: function( attributes ) {
return createBlock( 'oik-css/geshi', {
content: attributes.content
});
},
},
],
},


Expand Down Expand Up @@ -174,7 +186,7 @@ export default registerBlockType(
/>
</PanelRow>
<PanelRow>
<TextControl label="Text"
<TextareaControl label="Text"
value={ props.attributes.text }
onChange={ onChangeText }
/>
Expand Down

1 comment on commit 9713d12

@bobbingwide
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the new transforms was dome incorrectly. I shouldn’t have repeated the from:.
The first transform to the oik-css/css block was not available.
Fix is to remove ] from: [.

Please sign in to comment.