diff --git a/packages/volto-heading-block/src/components/Edit.jsx b/packages/volto-heading-block/src/components/Edit.jsx index 5377564..60cdc30 100644 --- a/packages/volto-heading-block/src/components/Edit.jsx +++ b/packages/volto-heading-block/src/components/Edit.jsx @@ -1,7 +1,7 @@ import React from 'react'; import ContentEditable from 'react-contenteditable'; import { withBlockExtensions } from '@plone/volto/helpers'; -import { SidebarPortal, MaybeWrap } from '@plone/volto/components'; +import { SidebarPortal } from '@plone/volto/components'; import HeadingSidebar from './Sidebar'; import config from '@plone/volto/registry'; import cx from 'classnames'; @@ -66,18 +66,55 @@ class HeadingEdit extends React.Component { const show_alignment = blocksConfig?.heading?.show_alignment; const isBlockModelv3 = blocksConfig?.heading?.blockModel === 3; - const LegacyWrapper = ({ className, children }) => ( -
{children}
- ); - return ( <> - {data && ( - + {isBlockModelv3 ? ( +
+ { + if (e.key === 'Enter') { + e.preventDefault(); + e.stopPropagation(); + this.props.onSelectBlock( + this.props.onAddBlock( + config.settings.defaultBlockType, + this.props.index + 1, + ), + ); + } else if (e.key === 'ArrowUp') { + e.preventDefault(); + e.stopPropagation(); + this.props.onFocusPreviousBlock( + this.props.block, + this.editable.current, + ); + } else if (e.key === 'ArrowDown') { + e.preventDefault(); + e.stopPropagation(); + this.props.onFocusNextBlock( + this.props.block, + this.editable.current, + ); + } + }} + /> + + + +
+ ) : ( +
- +
)} ); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 526ede4..1e27bab 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4006,7 +4006,9 @@ packages: source-map: 0.6.1 string-length: 2.0.0 transitivePeerDependencies: + - bufferutil - supports-color + - utf-8-validate dev: true /@jest/reporters@26.6.2: @@ -5630,16 +5632,6 @@ packages: - '@swc/helpers' dev: true - /@parcel/plugin@2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11): - resolution: {integrity: sha512-nc/uRA8DiMoe4neBbzV6kDndh/58a4wQuGKw5oEoIwBCHUvE2W8ZFSu7ollSXUGRzfacTt4NdY8TwS73ScWZ+g==} - engines: {node: '>= 12.0.0'} - dependencies: - '@parcel/types': 2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11) - transitivePeerDependencies: - - '@parcel/core' - - '@swc/helpers' - dev: true - /@parcel/profiler@2.12.0: resolution: {integrity: sha512-q53fvl5LDcFYzMUtSusUBZSjQrKjMlLEBgKeQHFwkimwR1mgoseaDBDuNz0XvmzDzF1UelJ02TUKCGacU8W2qA==} engines: {node: '>= 12.0.0'} @@ -5833,7 +5825,7 @@ packages: dependencies: '@parcel/core': 2.12.0 '@parcel/diagnostic': 2.12.0 - '@parcel/plugin': 2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11) + '@parcel/plugin': 2.12.0(@parcel/core@2.12.0) '@parcel/rust': 2.12.0 '@parcel/source-map': 2.1.1 '@parcel/utils': 2.12.0 @@ -6027,21 +6019,6 @@ packages: - '@swc/helpers' dev: true - /@parcel/types@2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11): - resolution: {integrity: sha512-8zAFiYNCwNTQcglIObyNwKfRYQK5ELlL13GuBOrSMxueUiI5ylgsGbTS1N7J3dAGZixHO8KhHGv5a71FILn9rQ==} - dependencies: - '@parcel/cache': 2.12.0(@parcel/core@2.12.0) - '@parcel/diagnostic': 2.12.0 - '@parcel/fs': 2.12.0(@parcel/core@2.12.0) - '@parcel/package-manager': 2.12.0(@parcel/core@2.12.0)(@swc/helpers@0.5.11) - '@parcel/source-map': 2.1.1 - '@parcel/workers': 2.12.0(@parcel/core@2.12.0) - utility-types: 3.11.0 - transitivePeerDependencies: - - '@parcel/core' - - '@swc/helpers' - dev: true - /@parcel/utils@2.12.0: resolution: {integrity: sha512-z1JhLuZ8QmDaYoEIuUCVZlhcFrS7LMfHrb2OCRui5SQFntRWBH2fNM6H/fXXUkT9SkxcuFP2DUA6/m4+Gkz72g==} engines: {node: '>= 12.0.0'} @@ -10068,7 +10045,7 @@ packages: resolution: {integrity: sha512-Sr2fYMBUVGYq8kj3UthXFAu5UN6ZW+rYr4NACjZQJvHvj+c8lYv0CahmZ2P/r7iUkN44gGUBwqxZkrKXYPb7cw==} dependencies: '@types/expect': 1.20.4 - '@types/node': 15.14.9 + '@types/node': 20.14.2 /@types/ws@8.5.10: resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} @@ -18570,9 +18547,7 @@ packages: pretty-format: 24.9.0 throat: 4.1.0 transitivePeerDependencies: - - bufferutil - supports-color - - utf-8-validate dev: true /jest-jasmine2@26.6.3: