el-text-editor 0.0.61 → 0.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1372,24 +1372,26 @@ class ElTextEditorComponent {
|
|
1372
1372
|
var _a;
|
1373
1373
|
const rows = text.split('\n').filter(row => row.trim() !== '');
|
1374
1374
|
const columnCount = ((_a = rows[0]) === null || _a === void 0 ? void 0 : _a.split('\t').length) || 1; // Get the number of columns from the first row
|
1375
|
-
//
|
1376
|
-
const
|
1377
|
-
const tableRows = rows.map(row => {
|
1375
|
+
const columnWidth = 100 / columnCount; // Calculate column width
|
1376
|
+
const tableRows = rows.map((row, index) => {
|
1378
1377
|
const cells = row.split('\t').map(cell => `
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1378
|
+
<td class="px-1 py-1 text-truncate"
|
1379
|
+
style="max-width: ${columnWidth}%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
|
1380
|
+
${cell}
|
1381
|
+
</td>`).join('');
|
1382
|
+
// Add a border-top for all rows except the first and border-bottom for the last row
|
1383
|
+
const borderTop = index === 0 ? '' : `border-top: ${this.themeModeTableBorderTop()};`;
|
1384
|
+
const borderBottom = index === rows.length - 1 ? `border-bottom: ${this.themeModeTableBorderTop()};` : '';
|
1383
1385
|
return `
|
1384
|
-
|
1385
|
-
style="
|
1386
|
-
|
1387
|
-
|
1386
|
+
<tr
|
1387
|
+
style="${borderTop} ${borderBottom} width: 100% !important;">
|
1388
|
+
${cells}
|
1389
|
+
</tr>`;
|
1388
1390
|
}).join('');
|
1389
1391
|
return `
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1392
|
+
<table style="table-layout: fixed; width: 100%;">
|
1393
|
+
${tableRows}
|
1394
|
+
</table>`;
|
1393
1395
|
}
|
1394
1396
|
insertHtmlAtCaret(html) {
|
1395
1397
|
var _a;
|