From 4037448e9214063128960fc086ae4cc4744158e0 Mon Sep 17 00:00:00 2001 From: Matthew Reishus Date: Wed, 25 Aug 2021 01:05:27 -0500 Subject: [PATCH] Change default value of enableCustomFields to undefined (#33931) * Change default value of enableCustomFields to undefined * Add comment explaining true/false/undefined for enableCustomFields * Preferences: Hide 'Additional' section when custom fields are disabled and there are no meta boxes * Tweak comments Co-authored-by: Robert Anderson --- .../edit-post/src/components/preferences-modal/index.js | 6 ++---- .../preferences-modal/test/__snapshots__/index.js.snap | 6 ++---- packages/editor/src/store/defaults.js | 9 +++++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/edit-post/src/components/preferences-modal/index.js b/packages/edit-post/src/components/preferences-modal/index.js index 3a536a74140bde..ad67783a7f10a2 100644 --- a/packages/edit-post/src/components/preferences-modal/index.js +++ b/packages/edit-post/src/components/preferences-modal/index.js @@ -243,14 +243,12 @@ export default function PreferencesModal() { /> -
- -
+ /> ), }, diff --git a/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap index 5e96f24c36fef3..d8351581e23684 100644 --- a/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap +++ b/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap @@ -179,12 +179,10 @@ exports[`PreferencesModal should match snapshot when the modal is active small v /> -
- -
+ /> diff --git a/packages/editor/src/store/defaults.js b/packages/editor/src/store/defaults.js index 94125a58f1392f..03824561549f71 100644 --- a/packages/editor/src/store/defaults.js +++ b/packages/editor/src/store/defaults.js @@ -14,7 +14,12 @@ export const PREFERENCES_DEFAULTS = { * allowedBlockTypes boolean|Array Allowed block types * richEditingEnabled boolean Whether rich editing is enabled or not * codeEditingEnabled boolean Whether code editing is enabled or not - * enableCustomFields boolean Whether the WordPress custom fields are enabled or not + * enableCustomFields boolean Whether the WordPress custom fields are enabled or not. + * true = the user has opted to show the Custom Fields panel at the bottom of the editor. + * false = the user has opted to hide the Custom Fields panel at the bottom of the editor. + * undefined = the current environment does not support Custom Fields, + * so the option toggle in Preferences -> Panels to + * enable the Custom Fields panel is not displayed. * autosaveInterval number Autosave Interval * availableTemplates array? The available post templates * disablePostFormats boolean Whether or not the post formats are disabled @@ -27,6 +32,6 @@ export const EDITOR_SETTINGS_DEFAULTS = { richEditingEnabled: true, codeEditingEnabled: true, - enableCustomFields: false, + enableCustomFields: undefined, supportsLayout: true, };