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

3 lines (2 loc) 1.88 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 */ "use strict";var u=Object.defineProperty;var h=(i,e,t)=>e in i?u(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var n=(i,e,t)=>h(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../utils/helpers.cjs");class b{constructor(e,t,o){n(this,"editor");n(this,"onSubmit");n(this,"calendar");n(this,"formElement");this.editor=e,this.onSubmit=t,this.calendar=o}getElement(){var s,c;const e=document.createElement("div");e.className="calendar-form-container",this.formElement=r.createForm("calendar-form",null,"POST");const t=r.createContainer("form-group mb-4"),o=r.createLabel(this.editor.t("Calendar Title"),"calendar-title"),a=r.createInputField("text",this.editor.t("Enter calendar title"),((s=this.calendar)==null?void 0:s.title)||"");a.id="calendar-title",a.name="title",a.required=!0,t.appendChild(o),t.appendChild(a),this.formElement.appendChild(t);const d=r.createContainer("form-group mb-4"),p=r.createLabel(this.editor.t("Description"),"calendar-description"),l=r.createTextarea(this.editor.t("Enter calendar description"),((c=this.calendar)==null?void 0:c.description)||"");return l.id="calendar-description",l.name="description",l.rows=3,d.appendChild(p),d.appendChild(l),this.formElement.appendChild(d),this.formElement.addEventListener("submit",r.createFormSubmitHandler(this.formElement,m=>{this.onSubmit({title:m.title,description:m.description})})),e.appendChild(this.formElement),e}submit(){if(!this.formElement)return!1;const e=new Event("submit",{bubbles:!0,cancelable:!0});return this.formElement.dispatchEvent(e),!0}}exports.CalendarForm=b;