Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize the clearBlockSelection editor setting #47627

Merged
merged 2 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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