Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function HeaderToolbar( {
hasFixedToolbar,
hasRedo,
hasUndo,
redo,
undo,
showInserter,
showKeyboardHideButton,
getStylesFromColorScheme,
onHideKeyboard,
} ) {
const scrollViewRef = useRef( null );
const scrollToStart = () => {
scrollViewRef.current.scrollTo( { x: 0 } );
};
const showPageTemplatePicker = __experimentalUsePageTemplatePickerVisible();
return (
<>
{ showPageTemplatePicker && <__experimentalPageTemplatePicker /> }
nextShortcut,
} = useSelect( ( select ) => {
return ( {
hasFixedToolbar: select( 'core/edit-post' ).isFeatureActive( 'fixedToolbar' ),
editorSidebarOpened: select( 'core/edit-post' ).isEditorSidebarOpened(),
pluginSidebarOpened: select( 'core/edit-post' ).isPluginSidebarOpened(),
publishSidebarOpened: select( 'core/edit-post' ).isPublishSidebarOpened(),
mode: select( 'core/edit-post' ).getEditorMode(),
isRichEditingEnabled: select( 'core/editor' ).getEditorSettings().richEditingEnabled,
hasActiveMetaboxes: select( 'core/edit-post' ).hasMetaBoxes(),
isSaving: select( 'core/edit-post' ).isSavingMetaBoxes(),
previousShortcut: select( 'core/keyboard-shortcuts' ).getAllShortcutRawKeyCombinations( 'core/edit-post/previous-region' ),
nextShortcut: select( 'core/keyboard-shortcuts' ).getAllShortcutRawKeyCombinations( 'core/edit-post/next-region' ),
} );
}, [] );
const showPageTemplatePicker = __experimentalUsePageTemplatePickerVisible();
const sidebarIsOpened = editorSidebarOpened || pluginSidebarOpened || publishSidebarOpened;
const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
'is-sidebar-opened': sidebarIsOpened,
'has-fixed-toolbar': hasFixedToolbar,
'has-metaboxes': hasActiveMetaboxes,
} );
return (
<>