Skip to content

Commit

Permalink
Merge pull request #174 from Automattic/fix/editor-tab-size
Browse files Browse the repository at this point in the history
Use tab size from plugin settings in block editor
  • Loading branch information
yscik committed Dec 17, 2020
2 parents 3fbdbd1 + c122636 commit e149228
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/code-block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ export default function editSyntaxHighlighterBlock( { attributes, setAttributes,
content,
} = attributes;

const { settings: { tabSize } } = window.syntaxHighlighterData;

const editView = <div className={ className + ' wp-block-code' }>
<PlainText
className="wp-block-syntaxhighlighter__textarea"
style={ { tabSize, '-moz-tab-size': '' + tabSize } }
value={ content }
onChange={ ( nextContent ) => setAttributes( { content: nextContent } ) }
placeholder={ __( 'Tip: you can choose a code language from the block settings.', 'syntaxhighlighter' ) }
Expand Down
1 change: 1 addition & 0 deletions syntaxhighlighter.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ function enqueue_block_editor_assets() {
'supported' => ( '3' == $this->settings['shversion'] ),
'default' => (bool) $this->settings['quickcode'],
),
'tabSize' => (int) $this->settings['tabsize'],
);

wp_add_inline_script(
Expand Down

0 comments on commit e149228

Please sign in to comment.