File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,8 @@ var editor = EditorJS({
5454| ------------------ | -------- | ---------------------------------------- |
5555| ` rows ` | ` number ` | initial number of rows. ` 2 ` by default |
5656| ` cols ` | ` number ` | initial number of columns. ` 2 ` by default |
57- | ` withHeadings ` | ` boolean ` | toggle table headings. ` false ` by default |
57+ | ` withHeadings ` | ` boolean ` | toggle table headings. ` false ` by default |
58+ | ` allowEmptyRows ` | ` boolean ` | toggle saving empty rows. ` false ` by default |
5859
5960## Output data
6061
Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ export default class Table {
4343 this . data = data ;
4444 this . config = config ;
4545
46+ /**
47+ * Config default
48+ */
49+ this . config . allowEmptyRows = config . allowEmptyRows ?? false ;
50+
4651 /**
4752 * DOM nodes
4853 */
@@ -934,8 +939,8 @@ export default class Table {
934939 const cells = Array . from ( row . querySelectorAll ( `.${ CSS . cell } ` ) ) ;
935940 const isEmptyRow = cells . every ( cell => ! cell . textContent . trim ( ) ) ;
936941
937- if ( isEmptyRow ) {
938- continue ;
942+ if ( ! this . config . allowEmptyRows && isEmptyRow ) {
943+ continue ;
939944 }
940945
941946 data . push ( cells . map ( cell => cell . innerHTML ) ) ;
You can’t perform that action at this time.
0 commit comments