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.
@@ -1367,24 +1367,26 @@ class ElTextEditorComponent {
1367
1367
  convertTextToTable(text) {
1368
1368
  const rows = text.split('\n').filter(row => row.trim() !== '');
1369
1369
  const columnCount = rows[0]?.split('\t').length || 1; // Get the number of columns from the first row
1370
- // Define the column width percentage
1371
- const columnWidth = 100 / columnCount;
1372
- const tableRows = rows.map(row => {
1370
+ const columnWidth = 100 / columnCount; // Calculate column width
1371
+ const tableRows = rows.map((row, index) => {
1373
1372
  const cells = row.split('\t').map(cell => `
1374
- <td class="px-1 py-1 text-truncate"
1375
- style="max-width: ${columnWidth}%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
1376
- ${cell}
1377
- </td>`).join('');
1373
+ <td class="px-1 py-1 text-truncate"
1374
+ style="max-width: ${columnWidth}%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
1375
+ ${cell}
1376
+ </td>`).join('');
1377
+ // Add a border-top for all rows except the first and border-bottom for the last row
1378
+ const borderTop = index === 0 ? '' : `border-top: ${this.themeModeTableBorderTop()};`;
1379
+ const borderBottom = index === rows.length - 1 ? `border-bottom: ${this.themeModeTableBorderTop()};` : '';
1378
1380
  return `
1379
- <tr class="table-border-top"
1380
- style="border-top: ${this.themeModeTableBorderTop()}; width: 100% !important;">
1381
- ${cells}
1382
- </tr>`;
1381
+ <tr
1382
+ style="${borderTop} ${borderBottom} width: 100% !important;">
1383
+ ${cells}
1384
+ </tr>`;
1383
1385
  }).join('');
1384
1386
  return `
1385
- <table style="table-layout: fixed; width: 100%;">
1386
- ${tableRows}
1387
- </table>`;
1387
+ <table style="table-layout: fixed; width: 100%;">
1388
+ ${tableRows}
1389
+ </table>`;
1388
1390
  }
1389
1391
  insertHtmlAtCaret(html) {
1390
1392
  const range = window.getSelection()?.getRangeAt(0);