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.95 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 */
"use strict";var s=Object.defineProperty;var u=(i,t,e)=>t in i?s(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var r=(i,t,e)=>u(i,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../core/ui/ContextMenu.cjs");class m{constructor(t,e){r(this,"editor");r(this,"currentContextMenu",null);this.editor=e}show(t,e,o){this.currentContextMenu&&(this.currentContextMenu.destroy(),this.currentContextMenu=null);const l=[{label:this.editor.t("Edit Timer"),icon:"✏️",action:"edit-timer",onClick:()=>{o("edit-timer"),this.closeContextMenu()},type:"button"},{label:this.editor.t("Copy Timer"),icon:"📋",action:"copy-timer",onClick:()=>{o("copy-timer"),this.closeContextMenu()},type:"button"},{label:this.editor.t("Export Timer"),icon:"📤",action:"export-timer",onClick:()=>{o("export-timer"),this.closeContextMenu()},type:"button"},{label:this.editor.t("Import Timer"),icon:"📥",action:"import-timer",onClick:()=>{o("import-timer"),this.closeContextMenu()},type:"button"},{type:"divider"},{label:this.editor.t("Delete Timer"),icon:"🗑️",action:"delete-timer",className:"danger",onClick:()=>{o("delete-timer"),this.closeContextMenu()},type:"button"}];this.currentContextMenu=new c.ContextMenu(this.editor,l);const n=document.createElement("div");n.style.position="fixed",n.style.left=`${t.clientX}px`,n.style.top=`${t.clientY}px`,document.body.appendChild(n),this.currentContextMenu.show(n,t.clientX,t.clientY),document.body.removeChild(n)}closeContextMenu(){this.currentContextMenu&&(this.currentContextMenu.destroy(),this.currentContextMenu=null)}destroy(){this.closeContextMenu(),this.editor=null}}exports.TimerContextMenu=m;