fix(table): 换行会被算作单独的单元格

This commit is contained in:
itellyou 2022-01-25 19:21:59 +08:00
parent f18cd5e7c6
commit 5848342a83
1 changed files with 6 additions and 1 deletions

View File

@ -386,7 +386,12 @@ class Table<T extends TableOptions = TableOptions> extends Plugin<T> {
const childNodes = tr.children();
childNodes.each((tdChild) => {
const td = $(tdChild);
if (td.name !== 'td') {
const text = td.text();
// 排除空格
if (
td.name !== 'td' &&
['\n', '\r\n'].includes(text.trim())
) {
const newTd = $(`<td></td>`);
td.before(newTd);
newTd.append(td);