@plone/volto 17.15.0 → 17.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Fix sidebar form update. @robgietema
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import React, { Component } from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { map, remove } from 'lodash';
|
|
8
|
+
import { isEmpty, map, remove } from 'lodash';
|
|
9
9
|
import { Button, Table } from 'semantic-ui-react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
@@ -227,7 +227,7 @@ class Edit extends Component {
|
|
|
227
227
|
* @returns {undefined}
|
|
228
228
|
*/
|
|
229
229
|
componentDidMount() {
|
|
230
|
-
if (!this.props.data.table) {
|
|
230
|
+
if (!this.props.data.table || isEmpty(this.props.data.table)) {
|
|
231
231
|
this.props.onChangeBlock(this.props.block, {
|
|
232
232
|
...this.props.data,
|
|
233
233
|
table: initialTable,
|
|
@@ -243,7 +243,7 @@ class Edit extends Component {
|
|
|
243
243
|
* @returns {undefined}
|
|
244
244
|
*/
|
|
245
245
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
246
|
-
if (!nextProps.data.table) {
|
|
246
|
+
if (!nextProps.data.table || isEmpty(nextProps.data.table)) {
|
|
247
247
|
this.props.onChangeBlock(nextProps.block, {
|
|
248
248
|
...nextProps.data,
|
|
249
249
|
table: initialTable,
|
|
@@ -528,10 +528,7 @@ class Edit extends Component {
|
|
|
528
528
|
icon
|
|
529
529
|
basic
|
|
530
530
|
onClick={this.onDeleteRow}
|
|
531
|
-
disabled={
|
|
532
|
-
this.props.data.table &&
|
|
533
|
-
this.props.data.table.rows.length === 1
|
|
534
|
-
}
|
|
531
|
+
disabled={this.props.data.table?.rows?.length === 1}
|
|
535
532
|
title={this.props.intl.formatMessage(messages.deleteRow)}
|
|
536
533
|
aria-label={this.props.intl.formatMessage(messages.deleteRow)}
|
|
537
534
|
>
|
|
@@ -569,10 +566,7 @@ class Edit extends Component {
|
|
|
569
566
|
icon
|
|
570
567
|
basic
|
|
571
568
|
onClick={this.onDeleteCol}
|
|
572
|
-
disabled={
|
|
573
|
-
this.props.data.table &&
|
|
574
|
-
this.props.data.table.rows[0].cells.length === 1
|
|
575
|
-
}
|
|
569
|
+
disabled={this.props.data.table?.rows?.[0].cells.length === 1}
|
|
576
570
|
title={this.props.intl.formatMessage(messages.deleteCol)}
|
|
577
571
|
aria-label={this.props.intl.formatMessage(messages.deleteCol)}
|
|
578
572
|
>
|