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
78 lines (77 loc) • 2.56 kB
JavaScript
/*! 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 p = Object.defineProperty;
var n = (e, t, o) => t in e ? p(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
var i = (e, t, o) => n(e, typeof t != "symbol" ? t + "" : t, o);
import { PopupManager as r } from "../../../core/ui/PopupManager.mjs";
import { ExportService as u } from "../services/ExportService.mjs";
import s from "../../../icons/html.svg.mjs";
import h from "../../../icons/markdown.svg.mjs";
import a from "../../../icons/text.svg.mjs";
import c from "../../../icons/pdf.svg.mjs";
class y {
constructor(t) {
i(this, "popup");
i(this, "exportService");
i(this, "content", "");
this.popup = new r(t, {
title: t.t("Export"),
className: "example-popup",
closeOnClickOutside: !0,
items: [
{
type: "button",
id: "submit-button",
value: "html",
icon: s,
text: t.t("HTML File"),
buttonVariant: "primary",
onChange: (o) => {
this.exportService.export(this.content, o.toString()), this.popup.hide();
}
},
{
type: "button",
id: "submit-button",
value: "markdown",
icon: h,
text: t.t("Markdown File"),
buttonVariant: "primary",
onChange: (o) => {
this.exportService.export(this.content, o.toString()), this.popup.hide();
}
},
{
type: "button",
id: "submit-button",
value: "text",
icon: a,
text: t.t("Plain Text"),
buttonVariant: "primary",
onChange: (o) => {
this.exportService.export(this.content, o.toString()), this.popup.hide();
}
},
{
type: "button",
id: "submit-button",
value: "pdf",
icon: c,
text: t.t("Print / PDF File"),
buttonVariant: "primary",
onChange: (o) => {
this.exportService.export(this.content, o.toString()), this.popup.hide();
}
}
]
}), this.exportService = new u();
}
show(t) {
this.content = t, this.popup.show();
}
destroy() {
this.popup && this.popup.destroy(), this.popup = null, this.exportService = null, this.content = "";
}
}
export {
y as ExportMenu
};