From a5aa27ab3b2c69ea0a63ac73b9832e8bae4cf3c0 Mon Sep 17 00:00:00 2001 From: Giulia Ghisini Date: Mon, 16 Oct 2023 12:26:26 +0200 Subject: [PATCH] fix: fix warning --- .../ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx | 2 +- src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx | 1 + src/components/ItaliaTheme/Blocks/Callout/Edit.jsx | 2 ++ .../Blocks/ContactsBlock/Block/EditBlock.jsx | 2 +- .../ItaliaTheme/Blocks/ContactsBlock/Edit.jsx | 4 +++- .../ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx | 10 +++++++--- src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx | 1 + .../Blocks/NumbersBlock/Block/EditBlock.jsx | 9 +++++++-- .../ItaliaTheme/Blocks/NumbersBlock/Edit.jsx | 1 + .../ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx | 5 +++++ .../manage/Widgets/SimpleTextEditorWidget.jsx | 6 +++--- .../ItaliaTheme/manage/Widgets/TextEditorWidget.jsx | 6 +++--- .../components/manage/Blocks/HeroImageLeft/Edit.jsx | 2 +- .../volto/components/manage/Blocks/Video/Edit.jsx | 2 +- 14 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/components/ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx b/src/components/ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx index ac72671ae..22be2767b 100644 --- a/src/components/ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx +++ b/src/components/ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx @@ -38,7 +38,7 @@ class EditBlock extends SubblockEdit { * Constructor * @method constructor * @param {Object} props Component properties - * @constructs WysiwygEditor + * @constructs Accordion Edit */ constructor(props) { super(props); diff --git a/src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx b/src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx index 820591c0a..5534dcf7b 100644 --- a/src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx +++ b/src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx @@ -60,6 +60,7 @@ class Edit extends SubblocksEdit { { setSelectedField('text'); }} + onSelectBlock={onSelectBlock} /> @@ -87,6 +88,7 @@ const Edit = ({ data={data} fieldName="text" block={block} + onSelectBlock={onSelectBlock} selected={selectedField === 'text'} placeholder={intl.formatMessage(messages.text)} onChangeBlock={onChangeBlock} diff --git a/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock.jsx b/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock.jsx index 460d8d062..276d74135 100644 --- a/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock.jsx +++ b/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock.jsx @@ -38,7 +38,7 @@ class EditBlock extends SubblockEdit { * Constructor * @method constructor * @param {Object} props Component properties - * @constructs WysiwygEditor + * @constructs Contacts Blocks edit */ constructor(props) { super(props); diff --git a/src/components/ItaliaTheme/Blocks/ContactsBlock/Edit.jsx b/src/components/ItaliaTheme/Blocks/ContactsBlock/Edit.jsx index 55ccfbd79..967e7101f 100644 --- a/src/components/ItaliaTheme/Blocks/ContactsBlock/Edit.jsx +++ b/src/components/ItaliaTheme/Blocks/ContactsBlock/Edit.jsx @@ -81,6 +81,7 @@ class Edit extends SubblocksEdit { fieldName="title" selected={this.state.selectedField === 'title'} placeholder={this.props.intl.formatMessage(messages.title)} + onSelectBlock={() => {}} setSelected={() => { this.setState({ selectedField: 'title' }); }} @@ -100,7 +101,7 @@ class Edit extends SubblocksEdit { placeholder={this.props.intl.formatMessage( messages.description, )} - onSelectBlock={null} + onSelectBlock={() => {}} setSelected={() => { this.setState({ selectedField: 'description' }); }} @@ -132,6 +133,7 @@ class Edit extends SubblocksEdit { {...this.subblockProps} openObjectBrowser={this.props.openObjectBrowser} onSubblockChangeFocus={this.onSubblockChangeFocus} + onChangeFocus={this.onSubblockChangeFocus} isLast={this.state.subblocks.length - 1 === subindex} isFirst={subindex === 0} onFocusPreviousBlock={() => { diff --git a/src/components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx b/src/components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx index 5304b924c..ae0852eb7 100644 --- a/src/components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx +++ b/src/components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx @@ -42,7 +42,7 @@ class EditBlock extends SubblockEdit { * Constructor * @method constructor * @param {Object} props Component properties - * @constructs WysiwygEditor + * @constructs Icons Blocks edit */ constructor(props) { super(props); @@ -108,7 +108,9 @@ class EditBlock extends SubblockEdit { selected={ this.props.selected && this.state.focusOn === 'title' } - setSelected={() => this.setState({ focusOn: 'title' })} + setSelected={() => { + this.setState({ focusOn: 'title' }); + }} block={this.props.block} onChangeBlock={(block, _data) => { this.props.onChangeBlock(this.props.index, _data); @@ -145,7 +147,9 @@ class EditBlock extends SubblockEdit { key="text" fieldName="text" selected={this.props.selected && this.state.focusOn === 'text'} - setSelected={() => this.setState({ focusOn: 'text' })} + setSelected={() => { + this.setState({ focusOn: 'text' }); + }} onChangeBlock={(block, _data) => { this.props.onChangeBlock(this.props.index, _data); }} diff --git a/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx b/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx index cf7842772..cf3616038 100644 --- a/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx +++ b/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx @@ -140,6 +140,7 @@ class Edit extends SubblocksEdit { index={subindex} selected={this.isSubblockSelected(subindex)} {...this.subblockProps} + onChangeFocus={this.onSubblockChangeFocus} isFirst={subindex === 0} isLast={subindex === this.state.subblocks?.length - 1} openObjectBrowser={this.props.openObjectBrowser} diff --git a/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/EditBlock.jsx b/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/EditBlock.jsx index 3b139a6d8..cb4393e49 100644 --- a/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/EditBlock.jsx +++ b/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/EditBlock.jsx @@ -31,7 +31,7 @@ class EditBlock extends SubblockEdit { * Constructor * @method constructor * @param {Object} props Component properties - * @constructs WysiwygEditor + * @constructs Numbers Block edit */ constructor(props) { super(props); @@ -77,7 +77,9 @@ class EditBlock extends SubblockEdit { data={this.props.data} fieldName="title" selected={this.props.selected && this.state.focusOn === 'title'} - setSelected={() => this.setState({ focusOn: 'title' })} + setSelected={() => { + this.setState({ focusOn: 'title' }); + }} block={this.props.block} onChangeBlock={(block, _data) => { this.props.onChangeBlock(this.props.index, _data); @@ -113,6 +115,9 @@ class EditBlock extends SubblockEdit { key="text" fieldName="text" selected={this.props.selected && this.state.focusOn === 'text'} + setSelected={() => { + this.setState({ focusOn: 'text' }); + }} block={this.props.block} onChangeBlock={(block, _data) => { this.props.onChangeBlock(this.props.index, _data); diff --git a/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx b/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx index 468025f35..905cfb893 100644 --- a/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx +++ b/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx @@ -154,6 +154,7 @@ class Edit extends SubblocksEdit { index={subindex} selected={this.isSubblockSelected(subindex)} {...this.subblockProps} + onChangeFocus={this.onSubblockChangeFocus} isFirst={subindex === 0} isLast={subindex === this.state.subblocks?.length - 1} openObjectBrowser={this.props.openObjectBrowser} diff --git a/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx b/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx index a4c05bef6..6eabc1a98 100644 --- a/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx +++ b/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx @@ -77,6 +77,7 @@ const Edit = ({ fieldName="simple_card_title" selected={selectedField === 'title'} onChangeBlock={onChangeBlock} + onSelectBlock={onSelectBlock} placeholder={intl.formatMessage(messages.simple_card_title)} setSelected={() => { setSelectedField('title'); @@ -94,8 +95,12 @@ const Edit = ({ data={data} fieldName="simple_card_content" selected={selectedField === 'content'} + setSelected={() => { + setSelectedField('content'); + }} block={block} onChangeBlock={onChangeBlock} + onSelectBlock={onSelectBlock} placeholder={intl.formatMessage( messages.simple_card_content, )} diff --git a/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx b/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx index 4e6634af9..21675f70d 100644 --- a/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx +++ b/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx @@ -115,15 +115,15 @@ SimpleTextEditorWidget.propTypes = { onSelectBlock: PropTypes.func.isRequired, onChangeBlock: PropTypes.func.isRequired, block: PropTypes.string.isRequired, - value: PropTypes.string.isRequired, + value: PropTypes.string, selected: PropTypes.bool.isRequired, placeholder: PropTypes.string.isRequired, focusPrevField: PropTypes.func, focusNextField: PropTypes.func, //from block props: properties: PropTypes.objectOf(PropTypes.any).isRequired, - onFocusPreviousBlock: PropTypes.objectOf(PropTypes.any).isRequired, - onFocusNextBlock: PropTypes.objectOf(PropTypes.any).isRequired, + onFocusPreviousBlock: PropTypes.func.isRequired, + onFocusNextBlock: PropTypes.func.isRequired, }; export default SimpleTextEditorWidget; diff --git a/src/components/ItaliaTheme/manage/Widgets/TextEditorWidget.jsx b/src/components/ItaliaTheme/manage/Widgets/TextEditorWidget.jsx index 0e3d540ca..6d6c36b1a 100644 --- a/src/components/ItaliaTheme/manage/Widgets/TextEditorWidget.jsx +++ b/src/components/ItaliaTheme/manage/Widgets/TextEditorWidget.jsx @@ -130,7 +130,7 @@ const TextEditorWidget = (props) => { TextEditorWidget.propTypes = { data: PropTypes.objectOf(PropTypes.any).isRequired, - setSelected: PropTypes.func.isRequired, + setSelected: PropTypes.func, onChangeBlock: PropTypes.func.isRequired, block: PropTypes.string.isRequired, selected: PropTypes.bool.isRequired, @@ -140,8 +140,8 @@ TextEditorWidget.propTypes = { focusNextField: PropTypes.func, //from block props: properties: PropTypes.objectOf(PropTypes.any).isRequired, - onFocusPreviousBlock: PropTypes.objectOf(PropTypes.any).isRequired, - onFocusNextBlock: PropTypes.objectOf(PropTypes.any).isRequired, + onFocusPreviousBlock: PropTypes.func.isRequired, + onFocusNextBlock: PropTypes.func.isRequired, onSelectBlock: PropTypes.func.isRequired, }; diff --git a/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx b/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx index 22203e923..8cee7eeea 100644 --- a/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx +++ b/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx @@ -105,7 +105,7 @@ class EditComponent extends Component { * Constructor * @method constructor * @param {Object} props Component properties - * @constructs WysiwygEditor + * @constructs Hero Image left edit */ constructor(props) { super(props); diff --git a/src/customizations/volto/components/manage/Blocks/Video/Edit.jsx b/src/customizations/volto/components/manage/Blocks/Video/Edit.jsx index 66fd1ede6..03898a0c7 100644 --- a/src/customizations/volto/components/manage/Blocks/Video/Edit.jsx +++ b/src/customizations/volto/components/manage/Blocks/Video/Edit.jsx @@ -74,7 +74,7 @@ class Edit extends Component { * Constructor * @method constructor * @param {Object} props Component properties - * @constructs WysiwygEditor + * @constructs Video block edit */ constructor(props) { super(props);