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

50 lines (49 loc) 1.38 kB
var o = Object.defineProperty; var p = (u, t, l) => t in u ? o(u, t, { enumerable: !0, configurable: !0, writable: !0, value: l }) : u[t] = l; var e = (u, t, l) => p(u, typeof t != "symbol" ? t + "" : t, l); import { PopupManager as s } from "../../../core/ui/PopupManager.mjs"; class c { constructor(t) { e(this, "popup"); e(this, "callback", null); e(this, "url", ""); this.popup = new s(t, { title: t.t("Insert YouTube Video"), className: "youtube-video-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: "input", id: "youtube-url", label: t.t("YouTube Video URL"), placeholder: "https://www.youtube.com/watch?v=...", onChange: (l) => this.url = l.toString() } ] }); } handleSubmit() { this.callback && (this.callback(this.url), this.popup.hide()); } show(t) { this.callback = t, this.popup.show(), this.popup.setFocus("youtube-url"); } destroy() { this.popup.destroy(), this.popup = null, this.callback = null; } } export { c as YouTubeVideoMenu };