@editora/core 1.0.18 → 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/{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/{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/{DocumentManagerPlugin.native-iFip6s4Q.mjs → DocumentManagerPlugin.native-B8K-Oqom.mjs} +12 -11
- package/dist/{FontFamilyPlugin.native-M3cNQ0KA.mjs → FontFamilyPlugin.native-DLq9x046.mjs} +32 -32
- package/dist/{PreviewPlugin.native-CiR51jql.mjs → PreviewPlugin.native-Dv5OsffK.mjs} +49 -52
- package/dist/{SpellCheckPlugin.native-Bef2oTLB.mjs → SpellCheckPlugin.native-BGm2qPfn.mjs} +20 -20
- package/dist/{TablePlugin.native-BjIxYZ2X.mjs → TablePlugin.native-C1YZ372P.mjs} +156 -147
- package/dist/TemplatePlugin.native-Dwk8TgxI.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 +17 -17
- package/dist/{index-XsYC_KdJ.mjs → index-BxlbmLsp.mjs} +428 -405
- package/dist/index-Cdy6TOCy.js +12 -0
- package/dist/index.cjs.js +4 -4
- package/dist/index.esm.js +19 -16
- package/dist/plugin-loader.js +13 -13
- package/dist/purify.es-BHa5gZB7.mjs +1481 -0
- package/dist/sanitizeHtml-DA0ajC6k.mjs +17 -0
- package/dist/webcomponent-core.js +466 -449
- 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 +397 -380
- 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
|
@@ -743,7 +743,7 @@ const oe = () => ({
|
|
|
743
743
|
// - any other icon reusing the same auto-generated class name would
|
|
744
744
|
// collide with it. Inlined the one declaration it held (fill="none")
|
|
745
745
|
// directly on the rect instead, so there's nothing to leak.
|
|
746
|
-
icon: '<svg fill="#000000" width="24px" height="24px" viewBox="0 0 32 32"
|
|
746
|
+
icon: '<svg fill="#000000" width="24px" height="24px" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><title>add-comment</title><path d="M17.74,30,16,29l4-7h6a2,2,0,0,0,2-2V8a2,2,0,0,0-2-2H6A2,2,0,0,0,4,8V20a2,2,0,0,0,2,2h9v2H6a4,4,0,0,1-4-4V8A4,4,0,0,1,6,4H26a4,4,0,0,1,4,4V20a4,4,0,0,1-4,4H21.16Z"></path><polygon points="17 9 15 9 15 13 11 13 11 15 15 15 15 19 17 19 17 15 21 15 21 13 17 13 17 9"></polygon><rect fill="none" width="32" height="32"></rect></svg>'
|
|
747
747
|
},
|
|
748
748
|
{
|
|
749
749
|
label: "Show / Hide Comments",
|
|
@@ -786,4 +786,4 @@ export {
|
|
|
786
786
|
Q as replyToComment,
|
|
787
787
|
X as resolveComment
|
|
788
788
|
};
|
|
789
|
-
//# sourceMappingURL=CommentsPlugin.native-
|
|
789
|
+
//# sourceMappingURL=CommentsPlugin.native-DncTHiEe.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const l = '.rte-content, .editora-content, [contenteditable="true"]',
|
|
1
|
+
const l = '.rte-content, .editora-content, [contenteditable="true"]', g = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", L = /* @__PURE__ */ new Set([
|
|
2
2
|
"P",
|
|
3
3
|
"DIV",
|
|
4
4
|
"H1",
|
|
@@ -14,26 +14,26 @@ const l = '.rte-content, .editora-content, [contenteditable="true"]', C = "[data
|
|
|
14
14
|
"FIGURE",
|
|
15
15
|
"UL",
|
|
16
16
|
"OL"
|
|
17
|
-
]), d = (e) =>
|
|
17
|
+
]), d = (e) => L.has(e.tagName) && e.getAttribute("contenteditable") !== "true", T = (e) => e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null, C = (e) => {
|
|
18
18
|
const n = e == null ? void 0 : e.contentElement;
|
|
19
19
|
if (n instanceof HTMLElement) return n;
|
|
20
20
|
const t = e == null ? void 0 : e.editorElement;
|
|
21
21
|
if (t instanceof HTMLElement) {
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
22
|
+
const o = t.querySelector(l);
|
|
23
|
+
if (o instanceof HTMLElement) return o;
|
|
24
24
|
if (t.getAttribute("contenteditable") === "true") return t;
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
if (
|
|
26
|
+
const r = window.__editoraCommandEditorRoot;
|
|
27
|
+
if (r instanceof HTMLElement) {
|
|
28
|
+
const o = r.querySelector(l);
|
|
29
|
+
if (o instanceof HTMLElement) return o;
|
|
30
|
+
if (r.getAttribute("contenteditable") === "true") return r;
|
|
31
31
|
}
|
|
32
32
|
const i = window.getSelection();
|
|
33
33
|
if (i && i.rangeCount > 0) {
|
|
34
|
-
const
|
|
34
|
+
const o = T(i.getRangeAt(0).startContainer), c = o == null ? void 0 : o.closest(l);
|
|
35
35
|
if (c instanceof HTMLElement) return c;
|
|
36
|
-
const f =
|
|
36
|
+
const f = o == null ? void 0 : o.closest(g), E = f == null ? void 0 : f.querySelector(l);
|
|
37
37
|
if (E instanceof HTMLElement) return E;
|
|
38
38
|
}
|
|
39
39
|
const a = document.activeElement, s = a instanceof HTMLElement ? a.closest(l) : null;
|
|
@@ -53,20 +53,20 @@ const l = '.rte-content, .editora-content, [contenteditable="true"]', C = "[data
|
|
|
53
53
|
}, u = (e, n) => {
|
|
54
54
|
const t = w(e, n);
|
|
55
55
|
if (!t || t === e) return null;
|
|
56
|
-
const
|
|
57
|
-
return
|
|
56
|
+
const r = t.closest("li");
|
|
57
|
+
return r instanceof HTMLElement && e.contains(r) ? r : t;
|
|
58
58
|
}, R = (e, n) => {
|
|
59
59
|
if (typeof e.intersectsNode == "function")
|
|
60
60
|
try {
|
|
61
61
|
return e.intersectsNode(n);
|
|
62
|
-
} catch (
|
|
62
|
+
} catch (r) {
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
65
|
const t = document.createRange();
|
|
66
66
|
return t.selectNode(n), e.compareBoundaryPoints(Range.END_TO_START, t) < 0 && e.compareBoundaryPoints(Range.START_TO_END, t) > 0;
|
|
67
67
|
}, p = (e, n) => {
|
|
68
|
-
const t = [],
|
|
69
|
-
!
|
|
68
|
+
const t = [], r = /* @__PURE__ */ new Set(), i = (o) => {
|
|
69
|
+
!o || r.has(o) || o === n || !n.contains(o) || d(o) && (r.add(o), t.push(o));
|
|
70
70
|
};
|
|
71
71
|
if (e.collapsed)
|
|
72
72
|
return i(u(n, e.startContainer)), t;
|
|
@@ -75,8 +75,8 @@ const l = '.rte-content, .editora-content, [contenteditable="true"]', C = "[data
|
|
|
75
75
|
n,
|
|
76
76
|
NodeFilter.SHOW_ELEMENT,
|
|
77
77
|
{
|
|
78
|
-
acceptNode: (
|
|
79
|
-
const c =
|
|
78
|
+
acceptNode: (o) => {
|
|
79
|
+
const c = o;
|
|
80
80
|
return !d(c) || c.closest("li") && c.tagName !== "LI" ? NodeFilter.FILTER_SKIP : R(e, c) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -84,8 +84,8 @@ const l = '.rte-content, .editora-content, [contenteditable="true"]', C = "[data
|
|
|
84
84
|
let s = a.nextNode();
|
|
85
85
|
for (; s; )
|
|
86
86
|
i(s), s = a.nextNode();
|
|
87
|
-
return t.length === 0 && i(u(n, e.commonAncestorContainer)), t.filter((
|
|
88
|
-
},
|
|
87
|
+
return t.length === 0 && i(u(n, e.commonAncestorContainer)), t.filter((o) => !t.some((c) => c !== o && o.contains(c)));
|
|
88
|
+
}, M = (e, n, t) => {
|
|
89
89
|
if (n !== t) {
|
|
90
90
|
if (typeof window.execEditorCommand == "function") {
|
|
91
91
|
window.execEditorCommand("recordDomTransaction", e, n, t);
|
|
@@ -94,35 +94,35 @@ const l = '.rte-content, .editora-content, [contenteditable="true"]', C = "[data
|
|
|
94
94
|
if (typeof window.executeEditorCommand == "function")
|
|
95
95
|
try {
|
|
96
96
|
window.executeEditorCommand("recordDomTransaction", { editor: e, beforeHTML: n, afterHTML: t });
|
|
97
|
-
} catch (
|
|
97
|
+
} catch (r) {
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
}, m = (e, n) => {
|
|
101
|
-
const t =
|
|
101
|
+
const t = C(n);
|
|
102
102
|
if (!t) return !1;
|
|
103
|
-
const
|
|
104
|
-
if (!
|
|
105
|
-
const i = p(
|
|
103
|
+
const r = h(t);
|
|
104
|
+
if (!r) return !1;
|
|
105
|
+
const i = p(r, t);
|
|
106
106
|
if (i.length === 0) return !1;
|
|
107
107
|
const a = t.innerHTML;
|
|
108
|
-
i.forEach((
|
|
109
|
-
|
|
108
|
+
i.forEach((o) => {
|
|
109
|
+
o.setAttribute("dir", e);
|
|
110
110
|
});
|
|
111
111
|
const s = t.innerHTML;
|
|
112
|
-
return a === s ? !1 : (
|
|
113
|
-
},
|
|
112
|
+
return a === s ? !1 : (M(t, a, s), t.dispatchEvent(new window.Event("input", { bubbles: !0 })), !0);
|
|
113
|
+
}, k = () => ({
|
|
114
114
|
name: "direction",
|
|
115
115
|
toolbar: [
|
|
116
116
|
{
|
|
117
117
|
label: "Left to Right",
|
|
118
118
|
command: "setDirectionLTR",
|
|
119
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g
|
|
119
|
+
icon: '<svg width="24" height="24" 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 d="M21 18H3M21 18L18 21M21 18L18 15M13 3V12M13 3H7M13 3C13.4596 3 13.9148 3.0776 14.3394 3.22836C14.764 3.37913 15.1499 3.6001 15.4749 3.87868C15.7999 4.15726 16.0577 4.48797 16.2336 4.85195C16.4095 5.21593 16.5 5.60603 16.5 6C16.5 6.39397 16.4095 6.78407 16.2336 7.14805C16.0577 7.51203 15.7999 7.84274 15.4749 8.12132C15.1499 8.3999 14.764 8.62087 14.3394 8.77164C13.9148 8.9224 13.4596 9 13 9V3ZM9 3V12" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',
|
|
120
120
|
shortcut: "Mod-Shift-l"
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
123
|
label: "Right to Left",
|
|
124
124
|
command: "setDirectionRTL",
|
|
125
|
-
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g
|
|
125
|
+
icon: '<svg width="24" height="24" 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 d="M3 18H21M3 18L6 21M3 18L6 15M11 12V3H17M15 3V12M10.5 3C10.0404 3 9.58525 3.0776 9.16061 3.22836C8.73597 3.37913 8.35013 3.6001 8.02513 3.87868C7.70012 4.15726 7.44231 4.48797 7.26642 4.85195C7.09053 5.21593 7 5.60603 7 6C7 6.39397 7.09053 6.78407 7.26642 7.14805C7.44231 7.51203 7.70012 7.84274 8.02513 8.12132C8.35013 8.3999 8.73597 8.62087 9.16061 8.77164C9.58525 8.9224 10.0404 9 10.5 9L10.5 3Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',
|
|
126
126
|
shortcut: "Mod-Shift-r"
|
|
127
127
|
}
|
|
128
128
|
],
|
|
@@ -148,6 +148,6 @@ const l = '.rte-content, .editora-content, [contenteditable="true"]', C = "[data
|
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
export {
|
|
151
|
-
|
|
151
|
+
k as DirectionPlugin
|
|
152
152
|
};
|
|
153
|
-
//# sourceMappingURL=DirectionPlugin.native-
|
|
153
|
+
//# sourceMappingURL=DirectionPlugin.native-B-Zj-EAt.mjs.map
|
package/dist/{DocumentManagerPlugin.native-iFip6s4Q.mjs → DocumentManagerPlugin.native-B8K-Oqom.mjs}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { s as u } from "./sanitizeHtml-DA0ajC6k.mjs";
|
|
2
|
+
const d = "rte-document-manager-styles", s = `
|
|
2
3
|
.rte-toolbar-button[data-busy="true"],
|
|
3
4
|
.rte-docmgr-toolbar-button[data-busy="true"] {
|
|
4
5
|
position: relative;
|
|
@@ -28,13 +29,13 @@ const d = "rte-document-manager-styles", u = `
|
|
|
28
29
|
to { transform: rotate(360deg); }
|
|
29
30
|
}
|
|
30
31
|
`;
|
|
31
|
-
function
|
|
32
|
+
function p() {
|
|
32
33
|
if (typeof document == "undefined" || document.getElementById(d)) return;
|
|
33
34
|
const a = document.createElement("style");
|
|
34
|
-
a.id = d, a.textContent =
|
|
35
|
+
a.id = d, a.textContent = s, document.head.appendChild(a);
|
|
35
36
|
}
|
|
36
37
|
async function l(a) {
|
|
37
|
-
|
|
38
|
+
p();
|
|
38
39
|
const t = typeof window != "undefined" ? window.__editoraLastCommandButton : null;
|
|
39
40
|
t && (t.disabled = !0, t.setAttribute("data-busy", "true"), t.setAttribute("aria-busy", "true"));
|
|
40
41
|
try {
|
|
@@ -43,7 +44,7 @@ async function l(a) {
|
|
|
43
44
|
t && (t.disabled = !1, t.removeAttribute("data-busy"), t.removeAttribute("aria-busy"));
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
const
|
|
47
|
+
const m = () => ({
|
|
47
48
|
name: "document-manager",
|
|
48
49
|
toolbar: [
|
|
49
50
|
{
|
|
@@ -93,8 +94,8 @@ const p = () => ({
|
|
|
93
94
|
try {
|
|
94
95
|
const n = a();
|
|
95
96
|
if (n) {
|
|
96
|
-
const { importFromWord: i } = await import("./documentManager-
|
|
97
|
-
n.innerHTML = c, n.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
97
|
+
const { importFromWord: i } = await import("./documentManager-BWK_-KJp.mjs"), c = await i(r);
|
|
98
|
+
n.innerHTML = u(c), n.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
98
99
|
}
|
|
99
100
|
} catch (n) {
|
|
100
101
|
console.error("Import failed:", n), alert("Failed to import Word document. Please check the console for details.");
|
|
@@ -119,7 +120,7 @@ const p = () => ({
|
|
|
119
120
|
try {
|
|
120
121
|
const t = a();
|
|
121
122
|
if (t) {
|
|
122
|
-
const e = t.innerHTML, { exportToWord: r } = await import("./documentManager-
|
|
123
|
+
const e = t.innerHTML, { exportToWord: r } = await import("./documentManager-BWK_-KJp.mjs");
|
|
123
124
|
await r(e, "document.docx");
|
|
124
125
|
}
|
|
125
126
|
return !0;
|
|
@@ -146,7 +147,7 @@ const p = () => ({
|
|
|
146
147
|
try {
|
|
147
148
|
const t = a();
|
|
148
149
|
if (t) {
|
|
149
|
-
const e = t.innerHTML, { exportToPdf: r } = await import("./documentManager-
|
|
150
|
+
const e = t.innerHTML, { exportToPdf: r } = await import("./documentManager-BWK_-KJp.mjs");
|
|
150
151
|
await r(e, "document.pdf", t);
|
|
151
152
|
} else
|
|
152
153
|
console.error("PDF Export: No editor element found"), alert("No active editor found. Please click in the editor area first.");
|
|
@@ -160,6 +161,6 @@ const p = () => ({
|
|
|
160
161
|
keymap: {}
|
|
161
162
|
});
|
|
162
163
|
export {
|
|
163
|
-
|
|
164
|
+
m as DocumentManagerPlugin
|
|
164
165
|
};
|
|
165
|
-
//# sourceMappingURL=DocumentManagerPlugin.native-
|
|
166
|
+
//# sourceMappingURL=DocumentManagerPlugin.native-B8K-Oqom.mjs.map
|
|
@@ -43,7 +43,7 @@ const R = () => ({
|
|
|
43
43
|
{ label: "Trebuchet MS", value: "Trebuchet MS, sans-serif" },
|
|
44
44
|
{ label: "Impact", value: "Impact, sans-serif" }
|
|
45
45
|
],
|
|
46
|
-
icon: '<svg fill="#000000" width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g
|
|
46
|
+
icon: '<svg fill="#000000" width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g><path d="M15 4h7v2h-7zm1 4h6v2h-6zm2 4h4v2h-4zM9.307 4l-6 16h2.137l1.875-5h6.363l1.875 5h2.137l-6-16H9.307zm-1.239 9L10.5 6.515 12.932 13H8.068z"></path></g></svg>'
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
49
|
commands: {
|
|
@@ -70,17 +70,17 @@ function m(e) {
|
|
|
70
70
|
function f(e) {
|
|
71
71
|
e && e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
var
|
|
73
|
+
function A(e, t) {
|
|
74
|
+
var a;
|
|
75
75
|
const n = document.createElement("span");
|
|
76
76
|
for (const l of Array.from(e.attributes))
|
|
77
77
|
l.name === "face" || l.name === "style" || n.setAttribute(l.name, l.value);
|
|
78
78
|
const o = e.getAttribute("style");
|
|
79
79
|
for (o && n.setAttribute("style", o), n.style.fontFamily = t, n.classList.add("rte-font-family"); e.firstChild; )
|
|
80
80
|
n.appendChild(e.firstChild);
|
|
81
|
-
(
|
|
81
|
+
(a = e.parentNode) == null || a.replaceChild(n, e);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function S(e) {
|
|
84
84
|
e.querySelectorAll("span").forEach((n) => {
|
|
85
85
|
n.childElementCount > 0 || (n.textContent || "").trim().length > 0 || n.remove();
|
|
86
86
|
});
|
|
@@ -93,11 +93,11 @@ function C(e, t, n) {
|
|
|
93
93
|
try {
|
|
94
94
|
e.surroundContents(o);
|
|
95
95
|
} catch (l) {
|
|
96
|
-
const
|
|
97
|
-
o.appendChild(
|
|
96
|
+
const s = e.extractContents();
|
|
97
|
+
o.appendChild(s), e.insertNode(o);
|
|
98
98
|
}
|
|
99
|
-
const
|
|
100
|
-
return
|
|
99
|
+
const a = document.createRange();
|
|
100
|
+
return a.selectNodeContents(o), t.removeAllRanges(), t.addRange(a), !0;
|
|
101
101
|
}
|
|
102
102
|
function F(e) {
|
|
103
103
|
const t = window.getSelection();
|
|
@@ -108,40 +108,40 @@ function F(e) {
|
|
|
108
108
|
function b(e) {
|
|
109
109
|
const t = window.getSelection();
|
|
110
110
|
if (!t || t.rangeCount === 0) return;
|
|
111
|
-
const n = t.getRangeAt(0), o = n.cloneRange(),
|
|
111
|
+
const n = t.getRangeAt(0), o = n.cloneRange(), a = m(n.commonAncestorContainer);
|
|
112
112
|
if (n.collapsed)
|
|
113
113
|
return;
|
|
114
|
-
const l = n.commonAncestorContainer,
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
114
|
+
const l = n.commonAncestorContainer, s = v(l);
|
|
115
|
+
if (s && N(n, s)) {
|
|
116
|
+
s.style.fontFamily = e, s.classList.add("rte-font-family");
|
|
117
|
+
const r = document.createRange();
|
|
118
|
+
r.selectNodeContents(s), t.removeAllRanges(), t.addRange(r), f(a);
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
if (!
|
|
121
|
+
if (!a) return;
|
|
122
122
|
const u = new Set(
|
|
123
|
-
Array.from(
|
|
123
|
+
Array.from(a.querySelectorAll("font[face]"))
|
|
124
124
|
), d = new Set(
|
|
125
125
|
Array.from(
|
|
126
|
-
|
|
126
|
+
a.querySelectorAll("span[style*='font-family']")
|
|
127
127
|
)
|
|
128
128
|
);
|
|
129
|
-
|
|
129
|
+
a.focus({ preventScroll: !0 });
|
|
130
130
|
try {
|
|
131
131
|
document.execCommand("styleWithCSS", !1, "true");
|
|
132
|
-
} catch (
|
|
132
|
+
} catch (r) {
|
|
133
133
|
}
|
|
134
|
-
const y = e.split(",").map((
|
|
135
|
-
let
|
|
134
|
+
const y = e.split(",").map((r) => r.trim().replace(/^['"]|['"]$/g, "")).filter(Boolean)[0] || "Arial";
|
|
135
|
+
let i = document.execCommand("fontName", !1, y), c = !1;
|
|
136
136
|
Array.from(
|
|
137
|
-
|
|
138
|
-
).forEach((
|
|
139
|
-
u.has(
|
|
137
|
+
a.querySelectorAll("font[face]")
|
|
138
|
+
).forEach((r) => {
|
|
139
|
+
u.has(r) || (A(r, e), c = !0);
|
|
140
140
|
}), Array.from(
|
|
141
|
-
|
|
142
|
-
).forEach((
|
|
143
|
-
d.has(
|
|
144
|
-
}),
|
|
141
|
+
a.querySelectorAll("span[style*='font-family']")
|
|
142
|
+
).forEach((r) => {
|
|
143
|
+
d.has(r) || (r.style.fontFamily = e, r.classList.add("rte-font-family"), c = !0);
|
|
144
|
+
}), i || (i = C(o, t, e)), (i || c) && (S(a), f(a));
|
|
145
145
|
}
|
|
146
146
|
function v(e) {
|
|
147
147
|
let t = e;
|
|
@@ -156,10 +156,10 @@ function v(e) {
|
|
|
156
156
|
return null;
|
|
157
157
|
}
|
|
158
158
|
function N(e, t) {
|
|
159
|
-
const n = e.startContainer, o = e.endContainer,
|
|
160
|
-
return
|
|
159
|
+
const n = e.startContainer, o = e.endContainer, a = t.contains(n) || n.nodeType === Node.TEXT_NODE && n.parentElement === t, l = t.contains(o) || o.nodeType === Node.TEXT_NODE && o.parentElement === t;
|
|
160
|
+
return a && l;
|
|
161
161
|
}
|
|
162
162
|
export {
|
|
163
163
|
R as FontFamilyPlugin
|
|
164
164
|
};
|
|
165
|
-
//# sourceMappingURL=FontFamilyPlugin.native-
|
|
165
|
+
//# sourceMappingURL=FontFamilyPlugin.native-DLq9x046.mjs.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { i as h } from "./dialogHelpers-DBf7WqYH.mjs";
|
|
2
|
+
import { s as v } from "./sanitizeHtml-DA0ajC6k.mjs";
|
|
3
|
+
let l = !1, d = null;
|
|
4
|
+
const w = () => {
|
|
4
5
|
if (typeof document == "undefined") return;
|
|
5
|
-
const
|
|
6
|
-
if (document.getElementById(
|
|
6
|
+
const r = "rte-preview-plugin-styles";
|
|
7
|
+
if (document.getElementById(r)) return;
|
|
7
8
|
const t = document.createElement("style");
|
|
8
|
-
t.id =
|
|
9
|
+
t.id = r, t.textContent = `
|
|
9
10
|
/* Preview Editor Dialog Styles */
|
|
10
11
|
.rte-preview-editor-overlay {
|
|
11
12
|
position: fixed !important;
|
|
@@ -225,15 +226,15 @@ const h = () => {
|
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
228
|
`, document.head.appendChild(t);
|
|
228
|
-
},
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
231
|
-
let e =
|
|
229
|
+
}, u = () => {
|
|
230
|
+
const r = window.getSelection();
|
|
231
|
+
if (r && r.rangeCount > 0) {
|
|
232
|
+
let e = r.getRangeAt(0).startContainer;
|
|
232
233
|
for (; e && e !== document.body; ) {
|
|
233
234
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
236
|
-
return
|
|
235
|
+
const i = e;
|
|
236
|
+
if (i.getAttribute("contenteditable") === "true")
|
|
237
|
+
return i;
|
|
237
238
|
}
|
|
238
239
|
e = e.parentNode;
|
|
239
240
|
}
|
|
@@ -246,37 +247,33 @@ const h = () => {
|
|
|
246
247
|
if (e) return e;
|
|
247
248
|
}
|
|
248
249
|
return document.querySelector('[contenteditable="true"]');
|
|
249
|
-
},
|
|
250
|
-
const
|
|
251
|
-
if (!
|
|
252
|
-
const t =
|
|
250
|
+
}, f = () => {
|
|
251
|
+
const r = u();
|
|
252
|
+
if (!r) return "";
|
|
253
|
+
const t = r.cloneNode(!0);
|
|
253
254
|
return [
|
|
254
255
|
".rte-floating-toolbar",
|
|
255
256
|
".rte-selection-marker",
|
|
256
257
|
".rte-toolbar",
|
|
257
258
|
".rte-resize-handle",
|
|
258
259
|
"[data-rte-internal]"
|
|
259
|
-
].forEach((
|
|
260
|
-
t.querySelectorAll(
|
|
260
|
+
].forEach((i) => {
|
|
261
|
+
t.querySelectorAll(i).forEach((n) => n.remove());
|
|
261
262
|
}), t.innerHTML;
|
|
262
|
-
},
|
|
263
|
-
const t = document.createElement("
|
|
264
|
-
return t.innerHTML =
|
|
265
|
-
|
|
266
|
-
).forEach((r) => r.remove()), t.querySelectorAll("*").forEach((r) => {
|
|
267
|
-
Array.from(r.attributes).forEach((o) => {
|
|
268
|
-
o.name.startsWith("on") && r.removeAttribute(o.name), (o.name === "href" || o.name === "src") && o.value.startsWith("javascript:") && r.removeAttribute(o.name), o.name.toLowerCase() === "contenteditable" && r.removeAttribute(o.name);
|
|
269
|
-
}), r.setAttribute("contenteditable", "false");
|
|
263
|
+
}, x = (r) => {
|
|
264
|
+
const t = document.createElement("template");
|
|
265
|
+
return t.innerHTML = v(r), t.content.querySelectorAll("*").forEach((e) => {
|
|
266
|
+
e.setAttribute("contenteditable", "false");
|
|
270
267
|
}), t.innerHTML;
|
|
271
268
|
}, b = () => {
|
|
272
|
-
if (typeof window == "undefined" ||
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
|
|
269
|
+
if (typeof window == "undefined" || l) return;
|
|
270
|
+
l = !0, w();
|
|
271
|
+
const r = f(), t = x(r), e = document.createElement("div");
|
|
272
|
+
h(e), e.className = "rte-preview-editor-overlay", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.setAttribute("aria-labelledby", "preview-editor-title");
|
|
273
|
+
const i = document.createElement("div");
|
|
274
|
+
i.className = "rte-preview-editor-modal";
|
|
276
275
|
const n = document.createElement("div");
|
|
277
|
-
n.className = "rte-preview-editor-
|
|
278
|
-
const r = document.createElement("div");
|
|
279
|
-
r.className = "rte-preview-editor-header", r.innerHTML = `
|
|
276
|
+
n.className = "rte-preview-editor-header", n.innerHTML = `
|
|
280
277
|
<h2 id="preview-editor-title">Preview Editor</h2>
|
|
281
278
|
<div class="rte-preview-editor-header-actions">
|
|
282
279
|
<button class="rte-preview-editor-close-btn" aria-label="Close preview editor">
|
|
@@ -287,39 +284,39 @@ const h = () => {
|
|
|
287
284
|
</button>
|
|
288
285
|
</div>
|
|
289
286
|
`;
|
|
290
|
-
const
|
|
291
|
-
|
|
287
|
+
const p = document.createElement("div");
|
|
288
|
+
p.className = "rte-preview-editor-body";
|
|
292
289
|
const c = document.createElement("div");
|
|
293
290
|
c.className = "rte-preview-editor-content";
|
|
294
291
|
const s = document.createElement("div");
|
|
295
|
-
s.className = "rte-preview-editor-light-editor", s.innerHTML = t, c.appendChild(s),
|
|
296
|
-
const
|
|
297
|
-
e.parentNode && e.parentNode.removeChild(e),
|
|
292
|
+
s.className = "rte-preview-editor-light-editor", s.innerHTML = t, c.appendChild(s), p.appendChild(c), i.appendChild(n), i.appendChild(p), e.appendChild(i);
|
|
293
|
+
const a = () => {
|
|
294
|
+
e.parentNode && e.parentNode.removeChild(e), l = !1, d = null, document.removeEventListener("keydown", m);
|
|
298
295
|
};
|
|
299
|
-
|
|
300
|
-
const m = (
|
|
301
|
-
|
|
302
|
-
}, g =
|
|
303
|
-
g && g.addEventListener("click", (
|
|
304
|
-
|
|
305
|
-
}), e.addEventListener("click", (
|
|
306
|
-
|
|
296
|
+
d = a;
|
|
297
|
+
const m = (o) => {
|
|
298
|
+
o.key === "Escape" && (o.preventDefault(), o.stopPropagation(), a());
|
|
299
|
+
}, g = n.querySelector(".rte-preview-editor-close-btn");
|
|
300
|
+
g && g.addEventListener("click", (o) => {
|
|
301
|
+
o.preventDefault(), o.stopPropagation(), a();
|
|
302
|
+
}), e.addEventListener("click", (o) => {
|
|
303
|
+
o.target === e && a();
|
|
307
304
|
}), document.addEventListener("keydown", m), document.body.appendChild(e);
|
|
308
|
-
},
|
|
305
|
+
}, k = () => ({
|
|
309
306
|
name: "preview",
|
|
310
307
|
toolbar: [
|
|
311
308
|
{
|
|
312
309
|
label: "Preview",
|
|
313
310
|
command: "togglePreview",
|
|
314
|
-
icon: '<svg fill="#000000" version="1.1"
|
|
311
|
+
icon: '<svg fill="#000000" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 92 92" enable-background="new 0 0 92 92" xml:space="preserve"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <path d="M91.3,43.8C90.6,42.8,74.4,19,46,19C17.6,19,1.4,42.8,0.7,43.8c-0.9,1.3-0.9,3.1,0,4.5 C1.4,49.2,17.6,73,46,73c28.4,0,44.6-23.8,45.3-24.8C92.2,46.9,92.2,45.1,91.3,43.8z M46,65C26.7,65,13.5,51.4,9,46 c4.5-5.5,17.6-19,37-19c19.3,0,32.5,13.6,37,19C78.4,51.5,65.3,65,46,65z M48.3,29.6c-4.4-0.6-8.7,0.5-12.3,3.2c0,0,0,0,0,0 c-7.3,5.5-8.8,15.9-3.3,23.2c2.7,3.6,6.5,5.8,10.9,6.5c0.8,0.1,1.6,0.2,2.3,0.2c3.6,0,7-1.2,9.9-3.3c7.3-5.5,8.8-15.9,3.3-23.2 C56.6,32.5,52.7,30.2,48.3,29.6z M52.3,54.5c-2.2,1.7-5,2.4-7.8,2c-2.8-0.4-5.3-1.9-7-4.1C34.1,47.7,35,41,39.7,37.5 c2.2-1.7,5-2.4,7.8-2c2.8,0.4,5.3,1.9,7,4.1C57.9,44.3,57,51,52.3,54.5z M51.9,40c0.8,0.7,1.2,1.8,1.2,2.8c0,1-0.4,2.1-1.2,2.8 c-0.7,0.7-1.8,1.2-2.8,1.2c-1.1,0-2.1-0.4-2.8-1.2c-0.8-0.8-1.2-1.8-1.2-2.8c0-1.1,0.4-2.1,1.2-2.8c0.7-0.8,1.8-1.2,2.8-1.2 C50.2,38.9,51.2,39.3,51.9,40z"></path> </g></svg>'
|
|
315
312
|
}
|
|
316
313
|
],
|
|
317
314
|
commands: {
|
|
318
|
-
togglePreview: () => (
|
|
315
|
+
togglePreview: () => (l ? d == null || d() : b(), !0)
|
|
319
316
|
},
|
|
320
317
|
keymap: {}
|
|
321
318
|
});
|
|
322
319
|
export {
|
|
323
|
-
|
|
320
|
+
k as PreviewPlugin
|
|
324
321
|
};
|
|
325
|
-
//# sourceMappingURL=PreviewPlugin.native-
|
|
322
|
+
//# sourceMappingURL=PreviewPlugin.native-Dv5OsffK.mjs.map
|