Skip to content

Commit

Permalink
Site Editor: use EditorProvider instead of custom logic
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 10, 2023
1 parent cfacc31 commit ac35c02
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 377 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

28 changes: 0 additions & 28 deletions packages/edit-site/src/components/block-editor/index.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createBlock } from '@wordpress/blocks';
/**
* Internal dependencies
*/
import { PAGE_CONTENT_BLOCK_TYPES } from '../../../utils/constants';
import { PAGE_CONTENT_BLOCK_TYPES } from '../../utils/constants';

/**
* Helper method to iterate through all blocks, recursing into allowed inner blocks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function useArchiveLabel( templateSlug ) {
);
}

export default function useSiteEditorSettings() {
export function useSpecificEditorSettings() {
const { setIsInserterOpened } = useDispatch( editSiteStore );
const {
templateSlug,
Expand All @@ -97,8 +97,6 @@ export default function useSiteEditorSettings() {
keepCaretInsideBlock,
canvasMode,
settings,
postType,
postId,
} = useSelect( ( select ) => {
const {
getEditedPostType,
Expand Down Expand Up @@ -164,5 +162,21 @@ export default function useSiteEditorSettings() {
archiveLabels.archiveNameLabel,
] );

return defaultEditorSettings;
}

export default function useSiteEditorSettings() {
const defaultEditorSettings = useSpecificEditorSettings();
const { postType, postId } = useSelect( ( select ) => {
const { getEditedPostType, getEditedPostId } = unlock(
select( editSiteStore )
);
const usedPostType = getEditedPostType();
const usedPostId = getEditedPostId();
return {
postType: usedPostType,
postId: usedPostId,
};
}, [] );
return useBlockEditorSettings( defaultEditorSettings, postType, postId );
}
Loading

0 comments on commit ac35c02

Please sign in to comment.