Skip to content

Commit

Permalink
Add client-side validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Jan 9, 2025
1 parent 8b368fc commit ebd7de2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ const NON_CONTEXTUAL_POST_TYPES = [
'wp_template_part',
];

/**
* These are rendering modes that the editor supports.
*/
const RENDERING_MODES = [ 'post-only', 'template-locked' ];

/**
* Depending on the post, template and template mode,
* returns the appropriate blocks and change handlers for the block editor provider.
Expand Down Expand Up @@ -196,13 +201,14 @@ export const ExperimentalEditorProvider = withRegistryProvider(
( features ) => 'default_mode' in features
)?.default_mode
: undefined;
const hasDefaultMode = RENDERING_MODES.includes( _defaultMode );

return {
editorSettings: getEditorSettings(),
isReady: __unstableIsEditorReady() && hasLoadedPostObject,
mode: getRenderingMode(),
defaultMode:
hasTemplate && _defaultMode
hasTemplate && hasDefaultMode
? _defaultMode
: 'post-only',
selection: getEditorSelection(),
Expand Down

0 comments on commit ebd7de2

Please sign in to comment.