Skip to content
Prev Previous commit
Next Next commit
Remove unused code and update global styles
  • Loading branch information
michalczaplinski authored and aaronrobertshaw committed May 10, 2024
commit 109426184b9c04f7ec83961239ae415f6c4b3932
13 changes: 1 addition & 12 deletions packages/edit-post/src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
PostLockedModal,
store as editorStore,
privateApis as editorPrivateApis,
useStyles,
} from '@wordpress/editor';
import { useMemo } from '@wordpress/element';
import { SlotFillProvider } from '@wordpress/components';
Expand Down Expand Up @@ -74,24 +73,14 @@ function Editor( {
[ currentPost.postType, currentPost.postId ]
);

// get the styles from the global styles
const { styles } = useStyles();

const editorSettings = useMemo(
() => ( {
...settings,
// TODO: This key should have a better name
__globalStyles: styles,
onNavigateToEntityRecord,
onNavigateToPreviousEntityRecord,
defaultRenderingMode: 'post-only',
} ),
[
settings,
styles,
onNavigateToEntityRecord,
onNavigateToPreviousEntityRecord,
]
[ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ]
);

const initialPost = useMemo( () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import inserterMediaCategories from '../media-categories';
import { mediaUpload } from '../../utils';
import { store as editorStore } from '../../store';
import { lock, unlock } from '../../lock-unlock';
import { useStyles } from '../use-styles';

const EMPTY_BLOCKS_LIST = [];

Expand All @@ -41,7 +42,6 @@ const BLOCK_EDITOR_SETTINGS = [
'__experimentalFeatures',
'__experimentalGlobalStylesBaseStyles',
'__unstableGalleryWithImageBlocks',
'__globalStyles',
'alignWide',
'blockInspectorTabs',
'allowedMimeTypes',
Expand Down Expand Up @@ -174,6 +174,9 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
[ postType, postId, isLargeViewport, renderingMode ]
);

// get the styles from the global styles
const { styles } = useStyles();

const settingsBlockPatterns =
settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0
settings.__experimentalBlockPatterns; // WP 5.9
Expand Down Expand Up @@ -260,6 +263,8 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
BLOCK_EDITOR_SETTINGS.includes( key )
)
),
// TODO: This key should have a better name
__globalStyles: styles,
allowedBlockTypes,
allowRightClickOverrides,
focusMode: focusMode && ! forceDisableFocusMode,
Expand Down