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

Block Editor: Stabilize 'generateAnchors' setting #40143

Merged
merged 2 commits into from
Apr 7, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 @@ -599,11 +599,11 @@ _Properties_
- _bodyPlaceholder_ `string`: Empty post placeholder
- _titlePlaceholder_ `string`: Empty title placeholder
- _codeEditingEnabled_ `boolean`: Whether or not the user can switch to the code editor
- _generateAnchors_ `boolean`: Enable/Disable auto anchor generation for Heading blocks
- _\_\_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.
- _\_\_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
- _\_\_experimentalGenerateAnchors_ `boolean`: Enable/Disable auto anchor generation for Heading blocks
- _\_\_experimentalCanLockBlocks_ `boolean`: Whether the user can manage Block Lock state
- _\_\_unstableGalleryWithImageBlocks_ `boolean`: Whether the user has enabled the refactored gallery block which uses InnerBlocks

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 @@ -24,11 +24,11 @@ export const PREFERENCES_DEFAULTS = {
* @property {string} bodyPlaceholder Empty post placeholder
* @property {string} titlePlaceholder Empty title placeholder
* @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} __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} __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
* @property {boolean} __experimentalGenerateAnchors Enable/Disable auto anchor generation for Heading blocks
* @property {boolean} __experimentalCanLockBlocks Whether the user can manage Block Lock state
* @property {boolean} __unstableGalleryWithImageBlocks Whether the user has enabled the refactored gallery block which uses InnerBlocks
*/
Expand Down Expand Up @@ -158,9 +158,10 @@ export const SETTINGS_DEFAULTS = {
__experimentalBlockPatterns: [],
__experimentalBlockPatternCategories: [],
__experimentalSpotlightEntityBlocks: [],
__experimentalGenerateAnchors: false,
__experimentalCanLockBlocks: true,
__unstableGalleryWithImageBlocks: false,

generateAnchors: false,
// gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
// The setting is only kept for backward compatibility purposes.
gradients: [
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/heading/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function HeadingEdit( {
const settings = select( blockEditorStore ).getSettings();

return {
canGenerateAnchors: !! settings.__experimentalGenerateAnchors,
canGenerateAnchors: !! settings.generateAnchors,
};
}, [] );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function useBlockEditorSettings( settings, hasTemplate ) {
'__experimentalFeatures',
'__experimentalPreferredStyleVariations',
'__experimentalSetIsInserterOpened',
'__experimentalGenerateAnchors',
'__experimentalCanLockBlocks',
'__unstableGalleryWithImageBlocks',
'alignWide',
Expand All @@ -122,6 +121,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
'focusMode',
'fontSizes',
'gradients',
'generateAnchors',
'hasFixedToolbar',
'hasReducedUI',
'imageDefaultSize',
Expand Down