From 19f01c31017250747fb7f97d840badb74cc0c112 Mon Sep 17 00:00:00 2001 From: Giulia Ghisini Date: Fri, 6 Oct 2023 15:01:31 +0200 Subject: [PATCH] fix: ArgumentsInEvidence block now uses Slate --- .../Blocks/Accordion/Block/ViewBlock.jsx | 1 - .../Blocks/ArgumentsInEvidence/Block.jsx | 26 ++++++++++++------- .../Blocks/ArgumentsInEvidence/Body.jsx | 1 + .../Blocks/ArgumentsInEvidence/Edit.jsx | 1 + 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock.jsx b/src/components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock.jsx index e95286c9c..53f0897ce 100644 --- a/src/components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock.jsx +++ b/src/components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock.jsx @@ -10,7 +10,6 @@ import cx from 'classnames'; import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme'; import { UniversalLink } from '@plone/volto/components'; import { TextBlockView } from '@plone/volto-slate/blocks/Text'; -import config from '@plone/volto/registry'; const messages = defineMessages({ vedi: { diff --git a/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Block.jsx b/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Block.jsx index c37ba44c5..a86dbb76b 100644 --- a/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Block.jsx +++ b/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Block.jsx @@ -8,11 +8,11 @@ import { CardText, CardReadMore, } from 'design-react-kit'; -import redraft from 'redraft'; + import { UniversalLink } from '@plone/volto/components'; import { flattenToAppURL } from '@plone/volto/helpers'; import { ArgumentIcon } from 'design-comuni-plone-theme/components/ItaliaTheme/View'; -import config from '@plone/volto/registry'; +import { TextBlockView } from '@plone/volto-slate/blocks/Text'; const messages = defineMessages({ text: { @@ -37,6 +37,8 @@ const Block = ({ block, onChange, intl, + index, + ...otherProps }) => { const argument = data?.argument ? data?.argument[0] : null; @@ -49,21 +51,25 @@ const Block = ({ {argument?.description} {inEditMode ? ( { + onChange({ ...data, title: _data.value }); + }} + setSelected={() => { + focusOn('title'); + }} /> ) : (
- {redraft( - data.title, - config.settings.richtextViewSettings.ToHTMLRenderers, - config.settings.richtextViewSettings.ToHTMLOptions, - )} +
)} {argument && ( diff --git a/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Body.jsx b/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Body.jsx index 43976e3f2..2d56c0ab6 100644 --- a/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Body.jsx +++ b/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Body.jsx @@ -23,6 +23,7 @@ class Body extends SubblockEdit { return ( {this.state.subblocks.map((subblock, subindex) => (