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

29 lines (28 loc) 1.2 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 o = Object.defineProperty; var n = (t, e, i) => e in t ? o(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i; var l = (t, e, i) => n(t, typeof e != "symbol" ? e + "" : e, i); class c { constructor(e) { l(this, "name", "deleteBlock"); l(this, "block", null); l(this, "parentNode", null); l(this, "nextSibling", null); l(this, "deletedBlock", null); } setBlock(e) { this.block = e; } execute() { !this.block || !this.isValidBlock(this.block) || (this.deletedBlock = this.block, this.parentNode = this.block.parentNode, this.nextSibling = this.block.nextSibling, this.block.remove()); } undo() { !this.parentNode || !this.deletedBlock || (this.nextSibling ? this.parentNode.insertBefore(this.deletedBlock, this.nextSibling) : this.parentNode.appendChild(this.deletedBlock)); } isValidBlock(e) { return e.classList.contains("editor-block"); } } export { c as DeleteBlockCommand };