UNPKG

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

25 lines (24 loc) 1.08 kB
/*! on-codemerge v1.3.1 @author Pavel Kuzmin @license MIT @homepage https://s00d.github.io/on-codemerge/ @repository git+https://github.com/s00d/on-codemerge.git Copyright (c) 2026 Pavel Kuzmin - Built on 2026-07-02T13:39:17.947Z */ var n = Object.defineProperty; var o = (i, e, t) => e in i ? n(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t; var r = (i, e, t) => o(i, typeof e != "symbol" ? e + "" : e, t); class h { constructor(e, t) { r(this, "cell"); r(this, "parentRow"); r(this, "removedIndex", -1); this.cell = t, this.parentRow = t.parentElement; } execute() { if (this.parentRow) { const e = Array.from(this.parentRow.children); this.removedIndex = e.indexOf(this.cell), this.parentRow.removeChild(this.cell); } } undo() { this.parentRow && this.removedIndex !== -1 && (this.parentRow.children.length > this.removedIndex ? this.parentRow.insertBefore(this.cell, this.parentRow.children[this.removedIndex]) : this.parentRow.appendChild(this.cell)); } } export { h as DeleteCellCommand };