From 259bc6dfd1ab50cd48993916fd2679ea480e045f Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 9 Jul 2024 10:14:47 +0200 Subject: [PATCH] Remove more leftovers --- packages/block-editor/README.md | 1 - packages/block-editor/src/store/defaults.js | 2 -- packages/block-editor/src/store/defaults.native.js | 3 --- packages/edit-post/src/editor.native.js | 5 ----- .../editor/src/components/provider/index.native.js | 14 +++----------- .../provider/use-block-editor-settings.js | 1 - .../RNReactNativeGutenbergBridgeModule.java | 12 ------------ .../mobile/WPAndroidGlue/GutenbergProps.kt | 1 - packages/react-native-bridge/ios/Gutenberg.swift | 4 ---- .../ios/GutenbergBridgeDataSource.swift | 1 - .../GutenbergDemo/GutenbergViewController.swift | 1 - packages/react-native-editor/src/setup.js | 2 -- test/unit/config/global-mocks.js | 13 ------------- 13 files changed, 3 insertions(+), 57 deletions(-) diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index 322f0873c83049..6b9af74d03a3ab 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -780,7 +780,6 @@ _Properties_ - _\_\_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 -- _\_\_unstableGalleryWithImageBlocks_ `boolean`: Whether the user has enabled the refactored gallery block which uses InnerBlocks ### SkipToSelectedBlock diff --git a/packages/block-editor/src/store/defaults.js b/packages/block-editor/src/store/defaults.js index acd40244cb2604..54877eafc36901 100644 --- a/packages/block-editor/src/store/defaults.js +++ b/packages/block-editor/src/store/defaults.js @@ -33,7 +33,6 @@ export const PREFERENCES_DEFAULTS = { * @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} __unstableGalleryWithImageBlocks Whether the user has enabled the refactored gallery block which uses InnerBlocks */ export const SETTINGS_DEFAULTS = { alignWide: false, @@ -168,7 +167,6 @@ export const SETTINGS_DEFAULTS = { __mobileEnablePageTemplates: false, __experimentalBlockPatterns: [], __experimentalBlockPatternCategories: [], - __unstableGalleryWithImageBlocks: false, __unstableIsPreviewMode: false, // These settings will be completely revamped in the future. diff --git a/packages/block-editor/src/store/defaults.native.js b/packages/block-editor/src/store/defaults.native.js index fddf7cdb647b97..e951c39b3d1a41 100644 --- a/packages/block-editor/src/store/defaults.native.js +++ b/packages/block-editor/src/store/defaults.native.js @@ -10,9 +10,6 @@ const SETTINGS_DEFAULTS = { ...SETTINGS, // Don't add the default font sizes for standard themes fontSizes: undefined, - // FOR TESTING ONLY - Later, this will come from a REST API - // eslint-disable-next-line no-undef - __unstableGalleryWithImageBlocks: __DEV__, alignWide: true, supportsLayout: false, __experimentalFeatures: { diff --git a/packages/edit-post/src/editor.native.js b/packages/edit-post/src/editor.native.js index 79d7e48059afa6..69185a5f3073e6 100644 --- a/packages/edit-post/src/editor.native.js +++ b/packages/edit-post/src/editor.native.js @@ -33,11 +33,6 @@ class Editor extends Component { constructor( props ) { super( ...arguments ); - // need to set this globally to avoid race with deprecations - // defaulting to true to avoid issues with a not-yet-cached value - const { galleryWithImageBlocks = true } = props; - window.wp.galleryBlockV2Enabled = galleryWithImageBlocks; - if ( props.initialHtmlModeEnabled && props.mode === 'visual' ) { // Enable html mode if the initial mode the parent wants it but we're not already in it. this.props.switchEditorMode( 'text' ); diff --git a/packages/editor/src/components/provider/index.native.js b/packages/editor/src/components/provider/index.native.js index 335f39afd414db..bac824ab86ad24 100644 --- a/packages/editor/src/components/provider/index.native.js +++ b/packages/editor/src/components/provider/index.native.js @@ -171,17 +171,9 @@ class NativeEditorProvider extends Component { ); this.subscriptionParentUpdateEditorSettings = - subscribeUpdateEditorSettings( - ( { galleryWithImageBlocks, ...editorSettings } ) => { - if ( typeof galleryWithImageBlocks === 'boolean' ) { - window.wp.galleryBlockV2Enabled = - galleryWithImageBlocks; - } - updateEditorSettings( - this.getThemeColors( editorSettings ) - ); - } - ); + subscribeUpdateEditorSettings( ( { ...editorSettings } ) => { + updateEditorSettings( this.getThemeColors( editorSettings ) ); + } ); this.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities( ( payload ) => { diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index 823cf852d14814..2bdd4547d0156e 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -42,7 +42,6 @@ const BLOCK_EDITOR_SETTINGS = [ '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', - '__unstableGalleryWithImageBlocks', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', diff --git a/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java b/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java index 315765edddf108..62e6ed8fc94651 100644 --- a/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java +++ b/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/RNReactNativeGutenbergBridgeModule.java @@ -80,7 +80,6 @@ public class RNReactNativeGutenbergBridgeModule extends ReactContextBaseJavaModu private static final String MAP_KEY_THEME_UPDATE_GRADIENTS = "gradients"; private static final String MAP_KEY_THEME_UPDATE_RAW_STYLES = "rawStyles"; private static final String MAP_KEY_THEME_UPDATE_RAW_FEATURES = "rawFeatures"; - private static final String MAP_KEY_GALLERY_WITH_IMAGE_BLOCKS = "galleryWithImageBlocks"; public static final String MAP_KEY_MEDIA_FINAL_SAVE_RESULT_SUCCESS_VALUE = "success"; private static final String MAP_KEY_IS_PREFERRED_COLOR_SCHEME_DARK = "isPreferredColorSchemeDark"; @@ -174,13 +173,6 @@ public void updateTheme(@Nullable Bundle editorTheme) { Serializable rawStyles = editorTheme.getSerializable(MAP_KEY_THEME_UPDATE_RAW_STYLES); Serializable rawFeatures = editorTheme.getSerializable(MAP_KEY_THEME_UPDATE_RAW_FEATURES); - // We must assign null here to distinguish between a missing value and false - Boolean galleryWithImageBlocks = null; - if (editorTheme.containsKey(MAP_KEY_GALLERY_WITH_IMAGE_BLOCKS)) { - galleryWithImageBlocks = editorTheme.getBoolean(MAP_KEY_GALLERY_WITH_IMAGE_BLOCKS); - } - - if (colors != null) { writableMap.putArray(MAP_KEY_THEME_UPDATE_COLORS, Arguments.fromList((ArrayList)colors)); } @@ -197,10 +189,6 @@ public void updateTheme(@Nullable Bundle editorTheme) { writableMap.putString(MAP_KEY_THEME_UPDATE_RAW_FEATURES, rawFeatures.toString()); } - if (galleryWithImageBlocks != null) { - writableMap.putBoolean(MAP_KEY_GALLERY_WITH_IMAGE_BLOCKS, galleryWithImageBlocks); - } - emitToJS(EVENT_NAME_UPDATE_EDITOR_SETTINGS, writableMap); } diff --git a/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt b/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt index 00b44aeb24c443..690a2f56142282 100644 --- a/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt +++ b/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt @@ -100,7 +100,6 @@ data class GutenbergProps @JvmOverloads constructor( private const val PROP_COLORS = "colors" private const val PROP_GRADIENTS = "gradients" private const val PROP_IS_FSE_THEME = "isFSETheme" - private const val PROP_GALLERY_WITH_IMAGE_BLOCKS = "galleryWithImageBlocks" private const val PROP_QUOTE_BLOCK_V2 = "quoteBlockV2" private const val PROP_LIST_BLOCK_V2 = "listBlockV2" diff --git a/packages/react-native-bridge/ios/Gutenberg.swift b/packages/react-native-bridge/ios/Gutenberg.swift index 2273801f1eeb9c..4fe15c7c503a6f 100644 --- a/packages/react-native-bridge/ios/Gutenberg.swift +++ b/packages/react-native-bridge/ios/Gutenberg.swift @@ -230,10 +230,6 @@ public class Gutenberg: UIResponder { private func properties(from editorSettings: GutenbergEditorSettings?) -> [String : Any] { var settingsUpdates = [String : Any]() settingsUpdates["isFSETheme"] = editorSettings?.isFSETheme ?? false - - if let galleryWithImageBlocks = editorSettings?.galleryWithImageBlocks { - settingsUpdates["galleryWithImageBlocks"] = galleryWithImageBlocks - } if let quoteBlockV2 = editorSettings?.quoteBlockV2 { settingsUpdates["quoteBlockV2"] = quoteBlockV2 diff --git a/packages/react-native-bridge/ios/GutenbergBridgeDataSource.swift b/packages/react-native-bridge/ios/GutenbergBridgeDataSource.swift index 9b02be94b6a717..0ff3e0fc69bd82 100644 --- a/packages/react-native-bridge/ios/GutenbergBridgeDataSource.swift +++ b/packages/react-native-bridge/ios/GutenbergBridgeDataSource.swift @@ -82,7 +82,6 @@ public extension GutenbergBridgeDataSource { public protocol GutenbergEditorSettings { var isFSETheme: Bool { get } - var galleryWithImageBlocks: Bool { get } var quoteBlockV2: Bool { get } var listBlockV2: Bool { get } var rawStyles: String? { get } diff --git a/packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift b/packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift index 70d789411e88ff..73c7fa5d054fce 100644 --- a/packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift +++ b/packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift @@ -370,7 +370,6 @@ extension GutenbergViewController: GutenbergWebDelegate { extension GutenbergViewController: GutenbergBridgeDataSource { class EditorSettings: GutenbergEditorSettings { var isFSETheme: Bool = true - var galleryWithImageBlocks: Bool = true var quoteBlockV2: Bool = true var listBlockV2: Bool = true var rawStyles: String? = nil diff --git a/packages/react-native-editor/src/setup.js b/packages/react-native-editor/src/setup.js index f5c80883b4b6d7..d6da4cb0542a3c 100644 --- a/packages/react-native-editor/src/setup.js +++ b/packages/react-native-editor/src/setup.js @@ -70,7 +70,6 @@ const setupInitHooks = () => { featuredImageId, rawStyles, rawFeatures, - galleryWithImageBlocks, locale, } = props; @@ -94,7 +93,6 @@ const setupInitHooks = () => { capabilities, rawStyles, rawFeatures, - galleryWithImageBlocks, locale, }; } diff --git a/test/unit/config/global-mocks.js b/test/unit/config/global-mocks.js index fa9c1d0733aa9c..4c5e5f8f8cd117 100644 --- a/test/unit/config/global-mocks.js +++ b/test/unit/config/global-mocks.js @@ -19,19 +19,6 @@ jest.mock( 'client-zip', () => ( { downloadZip: jest.fn(), } ) ); -/** - * The new gallery block format is not compatible with the use_BalanceTags option - * so a flag is set in lib/compat.php to allow disabling the new block in this instance. - * This flag needs to be mocked here to ensure tests and fixtures run with the v2 - * version of the Gallery block enabled. - * - * Note: This should be removed when the minimum required WP version is >= 5.9. - * - */ -if ( ! window.wp?.galleryBlockV2Enabled ) { - window.wp = { ...window.wp, galleryBlockV2Enabled: true }; -} - global.ResizeObserver = require( 'resize-observer-polyfill' ); /**