Update table-bindings.js

This commit is contained in:
2025-10-13 22:55:39 +08:00
committed by GitHub
parent 4a0969ea33
commit f9d5205c0c

View File

@@ -320,14 +320,13 @@ export function renderTables() {
} }
const highlights = TableManager.getHighlights(); const highlights = TableManager.getHighlights();
const fragment = document.createDocumentFragment();
const placeholder = document.getElementById('add-table-placeholder'); const placeholder = document.getElementById('add-table-placeholder');
if (placeholder) { if (placeholder) {
placeholder.remove(); placeholder.remove();
} }
container.innerHTML = '';
tables.forEach((tableData, tableIndex) => { tables.forEach((tableData, tableIndex) => {
const header = document.createElement('div'); const header = document.createElement('div');
header.style.display = 'flex'; header.style.display = 'flex';
@@ -349,7 +348,7 @@ export function renderTables() {
`; `;
header.appendChild(title); header.appendChild(title);
header.appendChild(controls); header.appendChild(controls);
container.appendChild(header); fragment.appendChild(header);
const tableWrapper = document.createElement('div'); const tableWrapper = document.createElement('div');
tableWrapper.className = 'amily2-table-wrapper'; tableWrapper.className = 'amily2-table-wrapper';
@@ -616,9 +615,12 @@ export function renderTables() {
}); });
} }
tableWrapper.appendChild(tableElement); tableWrapper.appendChild(tableElement);
container.appendChild(tableWrapper); fragment.appendChild(tableWrapper);
}); });
container.innerHTML = '';
container.appendChild(fragment);
if (placeholder) { if (placeholder) {
container.appendChild(placeholder); container.appendChild(placeholder);
} }