Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ var editor = EditorJS({
| ------------------ | -------- | ---------------------------------------- |
| `rows` | `number` | initial number of rows. `2` by default |
| `cols` | `number` | initial number of columns. `2` by default |
| `withHeadings` | `boolean` | toggle table headings. `false` by default |
| `withHeadings` | `boolean`| toggle table headings. `false` by default |
| `allowEmptyRows` | `boolean`| toggle saving empty rows. `false` by default |

## Output data

Expand Down
9 changes: 7 additions & 2 deletions src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export default class Table {
this.data = data;
this.config = config;

/**
* Config default
*/
this.config.allowEmptyRows = config.allowEmptyRows ? config.allowEmptyRows : false;

/**
* DOM nodes
*/
Expand Down Expand Up @@ -934,8 +939,8 @@ export default class Table {
const cells = Array.from(row.querySelectorAll(`.${CSS.cell}`));
const isEmptyRow = cells.every(cell => !cell.textContent.trim());

if (isEmptyRow) {
continue;
if(!this.config.allowEmptyRows && isEmptyRow){
continue;
}

data.push(cells.map(cell => cell.innerHTML));
Expand Down