el-text-editor 0.0.60 → 0.0.61

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.
@@ -1360,13 +1360,36 @@ class ElTextEditorComponent {
1360
1360
  const rows = text.split('\n');
1361
1361
  return rows.length > 1 && rows[0].split('\t').length > 1;
1362
1362
  }
1363
+ // convertTextToTable(text: string): string {
1364
+ // const rows = text.split('\n').filter(row => row.trim() !== '');
1365
+ // const tableRows = rows.map(row => {
1366
+ // const cells = row.split('\t').map(cell => `<td class="px-1 py-1" >${cell}</td>`).join('');
1367
+ // return `<tr class="table-border-top" style="border-top: ${this.themeModeTableBorderTop()}; width: 100% !important">${cells}</tr>`;
1368
+ // }).join('');
1369
+ // return `<table>${tableRows}</table>`;
1370
+ // }
1363
1371
  convertTextToTable(text) {
1372
+ var _a;
1364
1373
  const rows = text.split('\n').filter(row => row.trim() !== '');
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
+ // Define the column width percentage
1376
+ const columnWidth = 100 / columnCount;
1365
1377
  const tableRows = rows.map(row => {
1366
- const cells = row.split('\t').map(cell => `<td class="px-1 py-1" >${cell}</td>`).join('');
1367
- return `<tr class="table-border-top" style="border-top: ${this.themeModeTableBorderTop()}; width: 100% !important">${cells}</tr>`;
1378
+ const cells = row.split('\t').map(cell => `
1379
+ <td class="px-1 py-1 text-truncate"
1380
+ style="max-width: ${columnWidth}%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
1381
+ ${cell}
1382
+ </td>`).join('');
1383
+ return `
1384
+ <tr class="table-border-top"
1385
+ style="border-top: ${this.themeModeTableBorderTop()}; width: 100% !important;">
1386
+ ${cells}
1387
+ </tr>`;
1368
1388
  }).join('');
1369
- return `<table>${tableRows}</table>`;
1389
+ return `
1390
+ <table style="table-layout: fixed; width: 100%;">
1391
+ ${tableRows}
1392
+ </table>`;
1370
1393
  }
1371
1394
  insertHtmlAtCaret(html) {
1372
1395
  var _a;