@editora/core 1.0.8 → 1.0.10
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/README.md +6 -1
- package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
- package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
- package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
- package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
- package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
- package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
- package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
- package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
- package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
- package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
- package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
- package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
- package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/editora.min.js +1 -1
- package/dist/editora.umd.js +1 -1
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/plugin-loader.js +37 -37
- package/dist/webcomponent-core.js +18 -16
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +139 -62
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +50 -48
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1174 -1071
- package/package.json +11 -5
- package/LICENSE +0 -21
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
- package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
- package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
- package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
- package/dist/index-D1LOqg5C.js +0 -10
|
@@ -0,0 +1,1150 @@
|
|
|
1
|
+
const {
|
|
2
|
+
entries: Ht,
|
|
3
|
+
setPrototypeOf: wt,
|
|
4
|
+
isFrozen: gn,
|
|
5
|
+
getPrototypeOf: hn,
|
|
6
|
+
getOwnPropertyDescriptor: Tn
|
|
7
|
+
} = Object;
|
|
8
|
+
let {
|
|
9
|
+
freeze: L,
|
|
10
|
+
seal: O,
|
|
11
|
+
create: we
|
|
12
|
+
} = Object, {
|
|
13
|
+
apply: et,
|
|
14
|
+
construct: tt
|
|
15
|
+
} = typeof Reflect != "undefined" && Reflect;
|
|
16
|
+
L || (L = function(t) {
|
|
17
|
+
return t;
|
|
18
|
+
});
|
|
19
|
+
O || (O = function(t) {
|
|
20
|
+
return t;
|
|
21
|
+
});
|
|
22
|
+
et || (et = function(t, o) {
|
|
23
|
+
for (var i = arguments.length, c = new Array(i > 2 ? i - 2 : 0), u = 2; u < i; u++)
|
|
24
|
+
c[u - 2] = arguments[u];
|
|
25
|
+
return t.apply(o, c);
|
|
26
|
+
});
|
|
27
|
+
tt || (tt = function(t) {
|
|
28
|
+
for (var o = arguments.length, i = new Array(o > 1 ? o - 1 : 0), c = 1; c < o; c++)
|
|
29
|
+
i[c - 1] = arguments[c];
|
|
30
|
+
return new t(...i);
|
|
31
|
+
});
|
|
32
|
+
const Re = R(Array.prototype.forEach), bn = R(Array.prototype.lastIndexOf), Ct = R(Array.prototype.pop), ce = R(Array.prototype.push), En = R(Array.prototype.splice), Ce = R(String.prototype.toLowerCase), $e = R(String.prototype.toString), qe = R(String.prototype.match), ue = R(String.prototype.replace), An = R(String.prototype.indexOf), _n = R(String.prototype.trim), C = R(Object.prototype.hasOwnProperty), x = R(RegExp.prototype.test), pe = yn(TypeError);
|
|
33
|
+
function R(n) {
|
|
34
|
+
return function(t) {
|
|
35
|
+
t instanceof RegExp && (t.lastIndex = 0);
|
|
36
|
+
for (var o = arguments.length, i = new Array(o > 1 ? o - 1 : 0), c = 1; c < o; c++)
|
|
37
|
+
i[c - 1] = arguments[c];
|
|
38
|
+
return et(n, t, i);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function yn(n) {
|
|
42
|
+
return function() {
|
|
43
|
+
for (var t = arguments.length, o = new Array(t), i = 0; i < t; i++)
|
|
44
|
+
o[i] = arguments[i];
|
|
45
|
+
return tt(n, o);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function s(n, t) {
|
|
49
|
+
let o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ce;
|
|
50
|
+
wt && wt(n, null);
|
|
51
|
+
let i = t.length;
|
|
52
|
+
for (; i--; ) {
|
|
53
|
+
let c = t[i];
|
|
54
|
+
if (typeof c == "string") {
|
|
55
|
+
const u = o(c);
|
|
56
|
+
u !== c && (gn(t) || (t[i] = u), c = u);
|
|
57
|
+
}
|
|
58
|
+
n[c] = !0;
|
|
59
|
+
}
|
|
60
|
+
return n;
|
|
61
|
+
}
|
|
62
|
+
function vn(n) {
|
|
63
|
+
for (let t = 0; t < n.length; t++)
|
|
64
|
+
C(n, t) || (n[t] = null);
|
|
65
|
+
return n;
|
|
66
|
+
}
|
|
67
|
+
function k(n) {
|
|
68
|
+
const t = we(null);
|
|
69
|
+
for (const [o, i] of Ht(n))
|
|
70
|
+
C(n, o) && (Array.isArray(i) ? t[o] = vn(i) : i && typeof i == "object" && i.constructor === Object ? t[o] = k(i) : t[o] = i);
|
|
71
|
+
return t;
|
|
72
|
+
}
|
|
73
|
+
function de(n, t) {
|
|
74
|
+
for (; n !== null; ) {
|
|
75
|
+
const i = Tn(n, t);
|
|
76
|
+
if (i) {
|
|
77
|
+
if (i.get)
|
|
78
|
+
return R(i.get);
|
|
79
|
+
if (typeof i.value == "function")
|
|
80
|
+
return R(i.value);
|
|
81
|
+
}
|
|
82
|
+
n = hn(n);
|
|
83
|
+
}
|
|
84
|
+
function o() {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return o;
|
|
88
|
+
}
|
|
89
|
+
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"]), Ze = 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"]), Sn = 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"]), Ke = 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"]), xn = L(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Mt = L(["#text"]), Nt = 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"]), Ln = O(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Rn = O(/<%[\w\W]*|[\w\W]*%>/gm), Dn = O(/\$\{[\w\W]*/gm), wn = O(/^data-[\-\w.\u00B7-\uFFFF]+$/), Cn = O(/^aria-[\-\w]+$/), Ut = O(
|
|
90
|
+
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
91
|
+
// eslint-disable-line no-useless-escape
|
|
92
|
+
), On = O(/^(?:\w+script|data):/i), Mn = O(
|
|
93
|
+
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
94
|
+
// eslint-disable-line no-control-regex
|
|
95
|
+
), zt = O(/^html$/i), Nn = O(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
96
|
+
var kt = /* @__PURE__ */ Object.freeze({
|
|
97
|
+
__proto__: null,
|
|
98
|
+
ARIA_ATTR: Cn,
|
|
99
|
+
ATTR_WHITESPACE: Mn,
|
|
100
|
+
CUSTOM_ELEMENT: Nn,
|
|
101
|
+
DATA_ATTR: wn,
|
|
102
|
+
DOCTYPE_NAME: zt,
|
|
103
|
+
ERB_EXPR: Rn,
|
|
104
|
+
IS_ALLOWED_URI: Ut,
|
|
105
|
+
IS_SCRIPT_OR_DATA: On,
|
|
106
|
+
MUSTACHE_EXPR: Ln,
|
|
107
|
+
TMPLIT_EXPR: Dn
|
|
108
|
+
});
|
|
109
|
+
const me = {
|
|
110
|
+
element: 1,
|
|
111
|
+
text: 3,
|
|
112
|
+
// Deprecated
|
|
113
|
+
progressingInstruction: 7,
|
|
114
|
+
comment: 8,
|
|
115
|
+
document: 9
|
|
116
|
+
}, In = function() {
|
|
117
|
+
return typeof window == "undefined" ? null : window;
|
|
118
|
+
}, kn = function(t, o) {
|
|
119
|
+
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
120
|
+
return null;
|
|
121
|
+
let i = null;
|
|
122
|
+
const c = "data-tt-policy-suffix";
|
|
123
|
+
o && o.hasAttribute(c) && (i = o.getAttribute(c));
|
|
124
|
+
const u = "dompurify" + (i ? "#" + i : "");
|
|
125
|
+
try {
|
|
126
|
+
return t.createPolicy(u, {
|
|
127
|
+
createHTML(w) {
|
|
128
|
+
return w;
|
|
129
|
+
},
|
|
130
|
+
createScriptURL(w) {
|
|
131
|
+
return w;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
} catch (w) {
|
|
135
|
+
return console.warn("TrustedTypes policy " + u + " could not be created."), null;
|
|
136
|
+
}
|
|
137
|
+
}, Pt = function() {
|
|
138
|
+
return {
|
|
139
|
+
afterSanitizeAttributes: [],
|
|
140
|
+
afterSanitizeElements: [],
|
|
141
|
+
afterSanitizeShadowDOM: [],
|
|
142
|
+
beforeSanitizeAttributes: [],
|
|
143
|
+
beforeSanitizeElements: [],
|
|
144
|
+
beforeSanitizeShadowDOM: [],
|
|
145
|
+
uponSanitizeAttribute: [],
|
|
146
|
+
uponSanitizeElement: [],
|
|
147
|
+
uponSanitizeShadowNode: []
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
function Gt() {
|
|
151
|
+
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : In();
|
|
152
|
+
const t = (l) => Gt(l);
|
|
153
|
+
if (t.version = "3.3.2", t.removed = [], !n || !n.document || n.document.nodeType !== me.document || !n.Element)
|
|
154
|
+
return t.isSupported = !1, t;
|
|
155
|
+
let {
|
|
156
|
+
document: o
|
|
157
|
+
} = n;
|
|
158
|
+
const i = o, c = i.currentScript, {
|
|
159
|
+
DocumentFragment: u,
|
|
160
|
+
HTMLTemplateElement: w,
|
|
161
|
+
Node: M,
|
|
162
|
+
Element: d,
|
|
163
|
+
NodeFilter: E,
|
|
164
|
+
NamedNodeMap: B = n.NamedNodeMap || n.MozNamedAttrMap,
|
|
165
|
+
HTMLFormElement: j,
|
|
166
|
+
DOMParser: Oe,
|
|
167
|
+
trustedTypes: Te
|
|
168
|
+
} = n, oe = d.prototype, qt = de(oe, "cloneNode"), Xt = de(oe, "remove"), Zt = de(oe, "nextSibling"), Kt = de(oe, "childNodes"), be = de(oe, "parentNode");
|
|
169
|
+
if (typeof w == "function") {
|
|
170
|
+
const l = o.createElement("template");
|
|
171
|
+
l.content && l.content.ownerDocument && (o = l.content.ownerDocument);
|
|
172
|
+
}
|
|
173
|
+
let v, ae = "";
|
|
174
|
+
const {
|
|
175
|
+
implementation: Me,
|
|
176
|
+
createNodeIterator: Qt,
|
|
177
|
+
createDocumentFragment: Jt,
|
|
178
|
+
getElementsByTagName: en
|
|
179
|
+
} = o, {
|
|
180
|
+
importNode: tn
|
|
181
|
+
} = i;
|
|
182
|
+
let S = Pt();
|
|
183
|
+
t.isSupported = typeof Ht == "function" && typeof be == "function" && Me && Me.createHTMLDocument !== void 0;
|
|
184
|
+
const {
|
|
185
|
+
MUSTACHE_EXPR: Ne,
|
|
186
|
+
ERB_EXPR: Ie,
|
|
187
|
+
TMPLIT_EXPR: ke,
|
|
188
|
+
DATA_ATTR: nn,
|
|
189
|
+
ARIA_ATTR: rn,
|
|
190
|
+
IS_SCRIPT_OR_DATA: on,
|
|
191
|
+
ATTR_WHITESPACE: at,
|
|
192
|
+
CUSTOM_ELEMENT: an
|
|
193
|
+
} = kt;
|
|
194
|
+
let {
|
|
195
|
+
IS_ALLOWED_URI: it
|
|
196
|
+
} = kt, b = null;
|
|
197
|
+
const lt = s({}, [...Ot, ...Xe, ...Ze, ...Ke, ...Mt]);
|
|
198
|
+
let A = null;
|
|
199
|
+
const st = s({}, [...Nt, ...Qe, ...It, ...De]);
|
|
200
|
+
let m = Object.seal(we(null, {
|
|
201
|
+
tagNameCheck: {
|
|
202
|
+
writable: !0,
|
|
203
|
+
configurable: !1,
|
|
204
|
+
enumerable: !0,
|
|
205
|
+
value: null
|
|
206
|
+
},
|
|
207
|
+
attributeNameCheck: {
|
|
208
|
+
writable: !0,
|
|
209
|
+
configurable: !1,
|
|
210
|
+
enumerable: !0,
|
|
211
|
+
value: null
|
|
212
|
+
},
|
|
213
|
+
allowCustomizedBuiltInElements: {
|
|
214
|
+
writable: !0,
|
|
215
|
+
configurable: !1,
|
|
216
|
+
enumerable: !0,
|
|
217
|
+
value: !1
|
|
218
|
+
}
|
|
219
|
+
})), ie = null, Ee = null;
|
|
220
|
+
const G = Object.seal(we(null, {
|
|
221
|
+
tagCheck: {
|
|
222
|
+
writable: !0,
|
|
223
|
+
configurable: !1,
|
|
224
|
+
enumerable: !0,
|
|
225
|
+
value: null
|
|
226
|
+
},
|
|
227
|
+
attributeCheck: {
|
|
228
|
+
writable: !0,
|
|
229
|
+
configurable: !1,
|
|
230
|
+
enumerable: !0,
|
|
231
|
+
value: null
|
|
232
|
+
}
|
|
233
|
+
}));
|
|
234
|
+
let ct = !0, Pe = !0, ut = !1, pt = !0, $ = !1, Ae = !0, V = !1, Fe = !1, He = !1, q = !1, _e = !1, ye = !1, dt = !0, mt = !1;
|
|
235
|
+
const ln = "user-content-";
|
|
236
|
+
let Ue = !0, le = !1, X = {}, N = null;
|
|
237
|
+
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"]);
|
|
238
|
+
let ft = null;
|
|
239
|
+
const gt = s({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
240
|
+
let Ge = null;
|
|
241
|
+
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", H = "http://www.w3.org/1999/xhtml";
|
|
242
|
+
let Z = H, We = !1, Be = null;
|
|
243
|
+
const sn = s({}, [ve, Se, H], $e);
|
|
244
|
+
let xe = s({}, ["mi", "mo", "mn", "ms", "mtext"]), Le = s({}, ["annotation-xml"]);
|
|
245
|
+
const cn = s({}, ["title", "style", "font", "a", "script"]);
|
|
246
|
+
let se = null;
|
|
247
|
+
const un = ["application/xhtml+xml", "text/html"], pn = "text/html";
|
|
248
|
+
let T = null, K = null;
|
|
249
|
+
const dn = o.createElement("form"), Tt = function(e) {
|
|
250
|
+
return e instanceof RegExp || e instanceof Function;
|
|
251
|
+
}, je = function() {
|
|
252
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
253
|
+
if (!(K && K === e)) {
|
|
254
|
+
if ((!e || typeof e != "object") && (e = {}), e = k(e), se = // eslint-disable-next-line unicorn/prefer-includes
|
|
255
|
+
un.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? pn : e.PARSER_MEDIA_TYPE, T = se === "application/xhtml+xml" ? $e : Ce, b = C(e, "ALLOWED_TAGS") ? s({}, e.ALLOWED_TAGS, T) : lt, A = C(e, "ALLOWED_ATTR") ? s({}, e.ALLOWED_ATTR, T) : st, Be = C(e, "ALLOWED_NAMESPACES") ? s({}, e.ALLOWED_NAMESPACES, $e) : sn, Ge = C(e, "ADD_URI_SAFE_ATTR") ? s(k(ht), e.ADD_URI_SAFE_ATTR, T) : ht, ft = C(e, "ADD_DATA_URI_TAGS") ? s(k(gt), e.ADD_DATA_URI_TAGS, T) : gt, N = C(e, "FORBID_CONTENTS") ? s({}, e.FORBID_CONTENTS, T) : ze, ie = C(e, "FORBID_TAGS") ? s({}, e.FORBID_TAGS, T) : k({}), Ee = C(e, "FORBID_ATTR") ? s({}, e.FORBID_ATTR, T) : k({}), X = C(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, V = e.WHOLE_DOCUMENT || !1, q = e.RETURN_DOM || !1, _e = e.RETURN_DOM_FRAGMENT || !1, ye = e.RETURN_TRUSTED_TYPE || !1, He = 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 || Ut, Z = e.NAMESPACE || H, 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 && (b = s({}, Mt), A = we(null), X.html === !0 && (s(b, Ot), s(A, Nt)), X.svg === !0 && (s(b, Xe), s(A, Qe), s(A, De)), X.svgFilters === !0 && (s(b, Ze), s(A, Qe), s(A, De)), X.mathMl === !0 && (s(b, Ke), s(A, It), s(A, De))), C(e, "ADD_TAGS") || (G.tagCheck = null), C(e, "ADD_ATTR") || (G.attributeCheck = null), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? G.tagCheck = e.ADD_TAGS : (b === lt && (b = k(b)), s(b, e.ADD_TAGS, T))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? G.attributeCheck = e.ADD_ATTR : (A === st && (A = k(A)), s(A, e.ADD_ATTR, T))), e.ADD_URI_SAFE_ATTR && s(Ge, e.ADD_URI_SAFE_ATTR, T), e.FORBID_CONTENTS && (N === ze && (N = k(N)), s(N, e.FORBID_CONTENTS, T)), e.ADD_FORBID_CONTENTS && (N === ze && (N = k(N)), s(N, e.ADD_FORBID_CONTENTS, T)), Ue && (b["#text"] = !0), V && s(b, ["html", "head", "body"]), b.table && (s(b, ["tbody"]), delete ie.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
256
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
257
|
+
throw pe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
258
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
259
|
+
throw pe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
260
|
+
v = e.TRUSTED_TYPES_POLICY, ae = v.createHTML("");
|
|
261
|
+
} else
|
|
262
|
+
v === void 0 && (v = kn(Te, c)), v !== null && typeof ae == "string" && (ae = v.createHTML(""));
|
|
263
|
+
L && L(e), K = e;
|
|
264
|
+
}
|
|
265
|
+
}, bt = s({}, [...Xe, ...Ze, ...Sn]), Et = s({}, [...Ke, ...xn]), mn = function(e) {
|
|
266
|
+
let r = be(e);
|
|
267
|
+
(!r || !r.tagName) && (r = {
|
|
268
|
+
namespaceURI: Z,
|
|
269
|
+
tagName: "template"
|
|
270
|
+
});
|
|
271
|
+
const a = Ce(e.tagName), p = Ce(r.tagName);
|
|
272
|
+
return Be[e.namespaceURI] ? e.namespaceURI === Se ? r.namespaceURI === H ? a === "svg" : r.namespaceURI === ve ? a === "svg" && (p === "annotation-xml" || xe[p]) : !!bt[a] : e.namespaceURI === ve ? r.namespaceURI === H ? a === "math" : r.namespaceURI === Se ? a === "math" && Le[p] : !!Et[a] : e.namespaceURI === H ? r.namespaceURI === Se && !Le[p] || r.namespaceURI === ve && !xe[p] ? !1 : !Et[a] && (cn[a] || !bt[a]) : !!(se === "application/xhtml+xml" && Be[e.namespaceURI]) : !1;
|
|
273
|
+
}, I = function(e) {
|
|
274
|
+
ce(t.removed, {
|
|
275
|
+
element: e
|
|
276
|
+
});
|
|
277
|
+
try {
|
|
278
|
+
be(e).removeChild(e);
|
|
279
|
+
} catch (r) {
|
|
280
|
+
Xt(e);
|
|
281
|
+
}
|
|
282
|
+
}, Y = function(e, r) {
|
|
283
|
+
try {
|
|
284
|
+
ce(t.removed, {
|
|
285
|
+
attribute: r.getAttributeNode(e),
|
|
286
|
+
from: r
|
|
287
|
+
});
|
|
288
|
+
} catch (a) {
|
|
289
|
+
ce(t.removed, {
|
|
290
|
+
attribute: null,
|
|
291
|
+
from: r
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
if (r.removeAttribute(e), e === "is")
|
|
295
|
+
if (q || _e)
|
|
296
|
+
try {
|
|
297
|
+
I(r);
|
|
298
|
+
} catch (a) {
|
|
299
|
+
}
|
|
300
|
+
else
|
|
301
|
+
try {
|
|
302
|
+
r.setAttribute(e, "");
|
|
303
|
+
} catch (a) {
|
|
304
|
+
}
|
|
305
|
+
}, At = function(e) {
|
|
306
|
+
let r = null, a = null;
|
|
307
|
+
if (He)
|
|
308
|
+
e = "<remove></remove>" + e;
|
|
309
|
+
else {
|
|
310
|
+
const f = qe(e, /^[\r\n\t ]+/);
|
|
311
|
+
a = f && f[0];
|
|
312
|
+
}
|
|
313
|
+
se === "application/xhtml+xml" && Z === H && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
|
|
314
|
+
const p = v ? v.createHTML(e) : e;
|
|
315
|
+
if (Z === H)
|
|
316
|
+
try {
|
|
317
|
+
r = new Oe().parseFromString(p, se);
|
|
318
|
+
} catch (f) {
|
|
319
|
+
}
|
|
320
|
+
if (!r || !r.documentElement) {
|
|
321
|
+
r = Me.createDocument(Z, "template", null);
|
|
322
|
+
try {
|
|
323
|
+
r.documentElement.innerHTML = We ? ae : p;
|
|
324
|
+
} catch (f) {
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const y = r.body || r.documentElement;
|
|
328
|
+
return e && a && y.insertBefore(o.createTextNode(a), y.childNodes[0] || null), Z === H ? en.call(r, V ? "html" : "body")[0] : V ? r.documentElement : y;
|
|
329
|
+
}, _t = function(e) {
|
|
330
|
+
return Qt.call(
|
|
331
|
+
e.ownerDocument || e,
|
|
332
|
+
e,
|
|
333
|
+
// eslint-disable-next-line no-bitwise
|
|
334
|
+
E.SHOW_ELEMENT | E.SHOW_COMMENT | E.SHOW_TEXT | E.SHOW_PROCESSING_INSTRUCTION | E.SHOW_CDATA_SECTION,
|
|
335
|
+
null
|
|
336
|
+
);
|
|
337
|
+
}, Ve = function(e) {
|
|
338
|
+
return e instanceof j && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof B) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
|
|
339
|
+
}, yt = function(e) {
|
|
340
|
+
return typeof M == "function" && e instanceof M;
|
|
341
|
+
};
|
|
342
|
+
function U(l, e, r) {
|
|
343
|
+
Re(l, (a) => {
|
|
344
|
+
a.call(t, e, r, K);
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
const vt = function(e) {
|
|
348
|
+
let r = null;
|
|
349
|
+
if (U(S.beforeSanitizeElements, e, null), Ve(e))
|
|
350
|
+
return I(e), !0;
|
|
351
|
+
const a = T(e.nodeName);
|
|
352
|
+
if (U(S.uponSanitizeElement, e, {
|
|
353
|
+
tagName: a,
|
|
354
|
+
allowedTags: b
|
|
355
|
+
}), 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))
|
|
356
|
+
return I(e), !0;
|
|
357
|
+
if (!(G.tagCheck instanceof Function && G.tagCheck(a)) && (!b[a] || ie[a])) {
|
|
358
|
+
if (!ie[a] && xt(a) && (m.tagNameCheck instanceof RegExp && x(m.tagNameCheck, a) || m.tagNameCheck instanceof Function && m.tagNameCheck(a)))
|
|
359
|
+
return !1;
|
|
360
|
+
if (Ue && !N[a]) {
|
|
361
|
+
const p = be(e) || e.parentNode, y = Kt(e) || e.childNodes;
|
|
362
|
+
if (y && p) {
|
|
363
|
+
const f = y.length;
|
|
364
|
+
for (let D = f - 1; D >= 0; --D) {
|
|
365
|
+
const z = qt(y[D], !0);
|
|
366
|
+
z.__removalCount = (e.__removalCount || 0) + 1, p.insertBefore(z, Zt(e));
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return I(e), !0;
|
|
371
|
+
}
|
|
372
|
+
return e instanceof d && !mn(e) || (a === "noscript" || a === "noembed" || a === "noframes") && x(/<\/no(script|embed|frames)/i, e.innerHTML) ? (I(e), !0) : ($ && e.nodeType === me.text && (r = e.textContent, Re([Ne, Ie, ke], (p) => {
|
|
373
|
+
r = ue(r, p, " ");
|
|
374
|
+
}), e.textContent !== r && (ce(t.removed, {
|
|
375
|
+
element: e.cloneNode()
|
|
376
|
+
}), e.textContent = r)), U(S.afterSanitizeElements, e, null), !1);
|
|
377
|
+
}, St = function(e, r, a) {
|
|
378
|
+
if (Ee[r] || dt && (r === "id" || r === "name") && (a in o || a in dn))
|
|
379
|
+
return !1;
|
|
380
|
+
if (!(Pe && !Ee[r] && x(nn, r))) {
|
|
381
|
+
if (!(ct && x(rn, r))) {
|
|
382
|
+
if (!(G.attributeCheck instanceof Function && G.attributeCheck(r, e))) {
|
|
383
|
+
if (!A[r] || Ee[r]) {
|
|
384
|
+
if (
|
|
385
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
386
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
387
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
388
|
+
!(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
|
|
389
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
390
|
+
r === "is" && m.allowCustomizedBuiltInElements && (m.tagNameCheck instanceof RegExp && x(m.tagNameCheck, a) || m.tagNameCheck instanceof Function && m.tagNameCheck(a)))
|
|
391
|
+
) return !1;
|
|
392
|
+
} else if (!Ge[r]) {
|
|
393
|
+
if (!x(it, ue(a, at, ""))) {
|
|
394
|
+
if (!((r === "src" || r === "xlink:href" || r === "href") && e !== "script" && An(a, "data:") === 0 && ft[e])) {
|
|
395
|
+
if (!(ut && !x(on, ue(a, at, "")))) {
|
|
396
|
+
if (a)
|
|
397
|
+
return !1;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return !0;
|
|
406
|
+
}, xt = function(e) {
|
|
407
|
+
return e !== "annotation-xml" && qe(e, an);
|
|
408
|
+
}, Lt = function(e) {
|
|
409
|
+
U(S.beforeSanitizeAttributes, e, null);
|
|
410
|
+
const {
|
|
411
|
+
attributes: r
|
|
412
|
+
} = e;
|
|
413
|
+
if (!r || Ve(e))
|
|
414
|
+
return;
|
|
415
|
+
const a = {
|
|
416
|
+
attrName: "",
|
|
417
|
+
attrValue: "",
|
|
418
|
+
keepAttr: !0,
|
|
419
|
+
allowedAttributes: A,
|
|
420
|
+
forceKeepAttr: void 0
|
|
421
|
+
};
|
|
422
|
+
let p = r.length;
|
|
423
|
+
for (; p--; ) {
|
|
424
|
+
const y = r[p], {
|
|
425
|
+
name: f,
|
|
426
|
+
namespaceURI: D,
|
|
427
|
+
value: z
|
|
428
|
+
} = y, Q = T(f), Ye = z;
|
|
429
|
+
let _ = f === "value" ? Ye : _n(Ye);
|
|
430
|
+
if (a.attrName = Q, a.attrValue = _, a.keepAttr = !0, a.forceKeepAttr = void 0, U(S.uponSanitizeAttribute, e, a), _ = a.attrValue, mt && (Q === "id" || Q === "name") && (Y(f, e), _ = ln + _), Ae && x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, _)) {
|
|
431
|
+
Y(f, e);
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
if (Q === "attributename" && qe(_, "href")) {
|
|
435
|
+
Y(f, e);
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
if (a.forceKeepAttr)
|
|
439
|
+
continue;
|
|
440
|
+
if (!a.keepAttr) {
|
|
441
|
+
Y(f, e);
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
if (!pt && x(/\/>/i, _)) {
|
|
445
|
+
Y(f, e);
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
448
|
+
$ && Re([Ne, Ie, ke], (Dt) => {
|
|
449
|
+
_ = ue(_, Dt, " ");
|
|
450
|
+
});
|
|
451
|
+
const Rt = T(e.nodeName);
|
|
452
|
+
if (!St(Rt, Q, _)) {
|
|
453
|
+
Y(f, e);
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
if (v && typeof Te == "object" && typeof Te.getAttributeType == "function" && !D)
|
|
457
|
+
switch (Te.getAttributeType(Rt, Q)) {
|
|
458
|
+
case "TrustedHTML": {
|
|
459
|
+
_ = v.createHTML(_);
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
case "TrustedScriptURL": {
|
|
463
|
+
_ = v.createScriptURL(_);
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (_ !== Ye)
|
|
468
|
+
try {
|
|
469
|
+
D ? e.setAttributeNS(D, f, _) : e.setAttribute(f, _), Ve(e) ? I(e) : Ct(t.removed);
|
|
470
|
+
} catch (Dt) {
|
|
471
|
+
Y(f, e);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
U(S.afterSanitizeAttributes, e, null);
|
|
475
|
+
}, fn = function l(e) {
|
|
476
|
+
let r = null;
|
|
477
|
+
const a = _t(e);
|
|
478
|
+
for (U(S.beforeSanitizeShadowDOM, e, null); r = a.nextNode(); )
|
|
479
|
+
U(S.uponSanitizeShadowNode, r, null), vt(r), Lt(r), r.content instanceof u && l(r.content);
|
|
480
|
+
U(S.afterSanitizeShadowDOM, e, null);
|
|
481
|
+
};
|
|
482
|
+
return t.sanitize = function(l) {
|
|
483
|
+
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = null, a = null, p = null, y = null;
|
|
484
|
+
if (We = !l, We && (l = "<!-->"), typeof l != "string" && !yt(l))
|
|
485
|
+
if (typeof l.toString == "function") {
|
|
486
|
+
if (l = l.toString(), typeof l != "string")
|
|
487
|
+
throw pe("dirty is not a string, aborting");
|
|
488
|
+
} else
|
|
489
|
+
throw pe("toString is not a function");
|
|
490
|
+
if (!t.isSupported)
|
|
491
|
+
return l;
|
|
492
|
+
if (Fe || je(e), t.removed = [], typeof l == "string" && (le = !1), le) {
|
|
493
|
+
if (l.nodeName) {
|
|
494
|
+
const z = T(l.nodeName);
|
|
495
|
+
if (!b[z] || ie[z])
|
|
496
|
+
throw pe("root node is forbidden and cannot be sanitized in-place");
|
|
497
|
+
}
|
|
498
|
+
} else if (l instanceof M)
|
|
499
|
+
r = At("<!---->"), a = r.ownerDocument.importNode(l, !0), a.nodeType === me.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? r = a : r.appendChild(a);
|
|
500
|
+
else {
|
|
501
|
+
if (!q && !$ && !V && // eslint-disable-next-line unicorn/prefer-includes
|
|
502
|
+
l.indexOf("<") === -1)
|
|
503
|
+
return v && ye ? v.createHTML(l) : l;
|
|
504
|
+
if (r = At(l), !r)
|
|
505
|
+
return q ? null : ye ? ae : "";
|
|
506
|
+
}
|
|
507
|
+
r && He && I(r.firstChild);
|
|
508
|
+
const f = _t(le ? l : r);
|
|
509
|
+
for (; p = f.nextNode(); )
|
|
510
|
+
vt(p), Lt(p), p.content instanceof u && fn(p.content);
|
|
511
|
+
if (le)
|
|
512
|
+
return l;
|
|
513
|
+
if (q) {
|
|
514
|
+
if (_e)
|
|
515
|
+
for (y = Jt.call(r.ownerDocument); r.firstChild; )
|
|
516
|
+
y.appendChild(r.firstChild);
|
|
517
|
+
else
|
|
518
|
+
y = r;
|
|
519
|
+
return (A.shadowroot || A.shadowrootmode) && (y = tn.call(i, y, !0)), y;
|
|
520
|
+
}
|
|
521
|
+
let D = V ? r.outerHTML : r.innerHTML;
|
|
522
|
+
return V && b["!doctype"] && r.ownerDocument && r.ownerDocument.doctype && r.ownerDocument.doctype.name && x(zt, r.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + r.ownerDocument.doctype.name + `>
|
|
523
|
+
` + D), $ && Re([Ne, Ie, ke], (z) => {
|
|
524
|
+
D = ue(D, z, " ");
|
|
525
|
+
}), v && ye ? v.createHTML(D) : D;
|
|
526
|
+
}, t.setConfig = function() {
|
|
527
|
+
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
528
|
+
je(l), Fe = !0;
|
|
529
|
+
}, t.clearConfig = function() {
|
|
530
|
+
K = null, Fe = !1;
|
|
531
|
+
}, t.isValidAttribute = function(l, e, r) {
|
|
532
|
+
K || je({});
|
|
533
|
+
const a = T(l), p = T(e);
|
|
534
|
+
return St(a, p, r);
|
|
535
|
+
}, t.addHook = function(l, e) {
|
|
536
|
+
typeof e == "function" && ce(S[l], e);
|
|
537
|
+
}, t.removeHook = function(l, e) {
|
|
538
|
+
if (e !== void 0) {
|
|
539
|
+
const r = bn(S[l], e);
|
|
540
|
+
return r === -1 ? void 0 : En(S[l], r, 1)[0];
|
|
541
|
+
}
|
|
542
|
+
return Ct(S[l]);
|
|
543
|
+
}, t.removeHooks = function(l) {
|
|
544
|
+
S[l] = [];
|
|
545
|
+
}, t.removeAllHooks = function() {
|
|
546
|
+
S = Pt();
|
|
547
|
+
}, t;
|
|
548
|
+
}
|
|
549
|
+
var Pn = Gt();
|
|
550
|
+
let g = null, F = null, ee = null, h = null, te = "", ne = "", fe = "insert", ge = null, P = null, J = null;
|
|
551
|
+
function Wt(n, t) {
|
|
552
|
+
if (t === n.innerHTML) return;
|
|
553
|
+
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
554
|
+
if (typeof o == "function")
|
|
555
|
+
try {
|
|
556
|
+
o("recordDomTransaction", n, t, n.innerHTML);
|
|
557
|
+
} catch (i) {
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
function Fn(n) {
|
|
561
|
+
if (!n) return null;
|
|
562
|
+
let t = n.startContainer;
|
|
563
|
+
for (; t && t !== document.body; ) {
|
|
564
|
+
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
565
|
+
const o = t;
|
|
566
|
+
if (o.getAttribute("contenteditable") === "true")
|
|
567
|
+
return o;
|
|
568
|
+
}
|
|
569
|
+
t = t.parentNode;
|
|
570
|
+
}
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
const Hn = [
|
|
574
|
+
{
|
|
575
|
+
id: "formal-letter",
|
|
576
|
+
name: "Formal Letter",
|
|
577
|
+
category: "Letters",
|
|
578
|
+
description: "Professional business letter template",
|
|
579
|
+
html: `<p><strong>{{ Company Name }}</strong></p>
|
|
580
|
+
<p>{{ Today }}</p>
|
|
581
|
+
<p>Dear {{ first_name }} {{ last_name }},</p>
|
|
582
|
+
<p>I hope this letter finds you well. [Your letter content here]</p>
|
|
583
|
+
<p>Thank you for your time and consideration.</p>
|
|
584
|
+
<p>Sincerely,<br>Your Name</p>`
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
id: "meeting-notes",
|
|
588
|
+
name: "Meeting Notes",
|
|
589
|
+
category: "Notes",
|
|
590
|
+
description: "Template for meeting notes with attendees and action items",
|
|
591
|
+
html: `<h2>Meeting Notes - {{ today }}</h2>
|
|
592
|
+
<p><strong>Attendees:</strong> [List attendees]</p>
|
|
593
|
+
<p><strong>Agenda:</strong></p>
|
|
594
|
+
<ul>
|
|
595
|
+
<li>[Item 1]</li>
|
|
596
|
+
<li>[Item 2]</li>
|
|
597
|
+
<li>[Item 3]</li>
|
|
598
|
+
</ul>
|
|
599
|
+
<p><strong>Action Items:</strong></p>
|
|
600
|
+
<ul>
|
|
601
|
+
<li>[Owner]: [Task] - [Due Date]</li>
|
|
602
|
+
</ul>
|
|
603
|
+
<p><strong>Next Meeting:</strong> [Date]</p>`
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
id: "proposal",
|
|
607
|
+
name: "Project Proposal",
|
|
608
|
+
category: "Business",
|
|
609
|
+
description: "Structured project proposal template",
|
|
610
|
+
html: `<h1>Project Proposal</h1>
|
|
611
|
+
<h2>Executive Summary</h2>
|
|
612
|
+
<p>[Summary of the proposal]</p>
|
|
613
|
+
<h2>Objectives</h2>
|
|
614
|
+
<ul>
|
|
615
|
+
<li>[Objective 1]</li>
|
|
616
|
+
<li>[Objective 2]</li>
|
|
617
|
+
</ul>
|
|
618
|
+
<h2>Scope</h2>
|
|
619
|
+
<p>[Project scope details]</p>
|
|
620
|
+
<h2>Timeline</h2>
|
|
621
|
+
<p>[Project timeline]</p>
|
|
622
|
+
<h2>Budget</h2>
|
|
623
|
+
<p>[Budget details]</p>
|
|
624
|
+
<h2>Contact</h2>
|
|
625
|
+
<p>{{ first_name }} {{ last_name }}<br>{{ email }}<br>{{ phone }}</p>`
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
id: "faq",
|
|
629
|
+
name: "FAQ Template",
|
|
630
|
+
category: "Documentation",
|
|
631
|
+
description: "FAQ document structure",
|
|
632
|
+
html: `<h1>Frequently Asked Questions</h1>
|
|
633
|
+
<h2>General Questions</h2>
|
|
634
|
+
<h3>Q: What is this about?</h3>
|
|
635
|
+
<p>A: [Answer here]</p>
|
|
636
|
+
<h3>Q: Who should use this?</h3>
|
|
637
|
+
<p>A: [Answer here]</p>
|
|
638
|
+
<h2>Technical Questions</h2>
|
|
639
|
+
<h3>Q: How do I get started?</h3>
|
|
640
|
+
<p>A: [Answer here]</p>
|
|
641
|
+
<h3>Q: What are the requirements?</h3>
|
|
642
|
+
<p>A: [Answer here]</p>`
|
|
643
|
+
}
|
|
644
|
+
];
|
|
645
|
+
let re = [...Hn];
|
|
646
|
+
const Bt = () => re, Zn = (n) => re.filter((t) => t.category === n), jt = () => {
|
|
647
|
+
const n = new Set(re.map((t) => t.category));
|
|
648
|
+
return Array.from(n);
|
|
649
|
+
}, Un = (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
|
+
}, Vt = (n) => Pn.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
|
+
}), Kn = (n) => re.some((t) => t.id === n.id) ? (console.warn(`Template with ID ${n.id} already exists`), !1) : (re.push(n), !0), Qn = (n) => !!(n.id && n.name && n.category && n.html && n.html.trim().length > 0);
|
|
661
|
+
function zn(n) {
|
|
662
|
+
F = document.createElement("div"), F.className = "rte-dialog-overlay", Bn(n) && F.classList.add("rte-ui-theme-dark"), F.addEventListener("click", () => W()), g = document.createElement("div"), g.className = "rte-dialog rte-template-dialog", g.addEventListener("click", (o) => o.stopPropagation());
|
|
663
|
+
const t = jt();
|
|
664
|
+
t.length > 0 && !te && (te = t[0]), he(), F.appendChild(g), document.body.appendChild(F), Gn(), Xn();
|
|
665
|
+
}
|
|
666
|
+
function Gn() {
|
|
667
|
+
Yt(), ge = (n) => {
|
|
668
|
+
n.key === "Escape" && (!F || !g || (n.preventDefault(), n.stopPropagation(), W()));
|
|
669
|
+
}, document.addEventListener("keydown", ge, !0);
|
|
670
|
+
}
|
|
671
|
+
function Yt() {
|
|
672
|
+
ge && (document.removeEventListener("keydown", ge, !0), ge = null);
|
|
673
|
+
}
|
|
674
|
+
const Wn = '[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
|
+
}, Bn = (n) => {
|
|
682
|
+
const t = n || nt();
|
|
683
|
+
return t ? !!t.closest(Wn) : !1;
|
|
684
|
+
};
|
|
685
|
+
function rt() {
|
|
686
|
+
const n = Fn(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 (!g) return;
|
|
694
|
+
const n = jt(), t = ot();
|
|
695
|
+
g.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="${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 ${(h == null ? void 0 : h.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
|
+
${h ? `
|
|
735
|
+
<div class="rte-template-preview">
|
|
736
|
+
<strong>Preview:</strong>
|
|
737
|
+
<div class="template-preview-content">${h.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" ${h ? "" : "disabled"}>
|
|
757
|
+
${fe === "insert" ? "Insert" : "Replace"}
|
|
758
|
+
</button>
|
|
759
|
+
</div>
|
|
760
|
+
`, Vn();
|
|
761
|
+
}
|
|
762
|
+
function jn() {
|
|
763
|
+
if (!g) return;
|
|
764
|
+
g.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 = g.querySelector(".rte-cancel-warning-btn"), t = g.querySelector(".rte-confirm-replace-btn");
|
|
777
|
+
n == null || n.addEventListener("click", () => he()), t == null || t.addEventListener("click", () => Yn());
|
|
778
|
+
}
|
|
779
|
+
function ot() {
|
|
780
|
+
const n = Bt();
|
|
781
|
+
return ne.trim() ? Un(ne) : te ? n.filter((t) => t.category === te) : n;
|
|
782
|
+
}
|
|
783
|
+
function Vn() {
|
|
784
|
+
if (!g) return;
|
|
785
|
+
const n = g.querySelector(".rte-dialog-close");
|
|
786
|
+
n == null || n.addEventListener("click", () => W());
|
|
787
|
+
const t = g.querySelector(".rte-cancel-btn");
|
|
788
|
+
t == null || t.addEventListener("click", () => W());
|
|
789
|
+
const o = g.querySelector(".rte-insert-btn");
|
|
790
|
+
o == null || o.addEventListener("click", () => Je());
|
|
791
|
+
const i = g.querySelector(".rte-template-search");
|
|
792
|
+
i == null || i.addEventListener("input", (d) => {
|
|
793
|
+
P !== null && cancelAnimationFrame(P), ne = d.target.value, P = requestAnimationFrame(() => {
|
|
794
|
+
P = null, Ft();
|
|
795
|
+
});
|
|
796
|
+
}), i == null || i.addEventListener("keydown", (d) => {
|
|
797
|
+
d.key === "Enter" && h ? Je() : d.key === "Escape" && W();
|
|
798
|
+
});
|
|
799
|
+
const c = g.querySelector(".rte-tabs");
|
|
800
|
+
c == null || c.addEventListener("click", (d) => {
|
|
801
|
+
const B = d.target.closest(".rte-tab");
|
|
802
|
+
if (!B) return;
|
|
803
|
+
const j = B.getAttribute("data-category");
|
|
804
|
+
j && (te = j, ne = "", P !== null && (cancelAnimationFrame(P), P = null), Ft());
|
|
805
|
+
});
|
|
806
|
+
const u = g.querySelector(".rte-template-list"), w = (d) => {
|
|
807
|
+
const B = d.target.closest(".rte-template-item");
|
|
808
|
+
if (!B) return null;
|
|
809
|
+
const j = B.getAttribute("data-template-id");
|
|
810
|
+
return j && Bt().find((Oe) => Oe.id === j) || null;
|
|
811
|
+
};
|
|
812
|
+
u == null || u.addEventListener("click", (d) => {
|
|
813
|
+
const E = w(d);
|
|
814
|
+
E && (h = E, he());
|
|
815
|
+
}), u == null || u.addEventListener("dblclick", (d) => {
|
|
816
|
+
const E = w(d);
|
|
817
|
+
E && (h = E, Je());
|
|
818
|
+
});
|
|
819
|
+
const M = g.querySelector(".rte-insert-mode");
|
|
820
|
+
M == null || M.addEventListener("change", (d) => {
|
|
821
|
+
const E = d.target;
|
|
822
|
+
!E || E.name !== "insertMode" || (fe = E.value, he());
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
function Ft() {
|
|
826
|
+
const n = ot();
|
|
827
|
+
n.length > 0 ? (!h || !n.find((t) => t.id === h.id)) && (h = n[0]) : h = null, he();
|
|
828
|
+
}
|
|
829
|
+
function Je() {
|
|
830
|
+
var n;
|
|
831
|
+
if (h)
|
|
832
|
+
if (fe === "replace") {
|
|
833
|
+
const t = rt();
|
|
834
|
+
if ((n = t == null ? void 0 : t.innerHTML) != null && n.trim()) {
|
|
835
|
+
jn();
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
$t(h), W();
|
|
839
|
+
} else
|
|
840
|
+
$n(h), W();
|
|
841
|
+
}
|
|
842
|
+
function Yn() {
|
|
843
|
+
h && ($t(h), W());
|
|
844
|
+
}
|
|
845
|
+
function $n(n) {
|
|
846
|
+
var M;
|
|
847
|
+
const t = window.getSelection();
|
|
848
|
+
if (!t) return;
|
|
849
|
+
const o = rt();
|
|
850
|
+
if (!o) return;
|
|
851
|
+
if (ee)
|
|
852
|
+
t.removeAllRanges(), t.addRange(ee);
|
|
853
|
+
else {
|
|
854
|
+
const d = document.createRange();
|
|
855
|
+
d.selectNodeContents(o), d.collapse(!1), t.removeAllRanges(), t.addRange(d);
|
|
856
|
+
}
|
|
857
|
+
if (t.rangeCount === 0) return;
|
|
858
|
+
const i = t.getRangeAt(0), c = (M = o == null ? void 0 : o.innerHTML) != null ? M : "", u = document.createRange().createContextualFragment(Vt(n.html));
|
|
859
|
+
i.deleteContents(), i.insertNode(u);
|
|
860
|
+
const w = document.createRange();
|
|
861
|
+
w.setStartAfter(i.endContainer), w.collapse(!0), t.removeAllRanges(), t.addRange(w), o && (Wt(o, c), o.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
862
|
+
}
|
|
863
|
+
function $t(n) {
|
|
864
|
+
const t = rt();
|
|
865
|
+
if (t) {
|
|
866
|
+
const o = t.innerHTML;
|
|
867
|
+
t.innerHTML = Vt(n.html), Wt(t, o), t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
function W() {
|
|
871
|
+
Yt(), P !== null && (cancelAnimationFrame(P), P = null), F && (F.remove(), F = null), g = null, ee = null, ne = "", J = null;
|
|
872
|
+
}
|
|
873
|
+
function qn(n) {
|
|
874
|
+
const t = window.getSelection();
|
|
875
|
+
t && t.rangeCount > 0 ? ee = t.getRangeAt(0).cloneRange() : ee = null;
|
|
876
|
+
const o = ot();
|
|
877
|
+
o.length > 0 && !h && (h = o[0]);
|
|
878
|
+
const i = (n == null ? void 0 : n.contentElement) instanceof HTMLElement ? n.contentElement : nt();
|
|
879
|
+
J = i || null, zn(i);
|
|
880
|
+
}
|
|
881
|
+
function Xn() {
|
|
882
|
+
if (typeof document == "undefined") return;
|
|
883
|
+
const n = "template-plugin-dialog-styles";
|
|
884
|
+
if (document.getElementById(n)) return;
|
|
885
|
+
const t = document.createElement("style");
|
|
886
|
+
t.id = n, t.textContent = `
|
|
887
|
+
.rte-dialog-overlay {
|
|
888
|
+
--rte-tmpl-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
889
|
+
--rte-tmpl-dialog-bg: #fff;
|
|
890
|
+
--rte-tmpl-dialog-text: #101828;
|
|
891
|
+
--rte-tmpl-border: #d6dbe4;
|
|
892
|
+
--rte-tmpl-subtle-bg: #f7f9fc;
|
|
893
|
+
--rte-tmpl-subtle-hover: #eef2f7;
|
|
894
|
+
--rte-tmpl-muted-text: #5f6b7d;
|
|
895
|
+
--rte-tmpl-accent: #1976d2;
|
|
896
|
+
--rte-tmpl-accent-strong: #1565c0;
|
|
897
|
+
--rte-tmpl-ring: rgba(31, 117, 254, 0.18);
|
|
898
|
+
position: fixed;
|
|
899
|
+
top: 0;
|
|
900
|
+
left: 0;
|
|
901
|
+
right: 0;
|
|
902
|
+
bottom: 0;
|
|
903
|
+
background-color: var(--rte-tmpl-overlay-bg);
|
|
904
|
+
backdrop-filter: blur(2px);
|
|
905
|
+
display: flex;
|
|
906
|
+
align-items: center;
|
|
907
|
+
justify-content: center;
|
|
908
|
+
z-index: 10000;
|
|
909
|
+
padding: 16px;
|
|
910
|
+
box-sizing: border-box;
|
|
911
|
+
}
|
|
912
|
+
.rte-dialog-overlay.rte-ui-theme-dark {
|
|
913
|
+
--rte-tmpl-overlay-bg: rgba(2, 8, 20, 0.72);
|
|
914
|
+
--rte-tmpl-dialog-bg: #202938;
|
|
915
|
+
--rte-tmpl-dialog-text: #e8effc;
|
|
916
|
+
--rte-tmpl-border: #49566c;
|
|
917
|
+
--rte-tmpl-subtle-bg: #2a3444;
|
|
918
|
+
--rte-tmpl-subtle-hover: #344256;
|
|
919
|
+
--rte-tmpl-muted-text: #a5b1c5;
|
|
920
|
+
--rte-tmpl-accent: #58a6ff;
|
|
921
|
+
--rte-tmpl-accent-strong: #4598f4;
|
|
922
|
+
--rte-tmpl-ring: rgba(88, 166, 255, 0.22);
|
|
923
|
+
}
|
|
924
|
+
.rte-template-dialog {
|
|
925
|
+
background: var(--rte-tmpl-dialog-bg);
|
|
926
|
+
color: var(--rte-tmpl-dialog-text);
|
|
927
|
+
border: 1px solid var(--rte-tmpl-border);
|
|
928
|
+
border-radius: 12px;
|
|
929
|
+
box-shadow: 0 24px 48px rgba(10, 15, 24, 0.28);
|
|
930
|
+
width: 600px;
|
|
931
|
+
max-height: 700px;
|
|
932
|
+
display: flex;
|
|
933
|
+
flex-direction: column;
|
|
934
|
+
overflow: hidden;
|
|
935
|
+
}
|
|
936
|
+
.rte-dialog-header {
|
|
937
|
+
display: flex;
|
|
938
|
+
justify-content: space-between;
|
|
939
|
+
align-items: center;
|
|
940
|
+
padding: 16px 20px;
|
|
941
|
+
border-bottom: 1px solid var(--rte-tmpl-border);
|
|
942
|
+
background: linear-gradient(180deg, rgba(127, 154, 195, 0.08) 0%, rgba(127, 154, 195, 0) 100%);
|
|
943
|
+
}
|
|
944
|
+
.rte-dialog-header h2 {
|
|
945
|
+
margin: 0;
|
|
946
|
+
font-size: 18px;
|
|
947
|
+
font-weight: 600;
|
|
948
|
+
color: var(--rte-tmpl-dialog-text);
|
|
949
|
+
}
|
|
950
|
+
.rte-dialog-close {
|
|
951
|
+
background: none;
|
|
952
|
+
border: none;
|
|
953
|
+
font-size: 24px;
|
|
954
|
+
cursor: pointer;
|
|
955
|
+
color: var(--rte-tmpl-muted-text);
|
|
956
|
+
padding: 0;
|
|
957
|
+
width: 32px;
|
|
958
|
+
height: 32px;
|
|
959
|
+
display: flex;
|
|
960
|
+
align-items: center;
|
|
961
|
+
justify-content: center;
|
|
962
|
+
border-radius: 8px;
|
|
963
|
+
transition: background-color 0.16s ease, color 0.16s ease;
|
|
964
|
+
}
|
|
965
|
+
.rte-dialog-close:hover {
|
|
966
|
+
background-color: var(--rte-tmpl-subtle-hover);
|
|
967
|
+
color: var(--rte-tmpl-dialog-text);
|
|
968
|
+
}
|
|
969
|
+
.rte-dialog-body {
|
|
970
|
+
padding: 20px;
|
|
971
|
+
flex: 1;
|
|
972
|
+
overflow-y: auto;
|
|
973
|
+
}
|
|
974
|
+
.rte-input {
|
|
975
|
+
width: 100%;
|
|
976
|
+
padding: 8px 12px;
|
|
977
|
+
border: 1px solid var(--rte-tmpl-border);
|
|
978
|
+
border-radius: 4px;
|
|
979
|
+
font-size: 14px;
|
|
980
|
+
box-sizing: border-box;
|
|
981
|
+
background: var(--rte-tmpl-subtle-bg);
|
|
982
|
+
color: var(--rte-tmpl-dialog-text);
|
|
983
|
+
}
|
|
984
|
+
.rte-input:focus {
|
|
985
|
+
outline: none;
|
|
986
|
+
border-color: var(--rte-tmpl-accent);
|
|
987
|
+
}
|
|
988
|
+
.rte-tabs {
|
|
989
|
+
display: flex;
|
|
990
|
+
gap: 8px;
|
|
991
|
+
margin-top: 12px;
|
|
992
|
+
border-bottom: 1px solid var(--rte-tmpl-border);
|
|
993
|
+
padding-bottom: 8px;
|
|
994
|
+
}
|
|
995
|
+
.rte-tab {
|
|
996
|
+
padding: 6px 12px;
|
|
997
|
+
border: none;
|
|
998
|
+
background: none;
|
|
999
|
+
cursor: pointer;
|
|
1000
|
+
font-size: 14px;
|
|
1001
|
+
color: var(--rte-tmpl-muted-text);
|
|
1002
|
+
border-bottom: 2px solid transparent;
|
|
1003
|
+
transition: all 0.2s;
|
|
1004
|
+
}
|
|
1005
|
+
.rte-tab:hover {
|
|
1006
|
+
color: var(--rte-tmpl-dialog-text);
|
|
1007
|
+
}
|
|
1008
|
+
.rte-tab.active {
|
|
1009
|
+
color: var(--rte-tmpl-accent);
|
|
1010
|
+
border-bottom-color: var(--rte-tmpl-accent);
|
|
1011
|
+
font-weight: 600;
|
|
1012
|
+
}
|
|
1013
|
+
.rte-template-list {
|
|
1014
|
+
border: 1px solid var(--rte-tmpl-border);
|
|
1015
|
+
border-radius: 4px;
|
|
1016
|
+
max-height: 250px;
|
|
1017
|
+
overflow-y: auto;
|
|
1018
|
+
margin: 12px 0;
|
|
1019
|
+
background: var(--rte-tmpl-subtle-bg);
|
|
1020
|
+
}
|
|
1021
|
+
.rte-template-item {
|
|
1022
|
+
padding: 12px;
|
|
1023
|
+
border-bottom: 1px solid var(--rte-tmpl-border);
|
|
1024
|
+
cursor: pointer;
|
|
1025
|
+
transition: background-color 0.2s;
|
|
1026
|
+
background: none;
|
|
1027
|
+
}
|
|
1028
|
+
.rte-template-item:last-child {
|
|
1029
|
+
border-bottom: none;
|
|
1030
|
+
}
|
|
1031
|
+
.rte-template-item:hover,
|
|
1032
|
+
.rte-template-item.selected {
|
|
1033
|
+
background-color: var(--rte-tmpl-subtle-hover);
|
|
1034
|
+
}
|
|
1035
|
+
.template-name {
|
|
1036
|
+
font-weight: 600;
|
|
1037
|
+
color: var(--rte-tmpl-dialog-text);
|
|
1038
|
+
margin-bottom: 4px;
|
|
1039
|
+
}
|
|
1040
|
+
.template-description {
|
|
1041
|
+
font-size: 12px;
|
|
1042
|
+
color: var(--rte-tmpl-muted-text);
|
|
1043
|
+
}
|
|
1044
|
+
.rte-template-preview {
|
|
1045
|
+
padding: 12px;
|
|
1046
|
+
background-color: var(--rte-tmpl-subtle-bg);
|
|
1047
|
+
border: 1px solid var(--rte-tmpl-border);
|
|
1048
|
+
border-radius: 4px;
|
|
1049
|
+
margin-top: 12px;
|
|
1050
|
+
max-height: 200px;
|
|
1051
|
+
overflow-y: auto;
|
|
1052
|
+
}
|
|
1053
|
+
.template-preview-content {
|
|
1054
|
+
font-size: 13px;
|
|
1055
|
+
line-height: 1.5;
|
|
1056
|
+
margin-top: 8px;
|
|
1057
|
+
}
|
|
1058
|
+
.template-preview-content * {
|
|
1059
|
+
margin: 4px 0;
|
|
1060
|
+
}
|
|
1061
|
+
.rte-insert-mode {
|
|
1062
|
+
margin-top: 12px;
|
|
1063
|
+
padding: 12px;
|
|
1064
|
+
background-color: var(--rte-tmpl-subtle-bg);
|
|
1065
|
+
border-radius: 4px;
|
|
1066
|
+
display: flex;
|
|
1067
|
+
gap: 16px;
|
|
1068
|
+
}
|
|
1069
|
+
.rte-insert-mode label {
|
|
1070
|
+
display: flex;
|
|
1071
|
+
align-items: center;
|
|
1072
|
+
cursor: pointer;
|
|
1073
|
+
font-size: 14px;
|
|
1074
|
+
}
|
|
1075
|
+
.rte-insert-mode input {
|
|
1076
|
+
margin-right: 6px;
|
|
1077
|
+
cursor: pointer;
|
|
1078
|
+
}
|
|
1079
|
+
.rte-empty-state {
|
|
1080
|
+
padding: 40px;
|
|
1081
|
+
text-align: center;
|
|
1082
|
+
color: var(--rte-tmpl-muted-text);
|
|
1083
|
+
font-size: 14px;
|
|
1084
|
+
}
|
|
1085
|
+
.rte-dialog-footer {
|
|
1086
|
+
padding: 16px 20px;
|
|
1087
|
+
border-top: 1px solid var(--rte-tmpl-border);
|
|
1088
|
+
background: var(--rte-tmpl-subtle-bg);
|
|
1089
|
+
display: flex;
|
|
1090
|
+
justify-content: flex-end;
|
|
1091
|
+
gap: 12px;
|
|
1092
|
+
}
|
|
1093
|
+
.rte-button-primary {
|
|
1094
|
+
padding: 8px 16px;
|
|
1095
|
+
border: none;
|
|
1096
|
+
border-radius: 4px;
|
|
1097
|
+
font-size: 14px;
|
|
1098
|
+
cursor: pointer;
|
|
1099
|
+
background-color: var(--rte-tmpl-accent);
|
|
1100
|
+
color: white;
|
|
1101
|
+
transition: all 0.2s;
|
|
1102
|
+
}
|
|
1103
|
+
.rte-button-primary:hover:not([disabled]) {
|
|
1104
|
+
background-color: var(--rte-tmpl-accent-strong);
|
|
1105
|
+
}
|
|
1106
|
+
.rte-button-primary[disabled] {
|
|
1107
|
+
opacity: 0.5;
|
|
1108
|
+
cursor: not-allowed;
|
|
1109
|
+
}
|
|
1110
|
+
.rte-button-secondary {
|
|
1111
|
+
padding: 8px 16px;
|
|
1112
|
+
border: 1px solid var(--rte-tmpl-border);
|
|
1113
|
+
border-radius: 4px;
|
|
1114
|
+
font-size: 14px;
|
|
1115
|
+
cursor: pointer;
|
|
1116
|
+
background-color: var(--rte-tmpl-subtle-bg);
|
|
1117
|
+
color: var(--rte-tmpl-dialog-text);
|
|
1118
|
+
transition: all 0.2s;
|
|
1119
|
+
}
|
|
1120
|
+
.rte-button-secondary:hover {
|
|
1121
|
+
background-color: var(--rte-tmpl-subtle-hover);
|
|
1122
|
+
}
|
|
1123
|
+
`, document.head.appendChild(t);
|
|
1124
|
+
}
|
|
1125
|
+
const Jn = () => ({
|
|
1126
|
+
name: "template",
|
|
1127
|
+
toolbar: [
|
|
1128
|
+
{
|
|
1129
|
+
label: "Template",
|
|
1130
|
+
command: "insertTemplate",
|
|
1131
|
+
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>'
|
|
1132
|
+
}
|
|
1133
|
+
],
|
|
1134
|
+
commands: {
|
|
1135
|
+
insertTemplate: (n, t) => (qn(t), !0)
|
|
1136
|
+
},
|
|
1137
|
+
keymap: {}
|
|
1138
|
+
});
|
|
1139
|
+
export {
|
|
1140
|
+
Hn as PREDEFINED_TEMPLATES,
|
|
1141
|
+
Jn as TemplatePlugin,
|
|
1142
|
+
Kn as addCustomTemplate,
|
|
1143
|
+
Bt as getAllTemplates,
|
|
1144
|
+
jt as getTemplateCategories,
|
|
1145
|
+
Zn as getTemplatesByCategory,
|
|
1146
|
+
Vt as sanitizeTemplate,
|
|
1147
|
+
Un as searchTemplates,
|
|
1148
|
+
Qn as validateTemplate
|
|
1149
|
+
};
|
|
1150
|
+
//# sourceMappingURL=TemplatePlugin.native-DLjFUaPW.mjs.map
|