Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
Tables created w/ table size picker have first row formatted differently
Browse files Browse the repository at this point in the history
  • Loading branch information
silviubogan committed Aug 11, 2020
1 parent 7eadc14 commit e89eab0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/editor/plugins/Table/TableButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ const TableButton = () => {
setActiveColumn(1);
}, []);

const createEmptyCell = React.useCallback(() => {
const createEmptyCell = React.useCallback((formatAsColumnHeaders = false) => {
return {
key: uuid(),
type: 'data',
type: formatAsColumnHeaders ? 'header' : 'data',
value: [{ type: 'p', children: [{ text: '' }] }],
};
}, []);

const createEmptyRow = React.useCallback(
(cellCount) => {
(cellCount, formatAsColumnHeaders = false) => {
const cells = [];

for (let i = 0; i < cellCount; ++i) {
cells.push(createEmptyCell());
cells.push(createEmptyCell(formatAsColumnHeaders));
}

return {
Expand Down Expand Up @@ -114,8 +114,9 @@ const TableButton = () => {
blockNode,
} = editor.getBlockProps();

const rows = [];
for (let i = 0; i < row; ++i) {
const rows = [createEmptyRow(column, true)];

for (let i = 0; i < row - 1; ++i) {
rows.push(createEmptyRow(column));
}

Expand Down

0 comments on commit e89eab0

Please sign in to comment.