Table panel: add option for preserving text formatting (#8708)

* table_panel: add option for preserving text formatting

* table_panel: fix undefined style error

* table_panel: fix class adding (add space before 'class')

* table_panel: aligin Type options labels
This commit is contained in:
Alexander Zobnin
2017-06-27 13:38:49 +03:00
committed by Daniel Lee
parent 10127e8ac9
commit 1deeef9e91
3 changed files with 19 additions and 6 deletions

View File

@@ -130,6 +130,7 @@ export class TableRenderer {
renderCell(columnIndex, value, addWidthHack = false) {
value = this.formatColumnValue(columnIndex, value);
var style = '';
var cellClass = '';
if (this.colorState.cell) {
style = ' style="background-color:' + this.colorState.cell + ';color: white"';
this.colorState.cell = null;
@@ -153,7 +154,12 @@ export class TableRenderer {
this.table.columns[columnIndex].hidden = false;
}
return '<td' + style + '>' + value + widthHack + '</td>';
var columnStyle = this.table.columns[columnIndex].style;
if (columnStyle && columnStyle.preserveFormat) {
cellClass = ' class="table-panel-cell-pre" ';
}
return '<td' + cellClass + style + '>' + value + widthHack + '</td>';
}
render(page) {