Skip to content

Commit

Permalink
proxied getEditorSettings in block-editor (#15807)
Browse files Browse the repository at this point in the history
* proxied getEditorSettings in block-editor

* just do what Riad says

* correct getSettings

* added to the readme the new property in code editor default settings

* docs auto generated
  • Loading branch information
draganescu authored May 24, 2019
1 parent 5b1addd commit 636b7bf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ The default editor settings
isRTL boolean Whether the editor is in RTL mode
bodyPlaceholder string Empty post placeholder
titlePlaceholder string Empty title placeholder
codeEditingEnabled string Whether or not the user can switch to the code editor

<a name="SkipToSelectedBlock" href="#SkipToSelectedBlock">#</a> **SkipToSelectedBlock**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export function BlockModeToggle( { blockType, mode, onToggleMode, small = false,

export default compose( [
withSelect( ( select, { clientId } ) => {
const { getBlock, getBlockMode } = select( 'core/block-editor' );
const { getBlock, getBlockMode, getSettings } = select( 'core/block-editor' );
const block = getBlock( clientId );
const isCodeEditingEnabled = select( 'core/editor' ).getEditorSettings().codeEditingEnabled;
const isCodeEditingEnabled = getSettings().codeEditingEnabled;

return {
mode: getBlockMode( clientId ),
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/store/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const PREFERENCES_DEFAULTS = {
* isRTL boolean Whether the editor is in RTL mode
* bodyPlaceholder string Empty post placeholder
* titlePlaceholder string Empty title placeholder
* codeEditingEnabled string Whether or not the user can switch to the code editor
*/
export const SETTINGS_DEFAULTS = {
alignWide: false,
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class EditorProvider extends Component {
'allowedBlockTypes',
'availableLegacyWidgets',
'bodyPlaceholder',
'codeEditingEnabled',
'colors',
'disableCustomColors',
'disableCustomFontSizes',
Expand Down

0 comments on commit 636b7bf

Please sign in to comment.