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

41 lines (40 loc) 1.52 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 s = (r, e, i) => e in r ? n(r, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[e] = i; var o = (r, e, i) => s(r, typeof e != "symbol" ? e + "" : e, i); class g { constructor(e) { o(this, "name", "setViewport"); o(this, "editor"); o(this, "viewport", null); o(this, "previousViewport", null); this.editor = e; } setViewport(e) { this.viewport = e; } execute() { if (!this.viewport) return; const e = this.editor.getContainer(); if (!e) return; const t = this.editor.getPlugins().get("responsive"); t && (this.previousViewport = t.getCurrentViewport()), t && t.viewportManager && t.viewportManager.setViewport(e, this.viewport); } undo() { if (!this.previousViewport) return; const e = this.editor.getContainer(); if (!e) return; const t = this.editor.getPlugins().get("responsive"); t && t.viewportManager && t.viewportManager.setViewport(e, this.previousViewport); } redo() { if (!this.viewport) return; const e = this.editor.getContainer(); if (!e) return; const t = this.editor.getPlugins().get("responsive"); t && t.viewportManager && t.viewportManager.setViewport(e, this.viewport); } } export { g as SetViewportCommand };