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
3 lines (2 loc) • 1.54 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 i=Object.defineProperty;var s=(o,t,e)=>t in o?i(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var a=(o,t,e)=>s(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../../core/ui/PopupManager.cjs"),n=require("../../../utils/helpers.cjs");class p{constructor(t){a(this,"popup");a(this,"callback",null);a(this,"value","");this.popup=new l.PopupManager(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=n.createContainer("p-0"),e=n.createP("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")}}exports.FootnoteMenu=p;