@editora/core 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CodePlugin.native-BH-K4xmW.mjs → CodePlugin.native-BcVqm5MS.mjs} +64 -65
- package/dist/{CodePlugin.native-hNgfXlfS.mjs → CodePlugin.native-Rgxx2Igx.mjs} +2708 -1225
- package/dist/{DocumentManagerPlugin.native-iFip6s4Q.mjs → DocumentManagerPlugin.native-B8K-Oqom.mjs} +12 -11
- package/dist/{PreviewPlugin.native-CiR51jql.mjs → PreviewPlugin.native-Dyht8mGi.mjs} +48 -51
- package/dist/{TablePlugin.native-BjIxYZ2X.mjs → TablePlugin.native-C1YZ372P.mjs} +156 -147
- package/dist/TemplatePlugin.native-BDV2eik2.mjs +628 -0
- package/dist/{documentManager-BcBIv5P-.mjs → documentManager-BWK_-KJp.mjs} +524 -526
- package/dist/editora.min.js +17 -17
- package/dist/editora.umd.js +22 -22
- package/dist/index-CclXYzUB.js +12 -0
- package/dist/{index-XsYC_KdJ.mjs → index-DeUjxpKd.mjs} +406 -386
- package/dist/index.cjs.js +10 -10
- package/dist/index.esm.js +78 -67
- package/dist/plugin-loader.js +4 -4
- package/dist/purify.es-BHa5gZB7.mjs +1481 -0
- package/dist/sanitizeHtml-DA0ajC6k.mjs +17 -0
- package/dist/webcomponent-core.js +376 -362
- package/dist/webcomponent-core.min.js +91 -89
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +2 -2
- package/dist/webcomponent.js +382 -368
- package/dist/webcomponent.min.js +968 -967
- package/index.d.ts +9 -0
- package/package.json +1 -1
- package/dist/TemplatePlugin.native-D6n5RUnC.mjs +0 -1176
- package/dist/index-_eKRBZPq.js +0 -12
|
@@ -1,1176 +0,0 @@
|
|
|
1
|
-
import { e as hn } from "./escapeHtml-CX8RelZ1.mjs";
|
|
2
|
-
import { i as Tn } from "./dialogHelpers-DBf7WqYH.mjs";
|
|
3
|
-
const {
|
|
4
|
-
entries: Ut,
|
|
5
|
-
setPrototypeOf: wt,
|
|
6
|
-
isFrozen: bn,
|
|
7
|
-
getPrototypeOf: En,
|
|
8
|
-
getOwnPropertyDescriptor: An
|
|
9
|
-
} = Object;
|
|
10
|
-
let {
|
|
11
|
-
freeze: L,
|
|
12
|
-
seal: M,
|
|
13
|
-
create: we
|
|
14
|
-
} = Object, {
|
|
15
|
-
apply: et,
|
|
16
|
-
construct: tt
|
|
17
|
-
} = typeof Reflect != "undefined" && Reflect;
|
|
18
|
-
L || (L = function(t) {
|
|
19
|
-
return t;
|
|
20
|
-
});
|
|
21
|
-
M || (M = function(t) {
|
|
22
|
-
return t;
|
|
23
|
-
});
|
|
24
|
-
et || (et = function(t, o) {
|
|
25
|
-
for (var i = arguments.length, c = new Array(i > 2 ? i - 2 : 0), u = 2; u < i; u++)
|
|
26
|
-
c[u - 2] = arguments[u];
|
|
27
|
-
return t.apply(o, c);
|
|
28
|
-
});
|
|
29
|
-
tt || (tt = function(t) {
|
|
30
|
-
for (var o = arguments.length, i = new Array(o > 1 ? o - 1 : 0), c = 1; c < o; c++)
|
|
31
|
-
i[c - 1] = arguments[c];
|
|
32
|
-
return new t(...i);
|
|
33
|
-
});
|
|
34
|
-
const Re = R(Array.prototype.forEach), _n = R(Array.prototype.lastIndexOf), Ct = R(Array.prototype.pop), ce = R(Array.prototype.push), yn = R(Array.prototype.splice), Ce = R(String.prototype.toLowerCase), $e = R(String.prototype.toString), qe = R(String.prototype.match), ue = R(String.prototype.replace), vn = R(String.prototype.indexOf), Sn = R(String.prototype.trim), w = R(Object.prototype.hasOwnProperty), x = R(RegExp.prototype.test), pe = xn(TypeError);
|
|
35
|
-
function R(n) {
|
|
36
|
-
return function(t) {
|
|
37
|
-
t instanceof RegExp && (t.lastIndex = 0);
|
|
38
|
-
for (var o = arguments.length, i = new Array(o > 1 ? o - 1 : 0), c = 1; c < o; c++)
|
|
39
|
-
i[c - 1] = arguments[c];
|
|
40
|
-
return et(n, t, i);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function xn(n) {
|
|
44
|
-
return function() {
|
|
45
|
-
for (var t = arguments.length, o = new Array(t), i = 0; i < t; i++)
|
|
46
|
-
o[i] = arguments[i];
|
|
47
|
-
return tt(n, o);
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function s(n, t) {
|
|
51
|
-
let o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ce;
|
|
52
|
-
wt && wt(n, null);
|
|
53
|
-
let i = t.length;
|
|
54
|
-
for (; i--; ) {
|
|
55
|
-
let c = t[i];
|
|
56
|
-
if (typeof c == "string") {
|
|
57
|
-
const u = o(c);
|
|
58
|
-
u !== c && (bn(t) || (t[i] = u), c = u);
|
|
59
|
-
}
|
|
60
|
-
n[c] = !0;
|
|
61
|
-
}
|
|
62
|
-
return n;
|
|
63
|
-
}
|
|
64
|
-
function Ln(n) {
|
|
65
|
-
for (let t = 0; t < n.length; t++)
|
|
66
|
-
w(n, t) || (n[t] = null);
|
|
67
|
-
return n;
|
|
68
|
-
}
|
|
69
|
-
function H(n) {
|
|
70
|
-
const t = we(null);
|
|
71
|
-
for (const [o, i] of Ut(n))
|
|
72
|
-
w(n, o) && (Array.isArray(i) ? t[o] = Ln(i) : i && typeof i == "object" && i.constructor === Object ? t[o] = H(i) : t[o] = i);
|
|
73
|
-
return t;
|
|
74
|
-
}
|
|
75
|
-
function de(n, t) {
|
|
76
|
-
for (; n !== null; ) {
|
|
77
|
-
const i = An(n, t);
|
|
78
|
-
if (i) {
|
|
79
|
-
if (i.get)
|
|
80
|
-
return R(i.get);
|
|
81
|
-
if (typeof i.value == "function")
|
|
82
|
-
return R(i.value);
|
|
83
|
-
}
|
|
84
|
-
n = En(n);
|
|
85
|
-
}
|
|
86
|
-
function o() {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
return o;
|
|
90
|
-
}
|
|
91
|
-
const Ot = L(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Xe = L(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Ke = L(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), Rn = L(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Ze = L(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Dn = L(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Nt = L(["#text"]), Mt = L(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Qe = L(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), It = L(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), De = L(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), wn = M(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Cn = M(/<%[\w\W]*|[\w\W]*%>/gm), On = M(/\$\{[\w\W]*/gm), Nn = M(/^data-[\-\w.\u00B7-\uFFFF]+$/), Mn = M(/^aria-[\-\w]+$/), zt = M(
|
|
92
|
-
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
93
|
-
// eslint-disable-line no-useless-escape
|
|
94
|
-
), In = M(/^(?:\w+script|data):/i), kn = M(
|
|
95
|
-
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
96
|
-
// eslint-disable-line no-control-regex
|
|
97
|
-
), Gt = M(/^html$/i), Pn = M(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
98
|
-
var kt = /* @__PURE__ */ Object.freeze({
|
|
99
|
-
__proto__: null,
|
|
100
|
-
ARIA_ATTR: Mn,
|
|
101
|
-
ATTR_WHITESPACE: kn,
|
|
102
|
-
CUSTOM_ELEMENT: Pn,
|
|
103
|
-
DATA_ATTR: Nn,
|
|
104
|
-
DOCTYPE_NAME: Gt,
|
|
105
|
-
ERB_EXPR: Cn,
|
|
106
|
-
IS_ALLOWED_URI: zt,
|
|
107
|
-
IS_SCRIPT_OR_DATA: In,
|
|
108
|
-
MUSTACHE_EXPR: wn,
|
|
109
|
-
TMPLIT_EXPR: On
|
|
110
|
-
});
|
|
111
|
-
const me = {
|
|
112
|
-
element: 1,
|
|
113
|
-
text: 3,
|
|
114
|
-
// Deprecated
|
|
115
|
-
progressingInstruction: 7,
|
|
116
|
-
comment: 8,
|
|
117
|
-
document: 9
|
|
118
|
-
}, Hn = function() {
|
|
119
|
-
return typeof window == "undefined" ? null : window;
|
|
120
|
-
}, Fn = function(t, o) {
|
|
121
|
-
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
122
|
-
return null;
|
|
123
|
-
let i = null;
|
|
124
|
-
const c = "data-tt-policy-suffix";
|
|
125
|
-
o && o.hasAttribute(c) && (i = o.getAttribute(c));
|
|
126
|
-
const u = "dompurify" + (i ? "#" + i : "");
|
|
127
|
-
try {
|
|
128
|
-
return t.createPolicy(u, {
|
|
129
|
-
createHTML(C) {
|
|
130
|
-
return C;
|
|
131
|
-
},
|
|
132
|
-
createScriptURL(C) {
|
|
133
|
-
return C;
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
} catch (C) {
|
|
137
|
-
return console.warn("TrustedTypes policy " + u + " could not be created."), null;
|
|
138
|
-
}
|
|
139
|
-
}, Pt = function() {
|
|
140
|
-
return {
|
|
141
|
-
afterSanitizeAttributes: [],
|
|
142
|
-
afterSanitizeElements: [],
|
|
143
|
-
afterSanitizeShadowDOM: [],
|
|
144
|
-
beforeSanitizeAttributes: [],
|
|
145
|
-
beforeSanitizeElements: [],
|
|
146
|
-
beforeSanitizeShadowDOM: [],
|
|
147
|
-
uponSanitizeAttribute: [],
|
|
148
|
-
uponSanitizeElement: [],
|
|
149
|
-
uponSanitizeShadowNode: []
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
function Wt() {
|
|
153
|
-
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Hn();
|
|
154
|
-
const t = (l) => Wt(l);
|
|
155
|
-
if (t.version = "3.3.2", t.removed = [], !n || !n.document || n.document.nodeType !== me.document || !n.Element)
|
|
156
|
-
return t.isSupported = !1, t;
|
|
157
|
-
let {
|
|
158
|
-
document: o
|
|
159
|
-
} = n;
|
|
160
|
-
const i = o, c = i.currentScript, {
|
|
161
|
-
DocumentFragment: u,
|
|
162
|
-
HTMLTemplateElement: C,
|
|
163
|
-
Node: O,
|
|
164
|
-
Element: d,
|
|
165
|
-
NodeFilter: f,
|
|
166
|
-
NamedNodeMap: I = n.NamedNodeMap || n.MozNamedAttrMap,
|
|
167
|
-
HTMLFormElement: V,
|
|
168
|
-
DOMParser: Oe,
|
|
169
|
-
trustedTypes: Te
|
|
170
|
-
} = n, oe = d.prototype, Xt = de(oe, "cloneNode"), Kt = de(oe, "remove"), Zt = de(oe, "nextSibling"), Qt = de(oe, "childNodes"), be = de(oe, "parentNode");
|
|
171
|
-
if (typeof C == "function") {
|
|
172
|
-
const l = o.createElement("template");
|
|
173
|
-
l.content && l.content.ownerDocument && (o = l.content.ownerDocument);
|
|
174
|
-
}
|
|
175
|
-
let v, ae = "";
|
|
176
|
-
const {
|
|
177
|
-
implementation: Ne,
|
|
178
|
-
createNodeIterator: Jt,
|
|
179
|
-
createDocumentFragment: en,
|
|
180
|
-
getElementsByTagName: tn
|
|
181
|
-
} = o, {
|
|
182
|
-
importNode: nn
|
|
183
|
-
} = i;
|
|
184
|
-
let S = Pt();
|
|
185
|
-
t.isSupported = typeof Ut == "function" && typeof be == "function" && Ne && Ne.createHTMLDocument !== void 0;
|
|
186
|
-
const {
|
|
187
|
-
MUSTACHE_EXPR: Me,
|
|
188
|
-
ERB_EXPR: Ie,
|
|
189
|
-
TMPLIT_EXPR: ke,
|
|
190
|
-
DATA_ATTR: rn,
|
|
191
|
-
ARIA_ATTR: on,
|
|
192
|
-
IS_SCRIPT_OR_DATA: an,
|
|
193
|
-
ATTR_WHITESPACE: at,
|
|
194
|
-
CUSTOM_ELEMENT: ln
|
|
195
|
-
} = kt;
|
|
196
|
-
let {
|
|
197
|
-
IS_ALLOWED_URI: it
|
|
198
|
-
} = kt, E = null;
|
|
199
|
-
const lt = s({}, [...Ot, ...Xe, ...Ke, ...Ze, ...Nt]);
|
|
200
|
-
let A = null;
|
|
201
|
-
const st = s({}, [...Mt, ...Qe, ...It, ...De]);
|
|
202
|
-
let m = Object.seal(we(null, {
|
|
203
|
-
tagNameCheck: {
|
|
204
|
-
writable: !0,
|
|
205
|
-
configurable: !1,
|
|
206
|
-
enumerable: !0,
|
|
207
|
-
value: null
|
|
208
|
-
},
|
|
209
|
-
attributeNameCheck: {
|
|
210
|
-
writable: !0,
|
|
211
|
-
configurable: !1,
|
|
212
|
-
enumerable: !0,
|
|
213
|
-
value: null
|
|
214
|
-
},
|
|
215
|
-
allowCustomizedBuiltInElements: {
|
|
216
|
-
writable: !0,
|
|
217
|
-
configurable: !1,
|
|
218
|
-
enumerable: !0,
|
|
219
|
-
value: !1
|
|
220
|
-
}
|
|
221
|
-
})), ie = null, Ee = null;
|
|
222
|
-
const B = Object.seal(we(null, {
|
|
223
|
-
tagCheck: {
|
|
224
|
-
writable: !0,
|
|
225
|
-
configurable: !1,
|
|
226
|
-
enumerable: !0,
|
|
227
|
-
value: null
|
|
228
|
-
},
|
|
229
|
-
attributeCheck: {
|
|
230
|
-
writable: !0,
|
|
231
|
-
configurable: !1,
|
|
232
|
-
enumerable: !0,
|
|
233
|
-
value: null
|
|
234
|
-
}
|
|
235
|
-
}));
|
|
236
|
-
let ct = !0, Pe = !0, ut = !1, pt = !0, $ = !1, Ae = !0, j = !1, He = !1, Fe = !1, q = !1, _e = !1, ye = !1, dt = !0, mt = !1;
|
|
237
|
-
const sn = "user-content-";
|
|
238
|
-
let Ue = !0, le = !1, X = {}, k = null;
|
|
239
|
-
const ze = s({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
240
|
-
let ft = null;
|
|
241
|
-
const gt = s({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
242
|
-
let Ge = null;
|
|
243
|
-
const ht = s({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ve = "http://www.w3.org/1998/Math/MathML", Se = "http://www.w3.org/2000/svg", U = "http://www.w3.org/1999/xhtml";
|
|
244
|
-
let K = U, We = !1, Be = null;
|
|
245
|
-
const cn = s({}, [ve, Se, U], $e);
|
|
246
|
-
let xe = s({}, ["mi", "mo", "mn", "ms", "mtext"]), Le = s({}, ["annotation-xml"]);
|
|
247
|
-
const un = s({}, ["title", "style", "font", "a", "script"]);
|
|
248
|
-
let se = null;
|
|
249
|
-
const pn = ["application/xhtml+xml", "text/html"], dn = "text/html";
|
|
250
|
-
let b = null, Z = null;
|
|
251
|
-
const mn = o.createElement("form"), Tt = function(e) {
|
|
252
|
-
return e instanceof RegExp || e instanceof Function;
|
|
253
|
-
}, Ve = function() {
|
|
254
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
255
|
-
if (!(Z && Z === e)) {
|
|
256
|
-
if ((!e || typeof e != "object") && (e = {}), e = H(e), se = // eslint-disable-next-line unicorn/prefer-includes
|
|
257
|
-
pn.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? dn : e.PARSER_MEDIA_TYPE, b = se === "application/xhtml+xml" ? $e : Ce, E = w(e, "ALLOWED_TAGS") ? s({}, e.ALLOWED_TAGS, b) : lt, A = w(e, "ALLOWED_ATTR") ? s({}, e.ALLOWED_ATTR, b) : st, Be = w(e, "ALLOWED_NAMESPACES") ? s({}, e.ALLOWED_NAMESPACES, $e) : cn, Ge = w(e, "ADD_URI_SAFE_ATTR") ? s(H(ht), e.ADD_URI_SAFE_ATTR, b) : ht, ft = w(e, "ADD_DATA_URI_TAGS") ? s(H(gt), e.ADD_DATA_URI_TAGS, b) : gt, k = w(e, "FORBID_CONTENTS") ? s({}, e.FORBID_CONTENTS, b) : ze, ie = w(e, "FORBID_TAGS") ? s({}, e.FORBID_TAGS, b) : H({}), Ee = w(e, "FORBID_ATTR") ? s({}, e.FORBID_ATTR, b) : H({}), X = w(e, "USE_PROFILES") ? e.USE_PROFILES : !1, ct = e.ALLOW_ARIA_ATTR !== !1, Pe = e.ALLOW_DATA_ATTR !== !1, ut = e.ALLOW_UNKNOWN_PROTOCOLS || !1, pt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, $ = e.SAFE_FOR_TEMPLATES || !1, Ae = e.SAFE_FOR_XML !== !1, j = e.WHOLE_DOCUMENT || !1, q = e.RETURN_DOM || !1, _e = e.RETURN_DOM_FRAGMENT || !1, ye = e.RETURN_TRUSTED_TYPE || !1, Fe = e.FORCE_BODY || !1, dt = e.SANITIZE_DOM !== !1, mt = e.SANITIZE_NAMED_PROPS || !1, Ue = e.KEEP_CONTENT !== !1, le = e.IN_PLACE || !1, it = e.ALLOWED_URI_REGEXP || zt, K = e.NAMESPACE || U, xe = e.MATHML_TEXT_INTEGRATION_POINTS || xe, Le = e.HTML_INTEGRATION_POINTS || Le, m = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && Tt(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (m.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && Tt(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (m.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (m.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), $ && (Pe = !1), _e && (q = !0), X && (E = s({}, Nt), A = we(null), X.html === !0 && (s(E, Ot), s(A, Mt)), X.svg === !0 && (s(E, Xe), s(A, Qe), s(A, De)), X.svgFilters === !0 && (s(E, Ke), s(A, Qe), s(A, De)), X.mathMl === !0 && (s(E, Ze), s(A, It), s(A, De))), w(e, "ADD_TAGS") || (B.tagCheck = null), w(e, "ADD_ATTR") || (B.attributeCheck = null), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? B.tagCheck = e.ADD_TAGS : (E === lt && (E = H(E)), s(E, e.ADD_TAGS, b))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? B.attributeCheck = e.ADD_ATTR : (A === st && (A = H(A)), s(A, e.ADD_ATTR, b))), e.ADD_URI_SAFE_ATTR && s(Ge, e.ADD_URI_SAFE_ATTR, b), e.FORBID_CONTENTS && (k === ze && (k = H(k)), s(k, e.FORBID_CONTENTS, b)), e.ADD_FORBID_CONTENTS && (k === ze && (k = H(k)), s(k, e.ADD_FORBID_CONTENTS, b)), Ue && (E["#text"] = !0), j && s(E, ["html", "head", "body"]), E.table && (s(E, ["tbody"]), delete ie.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
258
|
-
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
259
|
-
throw pe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
260
|
-
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
261
|
-
throw pe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
262
|
-
v = e.TRUSTED_TYPES_POLICY, ae = v.createHTML("");
|
|
263
|
-
} else
|
|
264
|
-
v === void 0 && (v = Fn(Te, c)), v !== null && typeof ae == "string" && (ae = v.createHTML(""));
|
|
265
|
-
L && L(e), Z = e;
|
|
266
|
-
}
|
|
267
|
-
}, bt = s({}, [...Xe, ...Ke, ...Rn]), Et = s({}, [...Ze, ...Dn]), fn = function(e) {
|
|
268
|
-
let r = be(e);
|
|
269
|
-
(!r || !r.tagName) && (r = {
|
|
270
|
-
namespaceURI: K,
|
|
271
|
-
tagName: "template"
|
|
272
|
-
});
|
|
273
|
-
const a = Ce(e.tagName), p = Ce(r.tagName);
|
|
274
|
-
return Be[e.namespaceURI] ? e.namespaceURI === Se ? r.namespaceURI === U ? a === "svg" : r.namespaceURI === ve ? a === "svg" && (p === "annotation-xml" || xe[p]) : !!bt[a] : e.namespaceURI === ve ? r.namespaceURI === U ? a === "math" : r.namespaceURI === Se ? a === "math" && Le[p] : !!Et[a] : e.namespaceURI === U ? r.namespaceURI === Se && !Le[p] || r.namespaceURI === ve && !xe[p] ? !1 : !Et[a] && (un[a] || !bt[a]) : !!(se === "application/xhtml+xml" && Be[e.namespaceURI]) : !1;
|
|
275
|
-
}, P = function(e) {
|
|
276
|
-
ce(t.removed, {
|
|
277
|
-
element: e
|
|
278
|
-
});
|
|
279
|
-
try {
|
|
280
|
-
be(e).removeChild(e);
|
|
281
|
-
} catch (r) {
|
|
282
|
-
Kt(e);
|
|
283
|
-
}
|
|
284
|
-
}, Y = function(e, r) {
|
|
285
|
-
try {
|
|
286
|
-
ce(t.removed, {
|
|
287
|
-
attribute: r.getAttributeNode(e),
|
|
288
|
-
from: r
|
|
289
|
-
});
|
|
290
|
-
} catch (a) {
|
|
291
|
-
ce(t.removed, {
|
|
292
|
-
attribute: null,
|
|
293
|
-
from: r
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
if (r.removeAttribute(e), e === "is")
|
|
297
|
-
if (q || _e)
|
|
298
|
-
try {
|
|
299
|
-
P(r);
|
|
300
|
-
} catch (a) {
|
|
301
|
-
}
|
|
302
|
-
else
|
|
303
|
-
try {
|
|
304
|
-
r.setAttribute(e, "");
|
|
305
|
-
} catch (a) {
|
|
306
|
-
}
|
|
307
|
-
}, At = function(e) {
|
|
308
|
-
let r = null, a = null;
|
|
309
|
-
if (Fe)
|
|
310
|
-
e = "<remove></remove>" + e;
|
|
311
|
-
else {
|
|
312
|
-
const g = qe(e, /^[\r\n\t ]+/);
|
|
313
|
-
a = g && g[0];
|
|
314
|
-
}
|
|
315
|
-
se === "application/xhtml+xml" && K === U && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
|
|
316
|
-
const p = v ? v.createHTML(e) : e;
|
|
317
|
-
if (K === U)
|
|
318
|
-
try {
|
|
319
|
-
r = new Oe().parseFromString(p, se);
|
|
320
|
-
} catch (g) {
|
|
321
|
-
}
|
|
322
|
-
if (!r || !r.documentElement) {
|
|
323
|
-
r = Ne.createDocument(K, "template", null);
|
|
324
|
-
try {
|
|
325
|
-
r.documentElement.innerHTML = We ? ae : p;
|
|
326
|
-
} catch (g) {
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
const y = r.body || r.documentElement;
|
|
330
|
-
return e && a && y.insertBefore(o.createTextNode(a), y.childNodes[0] || null), K === U ? tn.call(r, j ? "html" : "body")[0] : j ? r.documentElement : y;
|
|
331
|
-
}, _t = function(e) {
|
|
332
|
-
return Jt.call(
|
|
333
|
-
e.ownerDocument || e,
|
|
334
|
-
e,
|
|
335
|
-
// eslint-disable-next-line no-bitwise
|
|
336
|
-
f.SHOW_ELEMENT | f.SHOW_COMMENT | f.SHOW_TEXT | f.SHOW_PROCESSING_INSTRUCTION | f.SHOW_CDATA_SECTION,
|
|
337
|
-
null
|
|
338
|
-
);
|
|
339
|
-
}, je = function(e) {
|
|
340
|
-
return e instanceof V && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof I) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
|
|
341
|
-
}, yt = function(e) {
|
|
342
|
-
return typeof O == "function" && e instanceof O;
|
|
343
|
-
};
|
|
344
|
-
function z(l, e, r) {
|
|
345
|
-
Re(l, (a) => {
|
|
346
|
-
a.call(t, e, r, Z);
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
const vt = function(e) {
|
|
350
|
-
let r = null;
|
|
351
|
-
if (z(S.beforeSanitizeElements, e, null), je(e))
|
|
352
|
-
return P(e), !0;
|
|
353
|
-
const a = b(e.nodeName);
|
|
354
|
-
if (z(S.uponSanitizeElement, e, {
|
|
355
|
-
tagName: a,
|
|
356
|
-
allowedTags: E
|
|
357
|
-
}), Ae && e.hasChildNodes() && !yt(e.firstElementChild) && x(/<[/\w!]/g, e.innerHTML) && x(/<[/\w!]/g, e.textContent) || e.nodeType === me.progressingInstruction || Ae && e.nodeType === me.comment && x(/<[/\w]/g, e.data))
|
|
358
|
-
return P(e), !0;
|
|
359
|
-
if (!(B.tagCheck instanceof Function && B.tagCheck(a)) && (!E[a] || ie[a])) {
|
|
360
|
-
if (!ie[a] && xt(a) && (m.tagNameCheck instanceof RegExp && x(m.tagNameCheck, a) || m.tagNameCheck instanceof Function && m.tagNameCheck(a)))
|
|
361
|
-
return !1;
|
|
362
|
-
if (Ue && !k[a]) {
|
|
363
|
-
const p = be(e) || e.parentNode, y = Qt(e) || e.childNodes;
|
|
364
|
-
if (y && p) {
|
|
365
|
-
const g = y.length;
|
|
366
|
-
for (let D = g - 1; D >= 0; --D) {
|
|
367
|
-
const G = Xt(y[D], !0);
|
|
368
|
-
G.__removalCount = (e.__removalCount || 0) + 1, p.insertBefore(G, Zt(e));
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
return P(e), !0;
|
|
373
|
-
}
|
|
374
|
-
return e instanceof d && !fn(e) || (a === "noscript" || a === "noembed" || a === "noframes") && x(/<\/no(script|embed|frames)/i, e.innerHTML) ? (P(e), !0) : ($ && e.nodeType === me.text && (r = e.textContent, Re([Me, Ie, ke], (p) => {
|
|
375
|
-
r = ue(r, p, " ");
|
|
376
|
-
}), e.textContent !== r && (ce(t.removed, {
|
|
377
|
-
element: e.cloneNode()
|
|
378
|
-
}), e.textContent = r)), z(S.afterSanitizeElements, e, null), !1);
|
|
379
|
-
}, St = function(e, r, a) {
|
|
380
|
-
if (Ee[r] || dt && (r === "id" || r === "name") && (a in o || a in mn))
|
|
381
|
-
return !1;
|
|
382
|
-
if (!(Pe && !Ee[r] && x(rn, r))) {
|
|
383
|
-
if (!(ct && x(on, r))) {
|
|
384
|
-
if (!(B.attributeCheck instanceof Function && B.attributeCheck(r, e))) {
|
|
385
|
-
if (!A[r] || Ee[r]) {
|
|
386
|
-
if (
|
|
387
|
-
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
388
|
-
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
389
|
-
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
390
|
-
!(xt(e) && (m.tagNameCheck instanceof RegExp && x(m.tagNameCheck, e) || m.tagNameCheck instanceof Function && m.tagNameCheck(e)) && (m.attributeNameCheck instanceof RegExp && x(m.attributeNameCheck, r) || m.attributeNameCheck instanceof Function && m.attributeNameCheck(r, e)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
391
|
-
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
392
|
-
r === "is" && m.allowCustomizedBuiltInElements && (m.tagNameCheck instanceof RegExp && x(m.tagNameCheck, a) || m.tagNameCheck instanceof Function && m.tagNameCheck(a)))
|
|
393
|
-
) return !1;
|
|
394
|
-
} else if (!Ge[r]) {
|
|
395
|
-
if (!x(it, ue(a, at, ""))) {
|
|
396
|
-
if (!((r === "src" || r === "xlink:href" || r === "href") && e !== "script" && vn(a, "data:") === 0 && ft[e])) {
|
|
397
|
-
if (!(ut && !x(an, ue(a, at, "")))) {
|
|
398
|
-
if (a)
|
|
399
|
-
return !1;
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
return !0;
|
|
408
|
-
}, xt = function(e) {
|
|
409
|
-
return e !== "annotation-xml" && qe(e, ln);
|
|
410
|
-
}, Lt = function(e) {
|
|
411
|
-
z(S.beforeSanitizeAttributes, e, null);
|
|
412
|
-
const {
|
|
413
|
-
attributes: r
|
|
414
|
-
} = e;
|
|
415
|
-
if (!r || je(e))
|
|
416
|
-
return;
|
|
417
|
-
const a = {
|
|
418
|
-
attrName: "",
|
|
419
|
-
attrValue: "",
|
|
420
|
-
keepAttr: !0,
|
|
421
|
-
allowedAttributes: A,
|
|
422
|
-
forceKeepAttr: void 0
|
|
423
|
-
};
|
|
424
|
-
let p = r.length;
|
|
425
|
-
for (; p--; ) {
|
|
426
|
-
const y = r[p], {
|
|
427
|
-
name: g,
|
|
428
|
-
namespaceURI: D,
|
|
429
|
-
value: G
|
|
430
|
-
} = y, Q = b(g), Ye = G;
|
|
431
|
-
let _ = g === "value" ? Ye : Sn(Ye);
|
|
432
|
-
if (a.attrName = Q, a.attrValue = _, a.keepAttr = !0, a.forceKeepAttr = void 0, z(S.uponSanitizeAttribute, e, a), _ = a.attrValue, mt && (Q === "id" || Q === "name") && (Y(g, e), _ = sn + _), Ae && x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, _)) {
|
|
433
|
-
Y(g, e);
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
if (Q === "attributename" && qe(_, "href")) {
|
|
437
|
-
Y(g, e);
|
|
438
|
-
continue;
|
|
439
|
-
}
|
|
440
|
-
if (a.forceKeepAttr)
|
|
441
|
-
continue;
|
|
442
|
-
if (!a.keepAttr) {
|
|
443
|
-
Y(g, e);
|
|
444
|
-
continue;
|
|
445
|
-
}
|
|
446
|
-
if (!pt && x(/\/>/i, _)) {
|
|
447
|
-
Y(g, e);
|
|
448
|
-
continue;
|
|
449
|
-
}
|
|
450
|
-
$ && Re([Me, Ie, ke], (Dt) => {
|
|
451
|
-
_ = ue(_, Dt, " ");
|
|
452
|
-
});
|
|
453
|
-
const Rt = b(e.nodeName);
|
|
454
|
-
if (!St(Rt, Q, _)) {
|
|
455
|
-
Y(g, e);
|
|
456
|
-
continue;
|
|
457
|
-
}
|
|
458
|
-
if (v && typeof Te == "object" && typeof Te.getAttributeType == "function" && !D)
|
|
459
|
-
switch (Te.getAttributeType(Rt, Q)) {
|
|
460
|
-
case "TrustedHTML": {
|
|
461
|
-
_ = v.createHTML(_);
|
|
462
|
-
break;
|
|
463
|
-
}
|
|
464
|
-
case "TrustedScriptURL": {
|
|
465
|
-
_ = v.createScriptURL(_);
|
|
466
|
-
break;
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
if (_ !== Ye)
|
|
470
|
-
try {
|
|
471
|
-
D ? e.setAttributeNS(D, g, _) : e.setAttribute(g, _), je(e) ? P(e) : Ct(t.removed);
|
|
472
|
-
} catch (Dt) {
|
|
473
|
-
Y(g, e);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
z(S.afterSanitizeAttributes, e, null);
|
|
477
|
-
}, gn = function l(e) {
|
|
478
|
-
let r = null;
|
|
479
|
-
const a = _t(e);
|
|
480
|
-
for (z(S.beforeSanitizeShadowDOM, e, null); r = a.nextNode(); )
|
|
481
|
-
z(S.uponSanitizeShadowNode, r, null), vt(r), Lt(r), r.content instanceof u && l(r.content);
|
|
482
|
-
z(S.afterSanitizeShadowDOM, e, null);
|
|
483
|
-
};
|
|
484
|
-
return t.sanitize = function(l) {
|
|
485
|
-
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = null, a = null, p = null, y = null;
|
|
486
|
-
if (We = !l, We && (l = "<!-->"), typeof l != "string" && !yt(l))
|
|
487
|
-
if (typeof l.toString == "function") {
|
|
488
|
-
if (l = l.toString(), typeof l != "string")
|
|
489
|
-
throw pe("dirty is not a string, aborting");
|
|
490
|
-
} else
|
|
491
|
-
throw pe("toString is not a function");
|
|
492
|
-
if (!t.isSupported)
|
|
493
|
-
return l;
|
|
494
|
-
if (He || Ve(e), t.removed = [], typeof l == "string" && (le = !1), le) {
|
|
495
|
-
if (l.nodeName) {
|
|
496
|
-
const G = b(l.nodeName);
|
|
497
|
-
if (!E[G] || ie[G])
|
|
498
|
-
throw pe("root node is forbidden and cannot be sanitized in-place");
|
|
499
|
-
}
|
|
500
|
-
} else if (l instanceof O)
|
|
501
|
-
r = At("<!---->"), a = r.ownerDocument.importNode(l, !0), a.nodeType === me.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? r = a : r.appendChild(a);
|
|
502
|
-
else {
|
|
503
|
-
if (!q && !$ && !j && // eslint-disable-next-line unicorn/prefer-includes
|
|
504
|
-
l.indexOf("<") === -1)
|
|
505
|
-
return v && ye ? v.createHTML(l) : l;
|
|
506
|
-
if (r = At(l), !r)
|
|
507
|
-
return q ? null : ye ? ae : "";
|
|
508
|
-
}
|
|
509
|
-
r && Fe && P(r.firstChild);
|
|
510
|
-
const g = _t(le ? l : r);
|
|
511
|
-
for (; p = g.nextNode(); )
|
|
512
|
-
vt(p), Lt(p), p.content instanceof u && gn(p.content);
|
|
513
|
-
if (le)
|
|
514
|
-
return l;
|
|
515
|
-
if (q) {
|
|
516
|
-
if (_e)
|
|
517
|
-
for (y = en.call(r.ownerDocument); r.firstChild; )
|
|
518
|
-
y.appendChild(r.firstChild);
|
|
519
|
-
else
|
|
520
|
-
y = r;
|
|
521
|
-
return (A.shadowroot || A.shadowrootmode) && (y = nn.call(i, y, !0)), y;
|
|
522
|
-
}
|
|
523
|
-
let D = j ? r.outerHTML : r.innerHTML;
|
|
524
|
-
return j && E["!doctype"] && r.ownerDocument && r.ownerDocument.doctype && r.ownerDocument.doctype.name && x(Gt, r.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + r.ownerDocument.doctype.name + `>
|
|
525
|
-
` + D), $ && Re([Me, Ie, ke], (G) => {
|
|
526
|
-
D = ue(D, G, " ");
|
|
527
|
-
}), v && ye ? v.createHTML(D) : D;
|
|
528
|
-
}, t.setConfig = function() {
|
|
529
|
-
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
530
|
-
Ve(l), He = !0;
|
|
531
|
-
}, t.clearConfig = function() {
|
|
532
|
-
Z = null, He = !1;
|
|
533
|
-
}, t.isValidAttribute = function(l, e, r) {
|
|
534
|
-
Z || Ve({});
|
|
535
|
-
const a = b(l), p = b(e);
|
|
536
|
-
return St(a, p, r);
|
|
537
|
-
}, t.addHook = function(l, e) {
|
|
538
|
-
typeof e == "function" && ce(S[l], e);
|
|
539
|
-
}, t.removeHook = function(l, e) {
|
|
540
|
-
if (e !== void 0) {
|
|
541
|
-
const r = _n(S[l], e);
|
|
542
|
-
return r === -1 ? void 0 : yn(S[l], r, 1)[0];
|
|
543
|
-
}
|
|
544
|
-
return Ct(S[l]);
|
|
545
|
-
}, t.removeHooks = function(l) {
|
|
546
|
-
S[l] = [];
|
|
547
|
-
}, t.removeAllHooks = function() {
|
|
548
|
-
S = Pt();
|
|
549
|
-
}, t;
|
|
550
|
-
}
|
|
551
|
-
var Un = Wt();
|
|
552
|
-
let h = null, N = null, ee = null, T = null, te = "", ne = "", fe = "insert", ge = null, F = null, J = null;
|
|
553
|
-
function Bt(n, t) {
|
|
554
|
-
if (t === n.innerHTML) return;
|
|
555
|
-
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
556
|
-
if (typeof o == "function")
|
|
557
|
-
try {
|
|
558
|
-
o("recordDomTransaction", n, t, n.innerHTML);
|
|
559
|
-
} catch (i) {
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
function zn(n) {
|
|
563
|
-
if (!n) return null;
|
|
564
|
-
let t = n.startContainer;
|
|
565
|
-
for (; t && t !== document.body; ) {
|
|
566
|
-
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
567
|
-
const o = t;
|
|
568
|
-
if (o.getAttribute("contenteditable") === "true")
|
|
569
|
-
return o;
|
|
570
|
-
}
|
|
571
|
-
t = t.parentNode;
|
|
572
|
-
}
|
|
573
|
-
return null;
|
|
574
|
-
}
|
|
575
|
-
const Gn = [
|
|
576
|
-
{
|
|
577
|
-
id: "formal-letter",
|
|
578
|
-
name: "Formal Letter",
|
|
579
|
-
category: "Letters",
|
|
580
|
-
description: "Professional business letter template",
|
|
581
|
-
html: `<p><strong>{{ Company Name }}</strong></p>
|
|
582
|
-
<p>{{ Today }}</p>
|
|
583
|
-
<p>Dear {{ first_name }} {{ last_name }},</p>
|
|
584
|
-
<p>I hope this letter finds you well. [Your letter content here]</p>
|
|
585
|
-
<p>Thank you for your time and consideration.</p>
|
|
586
|
-
<p>Sincerely,<br>Your Name</p>`
|
|
587
|
-
},
|
|
588
|
-
{
|
|
589
|
-
id: "meeting-notes",
|
|
590
|
-
name: "Meeting Notes",
|
|
591
|
-
category: "Notes",
|
|
592
|
-
description: "Template for meeting notes with attendees and action items",
|
|
593
|
-
html: `<h2>Meeting Notes - {{ today }}</h2>
|
|
594
|
-
<p><strong>Attendees:</strong> [List attendees]</p>
|
|
595
|
-
<p><strong>Agenda:</strong></p>
|
|
596
|
-
<ul>
|
|
597
|
-
<li>[Item 1]</li>
|
|
598
|
-
<li>[Item 2]</li>
|
|
599
|
-
<li>[Item 3]</li>
|
|
600
|
-
</ul>
|
|
601
|
-
<p><strong>Action Items:</strong></p>
|
|
602
|
-
<ul>
|
|
603
|
-
<li>[Owner]: [Task] - [Due Date]</li>
|
|
604
|
-
</ul>
|
|
605
|
-
<p><strong>Next Meeting:</strong> [Date]</p>`
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
id: "proposal",
|
|
609
|
-
name: "Project Proposal",
|
|
610
|
-
category: "Business",
|
|
611
|
-
description: "Structured project proposal template",
|
|
612
|
-
html: `<h1>Project Proposal</h1>
|
|
613
|
-
<h2>Executive Summary</h2>
|
|
614
|
-
<p>[Summary of the proposal]</p>
|
|
615
|
-
<h2>Objectives</h2>
|
|
616
|
-
<ul>
|
|
617
|
-
<li>[Objective 1]</li>
|
|
618
|
-
<li>[Objective 2]</li>
|
|
619
|
-
</ul>
|
|
620
|
-
<h2>Scope</h2>
|
|
621
|
-
<p>[Project scope details]</p>
|
|
622
|
-
<h2>Timeline</h2>
|
|
623
|
-
<p>[Project timeline]</p>
|
|
624
|
-
<h2>Budget</h2>
|
|
625
|
-
<p>[Budget details]</p>
|
|
626
|
-
<h2>Contact</h2>
|
|
627
|
-
<p>{{ first_name }} {{ last_name }}<br>{{ email }}<br>{{ phone }}</p>`
|
|
628
|
-
},
|
|
629
|
-
{
|
|
630
|
-
id: "faq",
|
|
631
|
-
name: "FAQ Template",
|
|
632
|
-
category: "Documentation",
|
|
633
|
-
description: "FAQ document structure",
|
|
634
|
-
html: `<h1>Frequently Asked Questions</h1>
|
|
635
|
-
<h2>General Questions</h2>
|
|
636
|
-
<h3>Q: What is this about?</h3>
|
|
637
|
-
<p>A: [Answer here]</p>
|
|
638
|
-
<h3>Q: Who should use this?</h3>
|
|
639
|
-
<p>A: [Answer here]</p>
|
|
640
|
-
<h2>Technical Questions</h2>
|
|
641
|
-
<h3>Q: How do I get started?</h3>
|
|
642
|
-
<p>A: [Answer here]</p>
|
|
643
|
-
<h3>Q: What are the requirements?</h3>
|
|
644
|
-
<p>A: [Answer here]</p>`
|
|
645
|
-
}
|
|
646
|
-
], re = [...Gn], Vt = () => re, nr = (n) => re.filter((t) => t.category === n), jt = () => {
|
|
647
|
-
const n = new Set(re.map((t) => t.category));
|
|
648
|
-
return Array.from(n);
|
|
649
|
-
}, Wn = (n) => {
|
|
650
|
-
const t = n.toLowerCase();
|
|
651
|
-
return re.filter(
|
|
652
|
-
(o) => {
|
|
653
|
-
var i, c;
|
|
654
|
-
return o.name.toLowerCase().includes(t) || ((i = o.description) == null ? void 0 : i.toLowerCase().includes(t)) || ((c = o.tags) == null ? void 0 : c.some((u) => u.toLowerCase().includes(t)));
|
|
655
|
-
}
|
|
656
|
-
);
|
|
657
|
-
}, Yt = (n) => Un.sanitize(n, {
|
|
658
|
-
ALLOWED_TAGS: ["p", "br", "strong", "em", "u", "h1", "h2", "h3", "h4", "ul", "ol", "li", "blockquote", "table", "thead", "tbody", "tr", "th", "td", "a", "span"],
|
|
659
|
-
ALLOWED_ATTR: ["href", "target", "class", "data-key", "data-category"]
|
|
660
|
-
}), rr = (n) => re.some((t) => t.id === n.id) ? (console.warn(`Template with ID ${n.id} already exists`), !1) : (re.push(n), !0), or = (n) => !!(n.id && n.name && n.category && n.html && n.html.trim().length > 0);
|
|
661
|
-
function Bn(n) {
|
|
662
|
-
N && W(), N = document.createElement("div"), Tn(N), N.className = "rte-dialog-overlay", Yn(n) && N.classList.add("rte-ui-theme-dark"), N.addEventListener("click", () => W()), h = document.createElement("div"), h.className = "rte-dialog rte-template-dialog", h.addEventListener("click", (o) => o.stopPropagation());
|
|
663
|
-
const t = jt();
|
|
664
|
-
t.length > 0 && !te && (te = t[0]), he(), N.appendChild(h), document.body.appendChild(N), Vn(), Jn();
|
|
665
|
-
}
|
|
666
|
-
function Vn() {
|
|
667
|
-
$t(), ge = (n) => {
|
|
668
|
-
n.key === "Escape" && (!N || !h || (n.preventDefault(), n.stopPropagation(), W()));
|
|
669
|
-
}, document.addEventListener("keydown", ge, !0);
|
|
670
|
-
}
|
|
671
|
-
function $t() {
|
|
672
|
-
ge && (document.removeEventListener("keydown", ge, !0), ge = null);
|
|
673
|
-
}
|
|
674
|
-
const jn = '[data-theme="dark"], .dark, .editora-theme-dark', nt = () => {
|
|
675
|
-
const n = window.getSelection();
|
|
676
|
-
if (!n || n.rangeCount === 0) return null;
|
|
677
|
-
const t = n.anchorNode, o = t instanceof HTMLElement ? t : t == null ? void 0 : t.parentElement;
|
|
678
|
-
return (o == null ? void 0 : o.closest(
|
|
679
|
-
".rte-content, .editora-content"
|
|
680
|
-
)) || null;
|
|
681
|
-
}, Yn = (n) => {
|
|
682
|
-
const t = n || nt();
|
|
683
|
-
return t ? !!t.closest(jn) : !1;
|
|
684
|
-
};
|
|
685
|
-
function rt() {
|
|
686
|
-
const n = zn(ee);
|
|
687
|
-
if (n) return n;
|
|
688
|
-
if (J != null && J.isConnected) return J;
|
|
689
|
-
const t = nt();
|
|
690
|
-
return t || document.querySelector(".rte-content, .editora-content");
|
|
691
|
-
}
|
|
692
|
-
function he() {
|
|
693
|
-
if (!h) return;
|
|
694
|
-
const n = jt(), t = ot();
|
|
695
|
-
h.innerHTML = `
|
|
696
|
-
<div class="rte-dialog-header">
|
|
697
|
-
<h2>Insert Template</h2>
|
|
698
|
-
<button class="rte-dialog-close" aria-label="Close">✕</button>
|
|
699
|
-
</div>
|
|
700
|
-
|
|
701
|
-
<div class="rte-dialog-body">
|
|
702
|
-
<!-- Search -->
|
|
703
|
-
<input
|
|
704
|
-
type="text"
|
|
705
|
-
placeholder="Search templates..."
|
|
706
|
-
value="${hn(ne)}"
|
|
707
|
-
class="rte-input rte-template-search"
|
|
708
|
-
aria-label="Search templates"
|
|
709
|
-
/>
|
|
710
|
-
|
|
711
|
-
<!-- Category Tabs -->
|
|
712
|
-
<div class="rte-tabs">
|
|
713
|
-
${n.map((o) => `
|
|
714
|
-
<button class="rte-tab ${te === o ? "active" : ""}" data-category="${o}">
|
|
715
|
-
${o}
|
|
716
|
-
</button>
|
|
717
|
-
`).join("")}
|
|
718
|
-
</div>
|
|
719
|
-
|
|
720
|
-
<!-- Template List -->
|
|
721
|
-
<div class="rte-template-list">
|
|
722
|
-
${t.length > 0 ? t.map((o) => `
|
|
723
|
-
<div
|
|
724
|
-
class="rte-template-item ${(T == null ? void 0 : T.id) === o.id ? "selected" : ""}"
|
|
725
|
-
data-template-id="${o.id}"
|
|
726
|
-
>
|
|
727
|
-
<div class="template-name">${o.name}</div>
|
|
728
|
-
${o.description ? `<div class="template-description">${o.description}</div>` : ""}
|
|
729
|
-
</div>
|
|
730
|
-
`).join("") : '<div class="rte-empty-state">No templates found</div>'}
|
|
731
|
-
</div>
|
|
732
|
-
|
|
733
|
-
<!-- Preview -->
|
|
734
|
-
${T ? `
|
|
735
|
-
<div class="rte-template-preview">
|
|
736
|
-
<strong>Preview:</strong>
|
|
737
|
-
<div class="template-preview-content">${T.html}</div>
|
|
738
|
-
</div>
|
|
739
|
-
` : ""}
|
|
740
|
-
|
|
741
|
-
<!-- Insert Mode Toggle -->
|
|
742
|
-
<div class="rte-insert-mode">
|
|
743
|
-
<label>
|
|
744
|
-
<input type="radio" name="insertMode" value="insert" ${fe === "insert" ? "checked" : ""} />
|
|
745
|
-
Insert at cursor
|
|
746
|
-
</label>
|
|
747
|
-
<label>
|
|
748
|
-
<input type="radio" name="insertMode" value="replace" ${fe === "replace" ? "checked" : ""} />
|
|
749
|
-
Replace document
|
|
750
|
-
</label>
|
|
751
|
-
</div>
|
|
752
|
-
</div>
|
|
753
|
-
|
|
754
|
-
<div class="rte-dialog-footer">
|
|
755
|
-
<button class="rte-button-secondary rte-cancel-btn">Cancel</button>
|
|
756
|
-
<button class="rte-button-primary rte-insert-btn" ${T ? "" : "disabled"}>
|
|
757
|
-
${fe === "insert" ? "Insert" : "Replace"}
|
|
758
|
-
</button>
|
|
759
|
-
</div>
|
|
760
|
-
`, qn();
|
|
761
|
-
}
|
|
762
|
-
function $n() {
|
|
763
|
-
if (!h) return;
|
|
764
|
-
h.innerHTML = `
|
|
765
|
-
<div class="rte-dialog-header">
|
|
766
|
-
<h2>Replace Document?</h2>
|
|
767
|
-
</div>
|
|
768
|
-
<div class="rte-dialog-body">
|
|
769
|
-
<p>This will replace your current document content. Continue?</p>
|
|
770
|
-
</div>
|
|
771
|
-
<div class="rte-dialog-footer">
|
|
772
|
-
<button class="rte-button-secondary rte-cancel-warning-btn">Cancel</button>
|
|
773
|
-
<button class="rte-button-primary rte-confirm-replace-btn">Replace</button>
|
|
774
|
-
</div>
|
|
775
|
-
`;
|
|
776
|
-
const n = h.querySelector(".rte-cancel-warning-btn"), t = h.querySelector(".rte-confirm-replace-btn");
|
|
777
|
-
n == null || n.addEventListener("click", () => he()), t == null || t.addEventListener("click", () => Xn());
|
|
778
|
-
}
|
|
779
|
-
function ot() {
|
|
780
|
-
const n = Vt();
|
|
781
|
-
return ne.trim() ? Wn(ne) : te ? n.filter((t) => t.category === te) : n;
|
|
782
|
-
}
|
|
783
|
-
function qn() {
|
|
784
|
-
if (!h) return;
|
|
785
|
-
const n = h.querySelector(".rte-dialog-close");
|
|
786
|
-
n == null || n.addEventListener("click", () => W());
|
|
787
|
-
const t = h.querySelector(".rte-cancel-btn");
|
|
788
|
-
t == null || t.addEventListener("click", () => W());
|
|
789
|
-
const o = h.querySelector(".rte-insert-btn");
|
|
790
|
-
o == null || o.addEventListener("click", () => Je());
|
|
791
|
-
const i = h.querySelector(".rte-template-search");
|
|
792
|
-
i == null || i.addEventListener("input", (d) => {
|
|
793
|
-
F !== null && cancelAnimationFrame(F), ne = d.target.value, F = requestAnimationFrame(() => {
|
|
794
|
-
F = null, Ht();
|
|
795
|
-
});
|
|
796
|
-
}), i == null || i.addEventListener("keydown", (d) => {
|
|
797
|
-
d.key === "Enter" && T ? Je() : d.key === "Escape" && W();
|
|
798
|
-
});
|
|
799
|
-
const c = h.querySelector(".rte-tabs");
|
|
800
|
-
c == null || c.addEventListener("click", (d) => {
|
|
801
|
-
const I = d.target.closest(".rte-tab");
|
|
802
|
-
if (!I) return;
|
|
803
|
-
const V = I.getAttribute("data-category");
|
|
804
|
-
V && (te = V, ne = "", F !== null && (cancelAnimationFrame(F), F = null), Ht());
|
|
805
|
-
});
|
|
806
|
-
const u = h.querySelector(".rte-template-list"), C = (d) => {
|
|
807
|
-
const I = d.target.closest(".rte-template-item");
|
|
808
|
-
if (!I) return null;
|
|
809
|
-
const V = I.getAttribute("data-template-id");
|
|
810
|
-
return V && Vt().find((Oe) => Oe.id === V) || null;
|
|
811
|
-
};
|
|
812
|
-
u == null || u.addEventListener("click", (d) => {
|
|
813
|
-
const f = C(d);
|
|
814
|
-
f && (T = f, he());
|
|
815
|
-
}), u == null || u.addEventListener("dblclick", (d) => {
|
|
816
|
-
const f = C(d);
|
|
817
|
-
f && (T = f, Je());
|
|
818
|
-
});
|
|
819
|
-
const O = h.querySelector(".rte-insert-mode");
|
|
820
|
-
O == null || O.addEventListener("change", (d) => {
|
|
821
|
-
const f = d.target;
|
|
822
|
-
!f || f.name !== "insertMode" || (fe = f.value, he());
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
function Ht() {
|
|
826
|
-
const n = ot();
|
|
827
|
-
n.length > 0 ? (!T || !n.find((t) => t.id === T.id)) && (T = n[0]) : T = null, he();
|
|
828
|
-
}
|
|
829
|
-
function Je() {
|
|
830
|
-
var n;
|
|
831
|
-
if (T)
|
|
832
|
-
if (fe === "replace") {
|
|
833
|
-
const t = rt();
|
|
834
|
-
if ((n = t == null ? void 0 : t.innerHTML) != null && n.trim()) {
|
|
835
|
-
$n();
|
|
836
|
-
return;
|
|
837
|
-
}
|
|
838
|
-
qt(T), W();
|
|
839
|
-
} else
|
|
840
|
-
Zn(T), W();
|
|
841
|
-
}
|
|
842
|
-
function Xn() {
|
|
843
|
-
T && (qt(T), W());
|
|
844
|
-
}
|
|
845
|
-
const Kn = /* @__PURE__ */ new Set([
|
|
846
|
-
"DIV",
|
|
847
|
-
"P",
|
|
848
|
-
"BLOCKQUOTE",
|
|
849
|
-
"PRE",
|
|
850
|
-
"H1",
|
|
851
|
-
"H2",
|
|
852
|
-
"H3",
|
|
853
|
-
"H4",
|
|
854
|
-
"H5",
|
|
855
|
-
"H6",
|
|
856
|
-
"LI",
|
|
857
|
-
"TD",
|
|
858
|
-
"TH"
|
|
859
|
-
]);
|
|
860
|
-
function Ft(n, t) {
|
|
861
|
-
let o = n;
|
|
862
|
-
for (; o && o !== t; ) {
|
|
863
|
-
if (o.nodeType === Node.ELEMENT_NODE && Kn.has(o.tagName))
|
|
864
|
-
return o;
|
|
865
|
-
o = o.parentNode;
|
|
866
|
-
}
|
|
867
|
-
return null;
|
|
868
|
-
}
|
|
869
|
-
function Zn(n) {
|
|
870
|
-
var f;
|
|
871
|
-
const t = window.getSelection();
|
|
872
|
-
if (!t) return;
|
|
873
|
-
const o = rt();
|
|
874
|
-
if (!o) return;
|
|
875
|
-
if (ee)
|
|
876
|
-
t.removeAllRanges(), t.addRange(ee);
|
|
877
|
-
else {
|
|
878
|
-
const I = document.createRange();
|
|
879
|
-
I.selectNodeContents(o), I.collapse(!1), t.removeAllRanges(), t.addRange(I);
|
|
880
|
-
}
|
|
881
|
-
if (t.rangeCount === 0) return;
|
|
882
|
-
const i = t.getRangeAt(0), c = (f = o == null ? void 0 : o.innerHTML) != null ? f : "", u = document.createRange().createContextualFragment(Yt(n.html));
|
|
883
|
-
i.deleteContents();
|
|
884
|
-
const C = u.lastChild, O = Ft(i.endContainer, o) || Ft(i.startContainer, o);
|
|
885
|
-
O && O.parentNode ? O.parentNode.insertBefore(u, O.nextSibling) : i.insertNode(u);
|
|
886
|
-
const d = document.createRange();
|
|
887
|
-
C ? d.setStartAfter(C) : d.setStartAfter(i.endContainer), d.collapse(!0), t.removeAllRanges(), t.addRange(d), o && (Bt(o, c), o.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
888
|
-
}
|
|
889
|
-
function qt(n) {
|
|
890
|
-
const t = rt();
|
|
891
|
-
if (t) {
|
|
892
|
-
const o = t.innerHTML;
|
|
893
|
-
t.innerHTML = Yt(n.html), Bt(t, o), t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
function W() {
|
|
897
|
-
$t(), F !== null && (cancelAnimationFrame(F), F = null), N && (N.remove(), N = null), h = null, ee = null, ne = "", J = null;
|
|
898
|
-
}
|
|
899
|
-
function Qn(n) {
|
|
900
|
-
const t = window.getSelection();
|
|
901
|
-
t && t.rangeCount > 0 ? ee = t.getRangeAt(0).cloneRange() : ee = null;
|
|
902
|
-
const o = ot();
|
|
903
|
-
o.length > 0 && !T && (T = o[0]);
|
|
904
|
-
const i = (n == null ? void 0 : n.contentElement) instanceof HTMLElement ? n.contentElement : nt();
|
|
905
|
-
J = i || null, Bn(i);
|
|
906
|
-
}
|
|
907
|
-
function Jn() {
|
|
908
|
-
if (typeof document == "undefined") return;
|
|
909
|
-
const n = "template-plugin-dialog-styles";
|
|
910
|
-
if (document.getElementById(n)) return;
|
|
911
|
-
const t = document.createElement("style");
|
|
912
|
-
t.id = n, t.textContent = `
|
|
913
|
-
.rte-dialog-overlay {
|
|
914
|
-
--rte-tmpl-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
915
|
-
--rte-tmpl-dialog-bg: #fff;
|
|
916
|
-
--rte-tmpl-dialog-text: #101828;
|
|
917
|
-
--rte-tmpl-border: #d6dbe4;
|
|
918
|
-
--rte-tmpl-subtle-bg: #f7f9fc;
|
|
919
|
-
--rte-tmpl-subtle-hover: #eef2f7;
|
|
920
|
-
--rte-tmpl-muted-text: #5f6b7d;
|
|
921
|
-
--rte-tmpl-accent: #1976d2;
|
|
922
|
-
--rte-tmpl-accent-strong: #1565c0;
|
|
923
|
-
--rte-tmpl-ring: rgba(31, 117, 254, 0.18);
|
|
924
|
-
position: fixed;
|
|
925
|
-
top: 0;
|
|
926
|
-
left: 0;
|
|
927
|
-
right: 0;
|
|
928
|
-
bottom: 0;
|
|
929
|
-
background-color: var(--rte-tmpl-overlay-bg);
|
|
930
|
-
backdrop-filter: blur(2px);
|
|
931
|
-
display: flex;
|
|
932
|
-
align-items: center;
|
|
933
|
-
justify-content: center;
|
|
934
|
-
z-index: 10000;
|
|
935
|
-
padding: 16px;
|
|
936
|
-
box-sizing: border-box;
|
|
937
|
-
}
|
|
938
|
-
.rte-dialog-overlay.rte-ui-theme-dark {
|
|
939
|
-
--rte-tmpl-overlay-bg: rgba(2, 8, 20, 0.72);
|
|
940
|
-
--rte-tmpl-dialog-bg: #202938;
|
|
941
|
-
--rte-tmpl-dialog-text: #e8effc;
|
|
942
|
-
--rte-tmpl-border: #49566c;
|
|
943
|
-
--rte-tmpl-subtle-bg: #2a3444;
|
|
944
|
-
--rte-tmpl-subtle-hover: #344256;
|
|
945
|
-
--rte-tmpl-muted-text: #a5b1c5;
|
|
946
|
-
--rte-tmpl-accent: #58a6ff;
|
|
947
|
-
--rte-tmpl-accent-strong: #4598f4;
|
|
948
|
-
--rte-tmpl-ring: rgba(88, 166, 255, 0.22);
|
|
949
|
-
}
|
|
950
|
-
.rte-template-dialog {
|
|
951
|
-
background: var(--rte-tmpl-dialog-bg);
|
|
952
|
-
color: var(--rte-tmpl-dialog-text);
|
|
953
|
-
border: 1px solid var(--rte-tmpl-border);
|
|
954
|
-
border-radius: 12px;
|
|
955
|
-
box-shadow: 0 24px 48px rgba(10, 15, 24, 0.28);
|
|
956
|
-
width: 600px;
|
|
957
|
-
max-height: 700px;
|
|
958
|
-
display: flex;
|
|
959
|
-
flex-direction: column;
|
|
960
|
-
overflow: hidden;
|
|
961
|
-
}
|
|
962
|
-
.rte-dialog-header {
|
|
963
|
-
display: flex;
|
|
964
|
-
justify-content: space-between;
|
|
965
|
-
align-items: center;
|
|
966
|
-
padding: 16px 20px;
|
|
967
|
-
border-bottom: 1px solid var(--rte-tmpl-border);
|
|
968
|
-
background: linear-gradient(180deg, rgba(127, 154, 195, 0.08) 0%, rgba(127, 154, 195, 0) 100%);
|
|
969
|
-
}
|
|
970
|
-
.rte-dialog-header h2 {
|
|
971
|
-
margin: 0;
|
|
972
|
-
font-size: 18px;
|
|
973
|
-
font-weight: 600;
|
|
974
|
-
color: var(--rte-tmpl-dialog-text);
|
|
975
|
-
}
|
|
976
|
-
.rte-dialog-close {
|
|
977
|
-
background: none;
|
|
978
|
-
border: none;
|
|
979
|
-
font-size: 24px;
|
|
980
|
-
cursor: pointer;
|
|
981
|
-
color: var(--rte-tmpl-muted-text);
|
|
982
|
-
padding: 0;
|
|
983
|
-
width: 32px;
|
|
984
|
-
height: 32px;
|
|
985
|
-
display: flex;
|
|
986
|
-
align-items: center;
|
|
987
|
-
justify-content: center;
|
|
988
|
-
border-radius: 8px;
|
|
989
|
-
transition: background-color 0.16s ease, color 0.16s ease;
|
|
990
|
-
}
|
|
991
|
-
.rte-dialog-close:hover {
|
|
992
|
-
background-color: var(--rte-tmpl-subtle-hover);
|
|
993
|
-
color: var(--rte-tmpl-dialog-text);
|
|
994
|
-
}
|
|
995
|
-
.rte-dialog-body {
|
|
996
|
-
padding: 20px;
|
|
997
|
-
flex: 1;
|
|
998
|
-
overflow-y: auto;
|
|
999
|
-
}
|
|
1000
|
-
.rte-input {
|
|
1001
|
-
width: 100%;
|
|
1002
|
-
padding: 8px 12px;
|
|
1003
|
-
border: 1px solid var(--rte-tmpl-border);
|
|
1004
|
-
border-radius: 4px;
|
|
1005
|
-
font-size: 14px;
|
|
1006
|
-
box-sizing: border-box;
|
|
1007
|
-
background: var(--rte-tmpl-subtle-bg);
|
|
1008
|
-
color: var(--rte-tmpl-dialog-text);
|
|
1009
|
-
}
|
|
1010
|
-
.rte-input:focus {
|
|
1011
|
-
outline: none;
|
|
1012
|
-
border-color: var(--rte-tmpl-accent);
|
|
1013
|
-
}
|
|
1014
|
-
.rte-tabs {
|
|
1015
|
-
display: flex;
|
|
1016
|
-
gap: 8px;
|
|
1017
|
-
margin-top: 12px;
|
|
1018
|
-
border-bottom: 1px solid var(--rte-tmpl-border);
|
|
1019
|
-
padding-bottom: 8px;
|
|
1020
|
-
}
|
|
1021
|
-
.rte-tab {
|
|
1022
|
-
padding: 6px 12px;
|
|
1023
|
-
border: none;
|
|
1024
|
-
background: none;
|
|
1025
|
-
cursor: pointer;
|
|
1026
|
-
font-size: 14px;
|
|
1027
|
-
color: var(--rte-tmpl-muted-text);
|
|
1028
|
-
border-bottom: 2px solid transparent;
|
|
1029
|
-
transition: all 0.2s;
|
|
1030
|
-
}
|
|
1031
|
-
.rte-tab:hover {
|
|
1032
|
-
color: var(--rte-tmpl-dialog-text);
|
|
1033
|
-
}
|
|
1034
|
-
.rte-tab.active {
|
|
1035
|
-
color: var(--rte-tmpl-accent);
|
|
1036
|
-
border-bottom-color: var(--rte-tmpl-accent);
|
|
1037
|
-
font-weight: 600;
|
|
1038
|
-
}
|
|
1039
|
-
.rte-template-list {
|
|
1040
|
-
border: 1px solid var(--rte-tmpl-border);
|
|
1041
|
-
border-radius: 4px;
|
|
1042
|
-
max-height: 250px;
|
|
1043
|
-
overflow-y: auto;
|
|
1044
|
-
margin: 12px 0;
|
|
1045
|
-
background: var(--rte-tmpl-subtle-bg);
|
|
1046
|
-
}
|
|
1047
|
-
.rte-template-item {
|
|
1048
|
-
padding: 12px;
|
|
1049
|
-
border-bottom: 1px solid var(--rte-tmpl-border);
|
|
1050
|
-
cursor: pointer;
|
|
1051
|
-
transition: background-color 0.2s;
|
|
1052
|
-
background: none;
|
|
1053
|
-
}
|
|
1054
|
-
.rte-template-item:last-child {
|
|
1055
|
-
border-bottom: none;
|
|
1056
|
-
}
|
|
1057
|
-
.rte-template-item:hover,
|
|
1058
|
-
.rte-template-item.selected {
|
|
1059
|
-
background-color: var(--rte-tmpl-subtle-hover);
|
|
1060
|
-
}
|
|
1061
|
-
.template-name {
|
|
1062
|
-
font-weight: 600;
|
|
1063
|
-
color: var(--rte-tmpl-dialog-text);
|
|
1064
|
-
margin-bottom: 4px;
|
|
1065
|
-
}
|
|
1066
|
-
.template-description {
|
|
1067
|
-
font-size: 12px;
|
|
1068
|
-
color: var(--rte-tmpl-muted-text);
|
|
1069
|
-
}
|
|
1070
|
-
.rte-template-preview {
|
|
1071
|
-
padding: 12px;
|
|
1072
|
-
background-color: var(--rte-tmpl-subtle-bg);
|
|
1073
|
-
border: 1px solid var(--rte-tmpl-border);
|
|
1074
|
-
border-radius: 4px;
|
|
1075
|
-
margin-top: 12px;
|
|
1076
|
-
max-height: 200px;
|
|
1077
|
-
overflow-y: auto;
|
|
1078
|
-
}
|
|
1079
|
-
.template-preview-content {
|
|
1080
|
-
font-size: 13px;
|
|
1081
|
-
line-height: 1.5;
|
|
1082
|
-
margin-top: 8px;
|
|
1083
|
-
}
|
|
1084
|
-
.template-preview-content * {
|
|
1085
|
-
margin: 4px 0;
|
|
1086
|
-
}
|
|
1087
|
-
.rte-insert-mode {
|
|
1088
|
-
margin-top: 12px;
|
|
1089
|
-
padding: 12px;
|
|
1090
|
-
background-color: var(--rte-tmpl-subtle-bg);
|
|
1091
|
-
border-radius: 4px;
|
|
1092
|
-
display: flex;
|
|
1093
|
-
gap: 16px;
|
|
1094
|
-
}
|
|
1095
|
-
.rte-insert-mode label {
|
|
1096
|
-
display: flex;
|
|
1097
|
-
align-items: center;
|
|
1098
|
-
cursor: pointer;
|
|
1099
|
-
font-size: 14px;
|
|
1100
|
-
}
|
|
1101
|
-
.rte-insert-mode input {
|
|
1102
|
-
margin-right: 6px;
|
|
1103
|
-
cursor: pointer;
|
|
1104
|
-
}
|
|
1105
|
-
.rte-empty-state {
|
|
1106
|
-
padding: 40px;
|
|
1107
|
-
text-align: center;
|
|
1108
|
-
color: var(--rte-tmpl-muted-text);
|
|
1109
|
-
font-size: 14px;
|
|
1110
|
-
}
|
|
1111
|
-
.rte-dialog-footer {
|
|
1112
|
-
padding: 16px 20px;
|
|
1113
|
-
border-top: 1px solid var(--rte-tmpl-border);
|
|
1114
|
-
background: var(--rte-tmpl-subtle-bg);
|
|
1115
|
-
display: flex;
|
|
1116
|
-
justify-content: flex-end;
|
|
1117
|
-
gap: 12px;
|
|
1118
|
-
}
|
|
1119
|
-
.rte-button-primary {
|
|
1120
|
-
padding: 8px 16px;
|
|
1121
|
-
border: none;
|
|
1122
|
-
border-radius: 4px;
|
|
1123
|
-
font-size: 14px;
|
|
1124
|
-
cursor: pointer;
|
|
1125
|
-
background-color: var(--rte-tmpl-accent);
|
|
1126
|
-
color: white;
|
|
1127
|
-
transition: all 0.2s;
|
|
1128
|
-
}
|
|
1129
|
-
.rte-button-primary:hover:not([disabled]) {
|
|
1130
|
-
background-color: var(--rte-tmpl-accent-strong);
|
|
1131
|
-
}
|
|
1132
|
-
.rte-button-primary[disabled] {
|
|
1133
|
-
opacity: 0.5;
|
|
1134
|
-
cursor: not-allowed;
|
|
1135
|
-
}
|
|
1136
|
-
.rte-button-secondary {
|
|
1137
|
-
padding: 8px 16px;
|
|
1138
|
-
border: 1px solid var(--rte-tmpl-border);
|
|
1139
|
-
border-radius: 4px;
|
|
1140
|
-
font-size: 14px;
|
|
1141
|
-
cursor: pointer;
|
|
1142
|
-
background-color: var(--rte-tmpl-subtle-bg);
|
|
1143
|
-
color: var(--rte-tmpl-dialog-text);
|
|
1144
|
-
transition: all 0.2s;
|
|
1145
|
-
}
|
|
1146
|
-
.rte-button-secondary:hover {
|
|
1147
|
-
background-color: var(--rte-tmpl-subtle-hover);
|
|
1148
|
-
}
|
|
1149
|
-
`, document.head.appendChild(t);
|
|
1150
|
-
}
|
|
1151
|
-
const ar = () => ({
|
|
1152
|
-
name: "template",
|
|
1153
|
-
toolbar: [
|
|
1154
|
-
{
|
|
1155
|
-
label: "Template",
|
|
1156
|
-
command: "insertTemplate",
|
|
1157
|
-
icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 3V9H21V3H3ZM19 5H5V7H19V5Z" fill="#000000"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 11V21H11V11H3ZM9 13H5V19H9V13Z" fill="#000000"></path> <path d="M21 11H13V13H21V11Z" fill="#000000"></path> <path d="M13 15H21V17H13V15Z" fill="#000000"></path> <path d="M21 19H13V21H21V19Z" fill="#000000"></path> </g></svg>'
|
|
1158
|
-
}
|
|
1159
|
-
],
|
|
1160
|
-
commands: {
|
|
1161
|
-
insertTemplate: (n, t) => (Qn(t), !0)
|
|
1162
|
-
},
|
|
1163
|
-
keymap: {}
|
|
1164
|
-
});
|
|
1165
|
-
export {
|
|
1166
|
-
Gn as PREDEFINED_TEMPLATES,
|
|
1167
|
-
ar as TemplatePlugin,
|
|
1168
|
-
rr as addCustomTemplate,
|
|
1169
|
-
Vt as getAllTemplates,
|
|
1170
|
-
jt as getTemplateCategories,
|
|
1171
|
-
nr as getTemplatesByCategory,
|
|
1172
|
-
Yt as sanitizeTemplate,
|
|
1173
|
-
Wn as searchTemplates,
|
|
1174
|
-
or as validateTemplate
|
|
1175
|
-
};
|
|
1176
|
-
//# sourceMappingURL=TemplatePlugin.native-D6n5RUnC.mjs.map
|