Skip to content

Commit

Permalink
Stabilize the clearBlockSelection editor setting (#47627)
Browse files Browse the repository at this point in the history
* Stabilize the clearBlockSelection editor setting

* Remove comment
  • Loading branch information
talldan committed Feb 1, 2023
1 parent d9da125 commit 64f44e3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,8 @@ _Properties_
- _codeEditingEnabled_ `boolean`: Whether or not the user can switch to the code editor
- _generateAnchors_ `boolean`: Enable/Disable auto anchor generation for Heading blocks
- _enableOpenverseMediaCategory_ `boolean`: Enable/Disable the Openverse media category in the inserter.
- _clearBlockSelection_ `boolean`: Whether the block editor should clear selection on mousedown when a block is not clicked.
- _\_\_experimentalCanUserUseUnfilteredHTML_ `boolean`: Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
- _\_\_experimentalClearBlockSelection_ `boolean`: Whether the block editor should clear selection on mousedown when a block is not clicked.
- _\_\_experimentalBlockDirectory_ `boolean`: Whether the user has enabled the Block Directory
- _\_\_experimentalBlockPatterns_ `Array`: Array of objects representing the block patterns
- _\_\_experimentalBlockPatternCategories_ `Array`: Array of objects representing the block pattern categories
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function useBlockSelectionClearer() {
const { getSettings, hasSelectedBlock, hasMultiSelection } =
useSelect( blockEditorStore );
const { clearSelectedBlock } = useDispatch( blockEditorStore );
const { __experimentalClearBlockSelection: isEnabled } = getSettings();
const { clearBlockSelection: isEnabled } = getSettings();

return useRefEffect(
( node ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const defaultUseSelectValues = {
hasSelectedBlock: jest.fn().mockReturnValue( false ),
hasMultiSelection: jest.fn().mockReturnValue( false ),
getSettings: jest.fn().mockReturnValue( {
__experimentalClearBlockSelection: true,
clearBlockSelection: true,
} ),
};

Expand Down Expand Up @@ -98,7 +98,7 @@ describe( 'BlockSelectionClearer component', () => {
...defaultUseSelectValues,
hasSelectedBlock: jest.fn().mockReturnValue( true ),
getSettings: jest.fn().mockReturnValue( {
__experimentalClearBlockSelection: false,
clearBlockSelection: false,
} ),
} ) );
useDispatch.mockImplementation( () => ( {
Expand Down
5 changes: 3 additions & 2 deletions packages/block-editor/src/store/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export const PREFERENCES_DEFAULTS = {
* @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor
* @property {boolean} generateAnchors Enable/Disable auto anchor generation for Heading blocks
* @property {boolean} enableOpenverseMediaCategory Enable/Disable the Openverse media category in the inserter.
* @property {boolean} clearBlockSelection Whether the block editor should clear selection on mousedown when a block is not clicked.
* @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
* @property {boolean} __experimentalClearBlockSelection Whether the block editor should clear selection on mousedown when a block is not clicked.
* @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory
* @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns
* @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories
Expand Down Expand Up @@ -160,8 +160,9 @@ export const SETTINGS_DEFAULTS = {
// Allows to disable Openverse media category in the inserter.
enableOpenverseMediaCategory: true,

clearBlockSelection: true,

__experimentalCanUserUseUnfilteredHTML: false,
__experimentalClearBlockSelection: true,
__experimentalBlockDirectory: false,
__mobileEnablePageTemplates: false,
__experimentalBlockPatterns: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const EMPTY_BLOCKS_LIST = [];
const BLOCK_EDITOR_SETTINGS = [
'__experimentalBlockDirectory',
'__experimentalBlockInspectorAnimation',
'__experimentalClearBlockSelection',
'__experimentalDiscussionSettings',
'__experimentalFeatures',
'__experimentalGlobalStylesBaseStyles',
Expand All @@ -36,6 +35,7 @@ const BLOCK_EDITOR_SETTINGS = [
'bodyPlaceholder',
'canLockBlocks',
'capabilities',
'clearBlockSelection',
'codeEditingEnabled',
'colors',
'disableCustomColors',
Expand Down

1 comment on commit 64f44e3

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 64f44e3.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4061925936
📝 Reported issues:

Please sign in to comment.