v1.5.0
AtheraStudio Code
- (function () {
- "use strict";
-
- var A = (window.Athera = window.Athera || {});
- A.version = A.version || "";
-
- var handlers = {};
- A.on = function (name, fn) {
- (handlers[name] = handlers[name] || []).push(fn);
- };
- A.emit = function (name, data) {
- (handlers[name] || []).forEach(function (fn) {
- try { fn(data); } catch (e) { console.error(e); }
- });
- };
-
- var util = (A.util = {
- ext: function (name) {
- var m = /\.([^./]+)$/.exec(name || "");
- return m ? m[1].toLowerCase() : "";
- },
- basename: function (path) {
- return String(path).split("/").pop();
- },
- dirname: function (path) {
- var i = String(path).lastIndexOf("/");
- return i < 0 ? "" : path.slice(0, i);
- },
- join: function (dir, name) {
- return dir ? dir + "/" + name : name;
- },
- resolve: function (fromDir, ref) {
- if (!ref) return null;
- ref = ref.trim().split("#")[0].split("?")[0];
- if (!ref || /^([a-z][a-z0-9+.-]*:|\/\/)/i.test(ref)) return null;
- try { ref = decodeURI(ref); } catch (e) { }
- var parts = ref.charAt(0) === "/" ? [] : (fromDir ? fromDir.split("/") : []);
- ref.split("/").forEach(function (seg) {
- if (!seg || seg === ".") return;
- if (seg === "..") parts.pop();
- else parts.push(seg);
- });
- return parts.join("/");
- },
- debounce: function (fn, ms) {
- var t;
- return function () {
- var args = arguments, self = this;
- clearTimeout(t);
- t = setTimeout(function () { fn.apply(self, args); }, ms);
- };
- },
- esc: function (s) {
- return String(s).replace(/[&<>"']/g, function (c) {
- return { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c];
- });
- },
- el: function (tag, attrs, children) {
- var node = document.createElement(tag);
- Object.keys(attrs || {}).forEach(function (k) {
- var v = attrs[k];
- if (v == null || v === false) return;
- if (k.slice(0, 2) === "on") node.addEventListener(k.slice(2), v);
- else if (k === "html") node.innerHTML = v;
- else node.setAttribute(k, v === true ? "" : v);
- });
- [].concat(children || []).forEach(function (c) {
- if (c == null) return;
- node.appendChild(typeof c === "string" ? document.createTextNode(c) : c);
- });
- return node;
- }
- });
-
- A.store = {
- get: function (key, def) {
- try {
- var v = localStorage.getItem("athera." + key);
- return v == null ? def : JSON.parse(v);
- } catch (e) {
- return def;
- }
- },
- set: function (key, value) {
- try { localStorage.setItem("athera." + key, JSON.stringify(value)); } catch (e) { }
- }
- };
-
- var dbPromise = null;
- function db() {
- if (!dbPromise) {
- dbPromise = new Promise(function (resolve, reject) {
- if (!window.indexedDB) return reject(new Error("IndexedDB"));
- var req = indexedDB.open("athera-studio", 1);
- req.onupgradeneeded = function () { req.result.createObjectStore("kv"); };
- req.onsuccess = function () { resolve(req.result); };
- req.onerror = function () { reject(req.error); };
- });
- }
- return dbPromise;
- }
- function kv(mode, fn) {
- return db().then(function (d) {
- return new Promise(function (resolve, reject) {
- var tx = d.transaction("kv", mode);
- var req = fn(tx.objectStore("kv"));
- tx.oncomplete = function () { resolve(req && req.result); };
- tx.onerror = function () { reject(tx.error); };
- });
- });
- }
- A.idb = {
- get: function (key) { return kv("readonly", function (s) { return s.get(key); }).catch(function () { return undefined; }); },
- set: function (key, value) { return kv("readwrite", function (s) { return s.put(value, key); }).catch(function () {}); },
- del: function (key) { return kv("readwrite", function (s) { return s.delete(key); }).catch(function () {}); }
- };
-
- var P = {
- folder: '<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',
- folderOpen: '<path d="M3 7a2 2 0 0 1 2-2h4l2 2h7a2 2 0 0 1 2 2v1"/><path d="M3 19l2.5-8h16L19 19z"/>',
- file: '<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5"/>',
- filePlus: '<path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"/><path d="M14 3v5h5M12 11v6M9 14h6"/>',
- folderPlus: '<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><path d="M12 10v6M9 13h6"/>',
- save: '<path d="M5 3h11l5 5v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M7 3v5h8V3M7 21v-7h10v7"/>',
- refresh: '<path d="M20 11a8 8 0 0 0-14.6-4.5L3 9"/><path d="M3 4v5h5M4 13a8 8 0 0 0 14.6 4.5L21 15"/><path d="M21 20v-5h-5"/>',
- collapse: '<path d="M7 9l5-5 5 5M7 15l5 5 5-5"/>',
- trash: '<path d="M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3"/>',
- pencil: '<path d="M4 20h4L19 9l-4-4L4 16z"/><path d="M13.5 6.5l4 4"/>',
- copy: '<rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/>',
- x: '<path d="M6 6l12 12M18 6L6 18"/>',
- check: '<path d="M5 12.5l4.5 4.5L19 7.5"/>',
- menu: '<path d="M4 6h16M4 12h16M4 18h16"/>',
- eye: '<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/>',
- sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/>',
- moon: '<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/>',
- palette: '<path d="M12 3a9 9 0 1 0 0 18c1.1 0 2-.9 2-2 0-.5-.2-1-.5-1.3-.3-.4-.5-.8-.5-1.3 0-1.1.9-2 2-2h2.4A4.6 4.6 0 0 0 22 9.8C22 6 17.5 3 12 3z"/><circle cx="7.5" cy="11" r="1"/><circle cx="10" cy="7" r="1"/><circle cx="15" cy="7" r="1"/>',
- globe: '<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18"/>',
- chevron: '<path d="M9 6l6 6-6 6"/>',
- device: '<rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/>',
- external: '<path d="M14 4h6v6M20 4l-9 9"/><path d="M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/>',
- sidebar: '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M9 4v16"/>',
- split: '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M12 4v16"/>',
- wrap: '<path d="M4 6h16M4 12h13a3 3 0 0 1 0 6h-4M4 18h5"/><path d="M15 16l-2 2 2 2"/>',
- upload: '<path d="M12 16V4M7 9l5-5 5 5M4 20h16"/>',
- download: '<path d="M12 4v12M7 11l5 5 5-5M4 20h16"/>',
- warning: '<path d="M12 3l10 18H2z"/><path d="M12 10v5M12 18h.01"/>',
- settings: '<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>',
- type: '<path d="M4 7V5h16v2M9 19h6M12 5v14"/>',
- search: '<circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5"/>',
- replace: '<path d="M4 8h13l-3-3M20 16H7l3 3"/>',
- undo: '<path d="M9 14L4 9l5-5"/><path d="M4 9h10a6 6 0 0 1 0 12h-3"/>',
- rss: '<path d="M5 11a8 8 0 0 1 8 8M5 4a15 15 0 0 1 15 15"/><circle cx="6" cy="18" r="1.3"/>',
- sitemap: '<rect x="9" y="3" width="6" height="5" rx="1"/><rect x="2" y="16" width="6" height="5" rx="1"/><rect x="9" y="16" width="6" height="5" rx="1"/><rect x="16" y="16" width="6" height="5" rx="1"/><path d="M12 8v4M5 16v-4h14v4"/>',
- redo: '<path d="M15 14l5-5-5-5"/><path d="M20 9H10a6 6 0 0 0 0 12h3"/>',
- scissors: '<circle cx="6" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M20 4L8.12 15.88M14.47 14.48L20 20M8.12 8.12L12 12"/>',
- clipboard: '<rect x="8" y="2" width="8" height="4" rx="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>',
- saveAll: '<path d="M7 7V4h9l4 4v8h-3"/><path d="M3 9a2 2 0 0 1 2-2h8l4 4v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><path d="M6 20v-4h6v4M6 7v3h5"/>',
- saveAs: '<path d="M13 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h4"/><path d="M13 3l5 5v2M13 3v5h5"/><path d="M13 20.5l.5-2.5 5.5-5.5 2 2L16 20z"/>',
- folderX: '<path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><path d="M10 11l4 4M14 11l-4 4"/>',
- terminal: '<path d="M4 17l6-6-6-6"/><path d="M12 19h8"/>',
- gotoLine: '<path d="M4 6h16M4 12h7M4 18h7"/><path d="M15 14l3 3 3-3M18 17v-6"/>',
- folderSearch: '<path d="M11 20H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v2"/><circle cx="17" cy="16" r="3"/><path d="M21 20l-2.1-2.1"/>',
- selectText: '<path d="M5 3a2 2 0 0 0-2 2M19 3a2 2 0 0 1 2 2M21 19a2 2 0 0 1-2 2M5 21a2 2 0 0 1-2-2M9 3h1M9 21h1M14 3h1M14 21h1M3 9v1M21 9v1M3 14v1M21 14v1"/><path d="M7 8h8M7 12h10M7 16h6"/>',
- comment: '<path d="M10 4L6 20M18 4l-4 16"/>',
- duplicate: '<rect x="4" y="3" width="16" height="7" rx="1.5"/><rect x="4" y="14" width="16" height="7" rx="1.5"/>',
- code: '<path d="M16 18l6-6-6-6M8 6l-6 6 6 6"/>',
- zoomIn: '<circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5M8 11h6M11 8v6"/>',
- zoomOut: '<circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5M8 11h6"/>',
- zoomReset: '<circle cx="11" cy="11" r="7"/><path d="M20 20l-3.5-3.5M8.5 10h5M8.5 12.5h5"/>',
- keyboard: '<rect x="2" y="5" width="20" height="14" rx="2"/><path d="M6 9h.01M10 9h.01M14 9h.01M18 9h.01M6 13h.01M18 13h.01M9 16h6"/>',
- info: '<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/>',
- lightbulb: '<path d="M9 18h6M10 21h4"/><path d="M12 3a6 6 0 0 0-4 10.5c.8.8 1 1.5 1 2.5h6c0-1 .2-1.7 1-2.5A6 6 0 0 0 12 3z"/>',
- foldAll: '<path d="M7 4l5 5 5-5M7 20l5-5 5 5"/>',
- indent: '<path d="M4 6h16M12 12h8M4 18h16"/><path d="M4 9l3 3-3 3"/>',
- outdent: '<path d="M4 6h16M12 12h8M4 18h16"/><path d="M7 9l-3 3 3 3"/>',
- arrowLeft: '<path d="M19 12H5M11 6l-6 6 6 6"/>',
- arrowRight: '<path d="M5 12h14M13 6l6 6-6 6"/>',
- xCircle: '<circle cx="12" cy="12" r="9"/><path d="M9 9l6 6M15 9l-6 6"/>',
- closeAll: '<path d="M4 4l7 7M11 4l-7 7"/><path d="M13 13l7 7M20 13l-7 7"/>',
- wand: '<path d="M15 4V2M15 16v-2M8 9h2M20 9h2M17.8 11.8l1.4 1.4M17.8 6.2l1.4-1.4M12.2 6.2l-1.4-1.4"/><path d="M15 9l-12 12"/>',
- sparkles: '<path d="M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z"/><path d="M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8z"/>',
- key: '<circle cx="8" cy="15" r="4"/><path d="M10.8 12.2L20 3M16 7l3 3M14 9l2 2"/>',
- shield: '<path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6z"/><path d="M9 12l2 2 4-4"/>',
- chat: '<path d="M4 5h16v11H9l-5 4z"/><path d="M8 9h8M8 12h5"/>',
- coins: '<ellipse cx="12" cy="6" rx="7" ry="3"/><path d="M5 6v6c0 1.7 3.1 3 7 3s7-1.3 7-3V6M5 12v6c0 1.7 3.1 3 7 3s7-1.3 7-3v-6"/>',
- ban: '<circle cx="12" cy="12" r="9"/><path d="M5.6 5.6l12.8 12.8"/>',
- lock: '<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',
- plus: '<path d="M12 5v14M5 12h14"/>',
- power: '<path d="M12 3v9"/><path d="M6.3 6.3a8 8 0 1 0 11.4 0"/>',
- target: '<circle cx="12" cy="12" r="8"/><circle cx="12" cy="12" r="3"/><path d="M12 1v4M12 19v4M1 12h4M19 12h4"/>',
- layout: '<rect x="2" y="5" width="11" height="14" rx="1.5"/><rect x="15" y="8" width="7" height="11" rx="1.5"/><path d="M5 16h5"/>'
- };
- A.icon = function (name, cls) {
- return '<svg class="ath-icon' + (cls ? " " + cls : "") + '" viewBox="0 0 24 24" fill="none" stroke="currentColor" ' +
- 'stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' + (P[name] || "") + "</svg>";
- };
- A.hydrateIcons = function (root) {
- (root || document).querySelectorAll("[data-icon]").forEach(function (n) {
- n.insertAdjacentHTML("afterbegin", A.icon(n.getAttribute("data-icon")));
- n.removeAttribute("data-icon");
- });
- };
-
- A.asset = function (url) {
- return A.version ? url + (url.indexOf("?") < 0 ? "?" : "&") + "v=" + encodeURIComponent(A.version) : url;
- };
-
- var ui = (A.ui = {});
-
- ui.toast = function (message, tone) {
- if (window.Orbitarium) Orbitarium.toast(message, { tone: tone });
- };
-
- ui.dialog = function (opts) {
- return new Promise(function (resolve) {
- var opener = document.activeElement;
- var overlay = util.el("div", { class: "orb-modal-overlay is-open ath-dialog", role: "dialog", "aria-modal": "true" });
- var modal = util.el("div", { class: "orb-modal" + (opts.size ? " orb-modal-" + opts.size : "") });
- var closeBtn = util.el("button", { class: "orb-modal-close", type: "button", "aria-label": A.t("common.close"), html: A.icon("x") });
- modal.appendChild(util.el("div", { class: "orb-modal-header" }, [
- util.el("div", { class: "orb-modal-title" }, opts.title || ""),
- closeBtn
- ]));
- var body = util.el("div", { class: "orb-modal-body" });
- if (typeof opts.body === "string") body.innerHTML = opts.body;
- else if (opts.body) body.appendChild(opts.body);
- modal.appendChild(body);
-
- var actions = util.el("div", { class: "orb-modal-actions" });
- (opts.actions || []).forEach(function (a) {
- actions.appendChild(util.el("button", {
- type: "button",
- class: "orb-btn orb-btn-sm orb-btn-" + (a.kind || "secondary"),
- onclick: function () { done(a.value); }
- }, a.label));
- });
- if (opts.actions && opts.actions.length) modal.appendChild(actions);
- overlay.appendChild(modal);
-
- var finished = false;
- function done(value) {
- if (finished) return;
- finished = true;
- document.removeEventListener("keydown", onKey, true);
- overlay.remove();
- if (opener && opener.focus && document.contains(opener)) opener.focus({ preventScroll: true });
- resolve(value === undefined ? null : value);
- }
- function onKey(e) {
- if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); done(null); }
- if (e.key === "Enter" && opts.enterValue !== undefined && e.target.tagName === "INPUT") {
- e.preventDefault();
- done(opts.enterValue);
- }
- }
- if (opts.ref) opts.ref.close = function () { done(null); };
- closeBtn.addEventListener("click", function () { done(null); });
- overlay.addEventListener("mousedown", function (e) { if (e.target === overlay) done(null); });
- document.addEventListener("keydown", onKey, true);
- document.body.appendChild(overlay);
-
- var focus = modal.querySelector("input, textarea, select") || actions.querySelector(".orb-btn-primary, .orb-btn-danger") || closeBtn;
- setTimeout(function () { focus.focus(); if (opts.onOpen) opts.onOpen(modal); }, 0);
- });
- };
-
- ui.prompt = function (title, label, value, okLabel) {
- var input = util.el("input", { class: "orb-input orb-mono", type: "text", spellcheck: "false", autocomplete: "off", value: value || "" });
- var body = util.el("div", {}, [util.el("label", { class: "orb-label" }, label), input]);
- return ui.dialog({
- title: title,
- body: body,
- size: "sm",
- actions: [
- { label: A.t("common.cancel"), value: null, kind: "ghost" },
- { label: okLabel || A.t("common.ok"), value: "ok", kind: "primary" }
- ],
- enterValue: "ok",
- onOpen: function () {
- var v = input.value, dot = v.lastIndexOf(".");
- input.setSelectionRange(0, dot > 0 ? dot : v.length);
- }
- }).then(function (r) {
- var v = input.value.trim();
- return r === "ok" && v ? v : null;
- });
- };
-
- ui.confirm = function (title, message, okLabel, danger) {
- return ui.dialog({
- title: title,
- body: util.el("p", { class: "ath-dialog-text" }, message),
- size: "sm",
- actions: [
- { label: A.t("common.cancel"), value: false, kind: "ghost" },
- { label: okLabel || A.t("common.ok"), value: true, kind: danger ? "danger" : "primary" }
- ]
- }).then(function (r) { return r === true; });
- };
-
- ui.contextMenu = function (x, y, items) {
- ui.closeContextMenu();
- var menu = util.el("div", { class: "orb-dropdown-menu is-open ath-context-menu", role: "menu" });
- items.forEach(function (it) {
- if (it === "-") return menu.appendChild(util.el("div", { class: "orb-dropdown-divider" }));
- menu.appendChild(util.el("button", {
- type: "button",
- role: "menuitem",
- class: "orb-dropdown-item" + (it.danger ? " is-danger" : ""),
- html: (it.icon ? A.icon(it.icon) : "") + "<span>" + util.esc(it.label) + "</span>" +
- (it.kbd ? '<span class="orb-kbd">' + util.esc(it.kbd) + "</span>" : ""),
- onclick: function () { ui.closeContextMenu(); it.action(); }
- }));
- });
- document.body.appendChild(menu);
- menu.style.maxHeight = Math.max(120, window.innerHeight - 16) + "px";
- menu.style.overflowY = "auto";
- var w = menu.offsetWidth, h = menu.offsetHeight;
- menu.style.left = Math.max(8, Math.min(x, window.innerWidth - w - 8)) + "px";
- menu.style.top = Math.max(8, Math.min(y, window.innerHeight - h - 8)) + "px";
- var first = menu.querySelector("button");
- if (first) first.focus();
- function outside(e) { if (!menu.contains(e.target)) ui.closeContextMenu(); }
- function keys(e) {
- if (e.key === "Escape") { e.stopPropagation(); ui.closeContextMenu(); }
- if (e.key === "ArrowDown" || e.key === "ArrowUp") {
- e.preventDefault();
- var list = [].slice.call(menu.querySelectorAll("button"));
- var i = list.indexOf(document.activeElement);
- list[(i + (e.key === "ArrowDown" ? 1 : -1) + list.length) % list.length].focus();
- }
- }
- setTimeout(function () {
- document.addEventListener("mousedown", outside, true);
- document.addEventListener("keydown", keys, true);
- window.addEventListener("blur", ui.closeContextMenu);
- }, 0);
- ui._menuCleanup = function () {
- document.removeEventListener("mousedown", outside, true);
- document.removeEventListener("keydown", keys, true);
- window.removeEventListener("blur", ui.closeContextMenu);
- menu.remove();
- };
- };
- ui.copyText = function (text) {
- function legacy() {
- var ta = util.el("textarea", { style: "position:fixed;top:0;left:0;opacity:0" });
- ta.value = text;
- document.body.appendChild(ta);
- ta.select();
- var ok = false;
- try { ok = document.execCommand("copy"); } catch (e) { }
- ta.remove();
- if (!ok) throw new Error("clipboard");
- }
- if (navigator.clipboard && navigator.clipboard.writeText) {
- return navigator.clipboard.writeText(text).catch(legacy);
- }
- return Promise.resolve().then(legacy);
- };
-
- ui.closeContextMenu = function () {
- if (ui._menuCleanup) { var c = ui._menuCleanup; ui._menuCleanup = null; c(); }
- };
- })();
-