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

64 lines (63 loc) 2.05 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 p = (o, t, e) => t in o ? n(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e; var a = (o, t, e) => p(o, typeof t != "symbol" ? t + "" : t, e); import { PopupManager as i } from "../../../core/ui/PopupManager.mjs"; import { createContainer as l, createP as s } from "../../../utils/helpers.mjs"; class u { constructor(t) { a(this, "popup"); a(this, "callback", null); // Ссылки на элементы a(this, "value", ""); this.popup = new i(t, { title: t.t("Add Footnote"), className: "footnote-menu", closeOnClickOutside: !0, buttons: [ { label: t.t("Cancel"), variant: "secondary", onClick: () => this.popup.hide() }, { label: t.t("Insert"), variant: "primary", onClick: () => this.handleSubmit() } ], items: [ { type: "custom", id: "footnote-hint", content: () => this.createContent() }, { type: "textarea", id: "footnote-textarea", onChange: (e) => this.value = e.toString() }, { type: "text", id: "footnote-text", value: t.t( "Add explanatory or reference text that will appear at the bottom of the document" ) } ] }); } createContent() { const t = l("p-0"), e = s("mt-2 text-sm text-gray-500"); return t.appendChild(e), t; } handleSubmit() { this.callback && (this.callback(this.value), this.popup.hide()); } show(t, e = "") { this.callback = t, this.popup.setValue("footnote-textarea", e), this.popup.show(), this.popup.setFocus("footnote-textarea"); } } export { u as FootnoteMenu };