diff --git a/src/Table/Cell.jsx b/src/Table/Cell.jsx index 0e4c44fb..7b45a86b 100644 --- a/src/Table/Cell.jsx +++ b/src/Table/Cell.jsx @@ -66,7 +66,9 @@ class Cell extends Component { } handleFocus() { - this.setState({ selected: true }); + this.setState({ selected: true }, () => { + this.props.onSelectCell(this.props.row, this.props.cell); + }); } /** @@ -92,7 +94,7 @@ class Cell extends Component { * @returns {undefined} */ onChange(val) { - this.props.onChange(this.props.row, this.props.cell, val); + this.props.onChange(this.props.row, this.props.cell, [...val]); } handleContainerFocus() { diff --git a/src/Table/Edit.jsx b/src/Table/Edit.jsx index 63dee34d..847c0f55 100644 --- a/src/Table/Edit.jsx +++ b/src/Table/Edit.jsx @@ -248,7 +248,7 @@ class Edit extends Component { const table = { ...this.props.data.table }; table.rows[row].cells[cell] = { ...table.rows[row].cells[cell], - value: slateValue, + value: [...slateValue], }; this.props.onChangeBlock(this.props.block, { ...this.props.data, diff --git a/src/Table/View.jsx b/src/Table/View.jsx index de273c3c..ddc6a97d 100644 --- a/src/Table/View.jsx +++ b/src/Table/View.jsx @@ -7,7 +7,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Table } from 'semantic-ui-react'; import { map } from 'lodash'; -import redraft from 'redraft'; +import TextBlockView from '../TextBlock/TextBlockView'; +import { Node } from 'slate'; import { settings } from '~/config'; @@ -35,13 +36,11 @@ const View = ({ data }) => ( key={cell.key} as={cell.type === 'header' ? 'th' : 'td'} > - {cell.value && cell.value.blocks && cell.value.blocks[0].text - ? redraft( - cell.value, - settings.ToHTMLRenderers, - settings.ToHTMLOptions, - ) - : '\u00A0'} + {cell.value && Node.string(cell.value[0]).length > 0 ? ( + + ) : ( + '\u00A0' + )} ))} diff --git a/src/index.js b/src/index.js index 70ac6ad5..3693a670 100644 --- a/src/index.js +++ b/src/index.js @@ -51,7 +51,6 @@ const applyConfig = (config) => { view: [], }, blockHasValue: (data) => { - // console.error('NOT IMPLEMENTED'); return true; }, };