|
|
@@ -52,11 +52,11 @@ export default function upcastTable() {
|
|
|
conversionApi.writer.insert( table, splitResult.position );
|
|
|
conversionApi.consumable.consume( viewTable, { name: true } );
|
|
|
|
|
|
- if ( rows.length ) {
|
|
|
- // Upcast table rows in proper order (heading rows first).
|
|
|
- rows.forEach( row => conversionApi.convertItem( row, conversionApi.writer.createPositionAt( table, 'end' ) ) );
|
|
|
- } else {
|
|
|
- // Create one row and one table cell for empty table.
|
|
|
+ // Upcast table rows in proper order (heading rows first).
|
|
|
+ rows.forEach( row => conversionApi.convertItem( row, conversionApi.writer.createPositionAt( table, 'end' ) ) );
|
|
|
+
|
|
|
+ // Create one row and one table cell for empty table.
|
|
|
+ if ( table.isEmpty ) {
|
|
|
const row = conversionApi.writer.createElement( 'tableRow' );
|
|
|
conversionApi.writer.insert( row, conversionApi.writer.createPositionAt( table, 'end' ) );
|
|
|
|
|
|
@@ -90,6 +90,16 @@ export default function upcastTable() {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+export function upcastTableRow() {
|
|
|
+ return dispatcher => {
|
|
|
+ dispatcher.on( 'element:tr', ( evt, data ) => {
|
|
|
+ if ( data.viewItem.isEmpty ) {
|
|
|
+ evt.stop();
|
|
|
+ }
|
|
|
+ }, { priority: 'high' } );
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
export function upcastTableCell( elementName ) {
|
|
|
return dispatcher => {
|
|
|
dispatcher.on( `element:${ elementName }`, ( evt, data, conversionApi ) => {
|