Skip to content

Commit 3837bbc

Browse files
authored
Merge pull request #126 from Automattic/add/quick-code-option
Add quick code option to settings and shortcode parameters
2 parents 2a684b0 + 9e736a0 commit 3837bbc

File tree

2 files changed

+88
-49
lines changed

2 files changed

+88
-49
lines changed

src/blocks.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ registerBlockType( 'syntaxhighlighter/code', {
6969
type: 'boolean',
7070
default: syntaxHighlighterData.settings.makeURLsClickable.default,
7171
},
72+
73+
quickCode: {
74+
type: 'boolean',
75+
default: syntaxHighlighterData.settings.quickCode.default,
76+
},
7277
},
7378

7479
supports: {
@@ -128,7 +133,8 @@ registerBlockType( 'syntaxhighlighter/code', {
128133
firstLineNumber,
129134
highlightLines,
130135
wrapLines,
131-
makeURLsClickable
136+
makeURLsClickable,
137+
quickCode
132138
} = attributes;
133139

134140
let blockSettingRows = [];
@@ -250,6 +256,24 @@ registerBlockType( 'syntaxhighlighter/code', {
250256
);
251257
}
252258

259+
// Quick code
260+
if ( syntaxHighlighterData.settings.quickCode.supported ) {
261+
blockSettingRows.push(
262+
wp.element.createElement(
263+
PanelRow,
264+
null,
265+
wp.element.createElement(
266+
ToggleControl,
267+
{
268+
label: __( 'Enable edit mode on double click', 'syntaxhighlighter' ),
269+
checked: quickCode,
270+
onChange: ( quickCode ) => setAttributes( { quickCode } ),
271+
}
272+
)
273+
)
274+
);
275+
}
276+
253277
const blockSettings = (
254278
<InspectorControls key="syntaxHighlighterInspectorControls">
255279
<PanelBody title={ __( 'Settings', 'syntaxhighlighter' ) }>

0 commit comments

Comments
 (0)