@editora/core 1.0.19 → 1.0.20
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/{A11yCheckerPlugin.native-DIKuCeFw.mjs → A11yCheckerPlugin.native-qW_njhLY.mjs} +2 -2
- package/dist/{AnchorPlugin.native-DXZdK3zr.mjs → AnchorPlugin.native-Drmxhy98.mjs} +37 -37
- package/dist/{BlockquotePlugin.native-57_Xcjl1.mjs → BlockquotePlugin.native-D8jjGd0c.mjs} +19 -19
- package/dist/{CapitalizationPlugin.native-C-HRbXGh.mjs → CapitalizationPlugin.native-Mh-kUy-x.mjs} +17 -17
- package/dist/{ChecklistPlugin.native-NVrBUkaL.mjs → ChecklistPlugin.native-DLedNLsb.mjs} +31 -31
- package/dist/{CollaborationPlugin.native-oSybCGPW.mjs → CollaborationPlugin.native-Bl3R9CRI.mjs} +1406 -1295
- package/dist/{CommentsPlugin.native-CLip9wAO.mjs → CommentsPlugin.native-DncTHiEe.mjs} +2 -2
- package/dist/{DirectionPlugin.native-Bl-QLFzO.mjs → DirectionPlugin.native-B-Zj-EAt.mjs} +33 -33
- package/dist/{FontFamilyPlugin.native-M3cNQ0KA.mjs → FontFamilyPlugin.native-DLq9x046.mjs} +32 -32
- package/dist/{PreviewPlugin.native-Dyht8mGi.mjs → PreviewPlugin.native-Dv5OsffK.mjs} +4 -4
- package/dist/{SpellCheckPlugin.native-Bef2oTLB.mjs → SpellCheckPlugin.native-BGm2qPfn.mjs} +20 -20
- package/dist/{TemplatePlugin.native-BDV2eik2.mjs → TemplatePlugin.native-Dwk8TgxI.mjs} +32 -32
- package/dist/editora.min.js +2 -2
- package/dist/editora.umd.js +4 -4
- package/dist/{index-DeUjxpKd.mjs → index-BxlbmLsp.mjs} +135 -132
- package/dist/{index-CclXYzUB.js → index-Cdy6TOCy.js} +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/plugin-loader.js +11 -11
- package/dist/webcomponent-core.js +152 -149
- package/dist/webcomponent-core.min.js +16 -16
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +32 -29
- package/dist/webcomponent.min.js +210 -210
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { i as
|
|
3
|
-
import { p as
|
|
1
|
+
import { e as z } from "./escapeHtml-CX8RelZ1.mjs";
|
|
2
|
+
import { i as F } from "./dialogHelpers-DBf7WqYH.mjs";
|
|
3
|
+
import { p as I } from "./purify.es-BHa5gZB7.mjs";
|
|
4
4
|
let n = null, d = null, f = null, o = null, h = "", v = "", T = "insert", E = null, c = null, b = null;
|
|
5
5
|
function M(t, e) {
|
|
6
6
|
if (e === t.innerHTML) return;
|
|
@@ -11,7 +11,7 @@ function M(t, e) {
|
|
|
11
11
|
} catch (a) {
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function V(t) {
|
|
15
15
|
if (!t) return null;
|
|
16
16
|
let e = t.startContainer;
|
|
17
17
|
for (; e && e !== document.body; ) {
|
|
@@ -24,7 +24,7 @@ function F(t) {
|
|
|
24
24
|
}
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const _ = [
|
|
28
28
|
{
|
|
29
29
|
id: "formal-letter",
|
|
30
30
|
name: "Formal Letter",
|
|
@@ -95,7 +95,7 @@ const I = [
|
|
|
95
95
|
<h3>Q: What are the requirements?</h3>
|
|
96
96
|
<p>A: [Answer here]</p>`
|
|
97
97
|
}
|
|
98
|
-
], x = [...
|
|
98
|
+
], x = [..._], N = () => x, oe = (t) => x.filter((e) => e.category === t), R = () => {
|
|
99
99
|
const t = new Set(x.map((e) => e.category));
|
|
100
100
|
return Array.from(t);
|
|
101
101
|
}, O = (t) => {
|
|
@@ -106,21 +106,21 @@ const I = [
|
|
|
106
106
|
return r.name.toLowerCase().includes(e) || ((a = r.description) == null ? void 0 : a.toLowerCase().includes(e)) || ((m = r.tags) == null ? void 0 : m.some((s) => s.toLowerCase().includes(e)));
|
|
107
107
|
}
|
|
108
108
|
);
|
|
109
|
-
},
|
|
109
|
+
}, $ = (t) => I.sanitize(t, {
|
|
110
110
|
ALLOWED_TAGS: ["p", "br", "strong", "em", "u", "h1", "h2", "h3", "h4", "ul", "ol", "li", "blockquote", "table", "thead", "tbody", "tr", "th", "td", "a", "span"],
|
|
111
111
|
ALLOWED_ATTR: ["href", "target", "class", "data-key", "data-category"]
|
|
112
112
|
}), ae = (t) => x.some((e) => e.id === t.id) ? (console.warn(`Template with ID ${t.id} already exists`), !1) : (x.push(t), !0), le = (t) => !!(t.id && t.name && t.category && t.html && t.html.trim().length > 0);
|
|
113
113
|
function Q(t) {
|
|
114
|
-
d && u(), d = document.createElement("div"),
|
|
115
|
-
const e =
|
|
114
|
+
d && u(), d = document.createElement("div"), F(d), d.className = "rte-dialog-overlay", Z(t) && d.classList.add("rte-ui-theme-dark"), d.addEventListener("click", () => u()), n = document.createElement("div"), n.className = "rte-dialog rte-template-dialog", n.addEventListener("click", (r) => r.stopPropagation());
|
|
115
|
+
const e = R();
|
|
116
116
|
e.length > 0 && !h && (h = e[0]), k(), d.appendChild(n), document.body.appendChild(d), B(), ee();
|
|
117
117
|
}
|
|
118
118
|
function B() {
|
|
119
|
-
|
|
119
|
+
j(), E = (t) => {
|
|
120
120
|
t.key === "Escape" && (!d || !n || (t.preventDefault(), t.stopPropagation(), u()));
|
|
121
121
|
}, document.addEventListener("keydown", E, !0);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function j() {
|
|
124
124
|
E && (document.removeEventListener("keydown", E, !0), E = null);
|
|
125
125
|
}
|
|
126
126
|
const W = '[data-theme="dark"], .dark, .editora-theme-dark', C = () => {
|
|
@@ -135,7 +135,7 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', C = () => {
|
|
|
135
135
|
return e ? !!e.closest(W) : !1;
|
|
136
136
|
};
|
|
137
137
|
function A() {
|
|
138
|
-
const t =
|
|
138
|
+
const t = V(f);
|
|
139
139
|
if (t) return t;
|
|
140
140
|
if (b != null && b.isConnected) return b;
|
|
141
141
|
const e = C();
|
|
@@ -143,7 +143,7 @@ function A() {
|
|
|
143
143
|
}
|
|
144
144
|
function k() {
|
|
145
145
|
if (!n) return;
|
|
146
|
-
const t =
|
|
146
|
+
const t = R(), e = H();
|
|
147
147
|
n.innerHTML = `
|
|
148
148
|
<div class="rte-dialog-header">
|
|
149
149
|
<h2>Insert Template</h2>
|
|
@@ -155,7 +155,7 @@ function k() {
|
|
|
155
155
|
<input
|
|
156
156
|
type="text"
|
|
157
157
|
placeholder="Search templates..."
|
|
158
|
-
value="${
|
|
158
|
+
value="${z(v)}"
|
|
159
159
|
class="rte-input rte-template-search"
|
|
160
160
|
aria-label="Search templates"
|
|
161
161
|
/>
|
|
@@ -209,9 +209,9 @@ function k() {
|
|
|
209
209
|
${T === "insert" ? "Insert" : "Replace"}
|
|
210
210
|
</button>
|
|
211
211
|
</div>
|
|
212
|
-
`,
|
|
212
|
+
`, G();
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function K() {
|
|
215
215
|
if (!n) return;
|
|
216
216
|
n.innerHTML = `
|
|
217
217
|
<div class="rte-dialog-header">
|
|
@@ -229,10 +229,10 @@ function G() {
|
|
|
229
229
|
t == null || t.addEventListener("click", () => k()), e == null || e.addEventListener("click", () => Y());
|
|
230
230
|
}
|
|
231
231
|
function H() {
|
|
232
|
-
const t =
|
|
232
|
+
const t = N();
|
|
233
233
|
return v.trim() ? O(v) : h ? t.filter((e) => e.category === h) : t;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function G() {
|
|
236
236
|
if (!n) return;
|
|
237
237
|
const t = n.querySelector(".rte-dialog-close");
|
|
238
238
|
t == null || t.addEventListener("click", () => u());
|
|
@@ -259,7 +259,7 @@ function K() {
|
|
|
259
259
|
const p = l.target.closest(".rte-template-item");
|
|
260
260
|
if (!p) return null;
|
|
261
261
|
const w = p.getAttribute("data-template-id");
|
|
262
|
-
return w &&
|
|
262
|
+
return w && N().find((P) => P.id === w) || null;
|
|
263
263
|
};
|
|
264
264
|
s == null || s.addEventListener("click", (l) => {
|
|
265
265
|
const i = y(l);
|
|
@@ -284,15 +284,15 @@ function L() {
|
|
|
284
284
|
if (T === "replace") {
|
|
285
285
|
const e = A();
|
|
286
286
|
if ((t = e == null ? void 0 : e.innerHTML) != null && t.trim()) {
|
|
287
|
-
|
|
287
|
+
K();
|
|
288
288
|
return;
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
q(o), u();
|
|
291
291
|
} else
|
|
292
292
|
J(o), u();
|
|
293
293
|
}
|
|
294
294
|
function Y() {
|
|
295
|
-
o && (
|
|
295
|
+
o && (q(o), u());
|
|
296
296
|
}
|
|
297
297
|
const U = /* @__PURE__ */ new Set([
|
|
298
298
|
"DIV",
|
|
@@ -331,22 +331,22 @@ function J(t) {
|
|
|
331
331
|
p.selectNodeContents(r), p.collapse(!1), e.removeAllRanges(), e.addRange(p);
|
|
332
332
|
}
|
|
333
333
|
if (e.rangeCount === 0) return;
|
|
334
|
-
const a = e.getRangeAt(0), m = (i = r == null ? void 0 : r.innerHTML) != null ? i : "", s = document.createRange().createContextualFragment(
|
|
334
|
+
const a = e.getRangeAt(0), m = (i = r == null ? void 0 : r.innerHTML) != null ? i : "", s = document.createRange().createContextualFragment($(t.html));
|
|
335
335
|
a.deleteContents();
|
|
336
336
|
const y = s.lastChild, g = D(a.endContainer, r) || D(a.startContainer, r);
|
|
337
337
|
g && g.parentNode ? g.parentNode.insertBefore(s, g.nextSibling) : a.insertNode(s);
|
|
338
338
|
const l = document.createRange();
|
|
339
339
|
y ? l.setStartAfter(y) : l.setStartAfter(a.endContainer), l.collapse(!0), e.removeAllRanges(), e.addRange(l), r && (M(r, m), r.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function q(t) {
|
|
342
342
|
const e = A();
|
|
343
343
|
if (e) {
|
|
344
344
|
const r = e.innerHTML;
|
|
345
|
-
e.innerHTML =
|
|
345
|
+
e.innerHTML = $(t.html), M(e, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
function u() {
|
|
349
|
-
|
|
349
|
+
j(), c !== null && (cancelAnimationFrame(c), c = null), d && (d.remove(), d = null), n = null, f = null, v = "", b = null;
|
|
350
350
|
}
|
|
351
351
|
function X(t) {
|
|
352
352
|
const e = window.getSelection();
|
|
@@ -606,7 +606,7 @@ const ie = () => ({
|
|
|
606
606
|
{
|
|
607
607
|
label: "Template",
|
|
608
608
|
command: "insertTemplate",
|
|
609
|
-
icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g
|
|
609
|
+
icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <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>'
|
|
610
610
|
}
|
|
611
611
|
],
|
|
612
612
|
commands: {
|
|
@@ -615,14 +615,14 @@ const ie = () => ({
|
|
|
615
615
|
keymap: {}
|
|
616
616
|
});
|
|
617
617
|
export {
|
|
618
|
-
|
|
618
|
+
_ as PREDEFINED_TEMPLATES,
|
|
619
619
|
ie as TemplatePlugin,
|
|
620
620
|
ae as addCustomTemplate,
|
|
621
|
-
|
|
622
|
-
|
|
621
|
+
N as getAllTemplates,
|
|
622
|
+
R as getTemplateCategories,
|
|
623
623
|
oe as getTemplatesByCategory,
|
|
624
|
-
|
|
624
|
+
$ as sanitizeTemplate,
|
|
625
625
|
O as searchTemplates,
|
|
626
626
|
le as validateTemplate
|
|
627
627
|
};
|
|
628
|
-
//# sourceMappingURL=TemplatePlugin.native-
|
|
628
|
+
//# sourceMappingURL=TemplatePlugin.native-Dwk8TgxI.mjs.map
|