UNPKG

md-editor-rt

Version:

Markdown editor for react, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...

62 lines (61 loc) 1.82 kB
var i = Object.defineProperty; var C = (t, s, o) => s in t ? i(t, s, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[s] = o; var E = (t, s, o) => C(t, typeof s != "symbol" ? s + "" : s, o); class _ { constructor() { // 事件池 E(this, "pools", {}); } // 移除事件监听 remove(s, o, e) { const a = this.pools[s] && this.pools[s][o]; a && (this.pools[s][o] = a.filter((n) => n !== e)); } // 清空全部事件,由于单一实例,多次注册会被共享内容 clear(s) { this.pools[s] = {}; } // 注册事件监听 on(s, o) { return this.pools[s] || (this.pools[s] = {}), this.pools[s][o.name] || (this.pools[s][o.name] = []), this.pools[s][o.name].push(o.callback), this.pools[s][o.name].includes(o.callback); } // 触发事件 emit(s, o, ...e) { this.pools[s] || (this.pools[s] = {}); const a = this.pools[s][o]; a && a.forEach((n) => { try { n(...e); } catch (l) { console.error(`${o} monitor event exception!`, l); } }); } } const r = new _(), A = "onSave", p = "changeCatalogVisible", R = "changeFullscreen", g = "pageFullscreenChanged", L = "fullscreenChanged", N = "previewChanged", d = "previewOnlyChanged", G = "htmlPreviewChanged", I = "catalogVisibleChanged", S = "buildFinished", T = "errorCatcher", D = "replace", H = "uploadImage", O = "openModals", V = "ctrlZ", u = "ctrlShiftZ", f = "catalogChanged", P = "pushCatalog", F = "rerender", b = "eventListener", m = "taskStateChanged", U = "sendEditorView", w = "getEditorView"; export { S as B, R as C, T as E, L as F, w as G, G as H, O, g as P, D as R, U as S, m as T, H as U, p as a, r as b, A as c, u as d, V as e, b as f, F as g, N as h, d as i, I as j, f as k, P as l };