Skip to content

Commit

Permalink
Add block alignment support
Browse files Browse the repository at this point in the history
  • Loading branch information
yscik committed Dec 18, 2020
1 parent 7bdd08b commit 25242b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/code-block/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default {
},
supports: {
html: false,
align: true,
},
transforms,
edit,
Expand Down
3 changes: 3 additions & 0 deletions syntaxhighlighter.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,9 @@ public function render_block( $attributes, $content ) {
'quickCode' => 'quickcode',
);
$classNames = ! empty( $attributes['className'] ) ? [ esc_attr( $attributes['className'] ) ] : [];
if( ! empty( $attributes['align'] ) ) {
$classNames[] = 'align' . esc_attr( $attributes['align'] );
}

foreach ( $remaps as $from => $to ) {
if ( isset( $attributes[ $from ] ) ) {
Expand Down

0 comments on commit 25242b9

Please sign in to comment.