on-codemerge
Version:
A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product
34 lines (33 loc) • 788 B
JavaScript
import { TableCell as c } from "../components/TableCell.mjs";
class d {
static addRow(e, l, t = !1) {
const n = l.parentElement.rowIndex, o = e.insertRow(t ? n : n + 1), r = l.parentElement.cells.length;
for (let s = 0; s < r; s++) {
const w = o.insertCell();
new c(w);
}
return o;
}
static addColumn(e, l, t = !1) {
const n = l.cellIndex, o = [];
for (const r of e.rows) {
const s = r.insertCell(t ? n : n + 1);
new c(s), o.push(s);
}
return o;
}
static deleteRow(e, l) {
e.rows.length > 1 && l.remove();
}
static deleteColumn(e, l) {
if (e.rows[0].cells.length > 1)
for (const t of e.rows)
t.deleteCell(l);
}
static deleteTable(e) {
e.remove();
}
}
export {
d as TableOperations
};