@editora/core 1.0.15 → 1.0.16
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-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
- package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
- package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
- package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
- package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
- package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
- package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
- package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
- package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
- package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
- package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
- package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
- package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
- package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
- package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
- package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
- package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
- package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
- package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
- package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
- package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
- package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
- package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
- package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
- package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
- package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
- package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
- package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
- package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
- package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
- package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
- package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
- package/dist/core.css +1 -1
- package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
- package/dist/editora.min.js +26 -24
- package/dist/editora.umd.js +26 -24
- package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
- package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
- package/dist/index-B1_vtXRz.mjs +3910 -0
- package/dist/index-C6BoNR2t.js +12 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.esm.js +17 -14
- package/dist/plugin-loader.js +53 -52
- package/dist/webcomponent-core.js +2039 -473
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +96 -66
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +2208 -641
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1564 -1198
- package/index.d.ts +32 -0
- package/package.json +10 -3
- package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
- package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
- package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
- package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
- package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
- package/dist/index-BLm1MtzH.js +0 -10
- package/dist/index-Cd9jEuZP.mjs +0 -2341
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { r as D } from "./historyHelpers-B0-4mq1E.mjs";
|
|
2
|
+
const w = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
let x = null, R = !1, H = 0;
|
|
4
|
+
const T = "User";
|
|
5
|
+
function S(e) {
|
|
6
|
+
return H += 1, `${e}-${Date.now()}-${H}`;
|
|
6
7
|
}
|
|
7
|
-
function
|
|
8
|
+
function v(e) {
|
|
8
9
|
if (!e) return null;
|
|
9
10
|
const t = e instanceof Element ? e : e.parentElement;
|
|
10
11
|
return t ? t.closest("[data-editora-editor]") || t.closest(".rte-editor") || t.closest(".editora-editor") : null;
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function q(e) {
|
|
13
14
|
const t = (e == null ? void 0 : e.editorElement) || (e == null ? void 0 : e.contentElement) || null;
|
|
14
15
|
if (!(t instanceof HTMLElement)) return;
|
|
15
16
|
const r = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
|
|
16
17
|
r && (x = r);
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function k(e, t) {
|
|
19
20
|
return t.contains(e.commonAncestorContainer);
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function B() {
|
|
22
23
|
if (typeof window != "undefined") {
|
|
23
24
|
const o = window.__editoraCommandEditorRoot;
|
|
24
25
|
if (o instanceof HTMLElement) {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
return x =
|
|
26
|
+
const n = o.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (o.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? o : null);
|
|
27
|
+
if (n)
|
|
28
|
+
return x = n, window.__editoraCommandEditorRoot = null, n;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
const e = document.activeElement, t = e ?
|
|
31
|
+
const e = document.activeElement, t = e ? v(e) : null;
|
|
31
32
|
if (t) return t;
|
|
32
33
|
const r = window.getSelection();
|
|
33
34
|
if (r && r.rangeCount > 0) {
|
|
34
|
-
const o =
|
|
35
|
+
const o = v(
|
|
35
36
|
r.getRangeAt(0).commonAncestorContainer
|
|
36
37
|
);
|
|
37
38
|
if (o) return o;
|
|
38
39
|
}
|
|
39
40
|
return x;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
const t =
|
|
42
|
+
function $(e) {
|
|
43
|
+
const t = w.get(e);
|
|
43
44
|
if (t) return t;
|
|
44
45
|
const r = {
|
|
45
46
|
root: e,
|
|
@@ -52,35 +53,50 @@ function q(e) {
|
|
|
52
53
|
newCommentText: "",
|
|
53
54
|
selectionChangeListener: null
|
|
54
55
|
};
|
|
55
|
-
return
|
|
56
|
+
return w.set(e, r), r;
|
|
56
57
|
}
|
|
57
58
|
function u() {
|
|
58
|
-
const e =
|
|
59
|
-
return e ? (x = e,
|
|
59
|
+
const e = B();
|
|
60
|
+
return e ? (x = e, $(e)) : null;
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function M(e) {
|
|
62
63
|
const t = window.getSelection();
|
|
63
64
|
if (!t || t.rangeCount === 0 || t.isCollapsed) return null;
|
|
64
65
|
const r = t.getRangeAt(0);
|
|
65
|
-
return
|
|
66
|
+
return k(r, e) ? r.cloneRange() : null;
|
|
67
|
+
}
|
|
68
|
+
function O(e) {
|
|
69
|
+
return e.root.querySelector(".rte-content") || e.root.querySelector("[contenteditable]");
|
|
66
70
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
function E(e, t) {
|
|
72
|
+
return t.anchorId ? e.root.querySelector(`[id="${t.anchorId}"]`) : null;
|
|
73
|
+
}
|
|
74
|
+
function P(e) {
|
|
75
|
+
const t = [];
|
|
76
|
+
return e.comments.forEach((r) => {
|
|
77
|
+
if (r.anchorId) {
|
|
78
|
+
const o = E(e, r);
|
|
79
|
+
if (!o) return;
|
|
80
|
+
r.resolved = o.classList.contains("rte-comment-anchor-resolved");
|
|
81
|
+
}
|
|
82
|
+
t.push(r);
|
|
83
|
+
}), t;
|
|
84
|
+
}
|
|
85
|
+
function A(e, t) {
|
|
86
|
+
const r = O(e), o = r ? r.innerHTML : "", n = t();
|
|
87
|
+
return r && r.innerHTML !== o && (D(r, o), r.dispatchEvent(new Event("input", { bubbles: !0 }))), n;
|
|
88
|
+
}
|
|
89
|
+
function N(e, t) {
|
|
90
|
+
const r = E(e, t);
|
|
70
91
|
r && r.classList.toggle("rte-comment-anchor-resolved", t.resolved);
|
|
71
92
|
}
|
|
72
|
-
function
|
|
93
|
+
function y(e, t, r) {
|
|
73
94
|
const o = e.comments.get(t);
|
|
74
|
-
if (!o
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
function N(e, t, r) {
|
|
79
|
-
t.onclick = (o) => {
|
|
80
|
-
o.preventDefault(), o.stopPropagation(), x = e.root, e.expandedComments.add(r), h(e, !0), m(e);
|
|
81
|
-
};
|
|
95
|
+
if (!o) return;
|
|
96
|
+
const n = E(e, o);
|
|
97
|
+
n && n.classList.toggle("highlighted", r);
|
|
82
98
|
}
|
|
83
|
-
function
|
|
99
|
+
function _(e) {
|
|
84
100
|
const t = e.parentNode;
|
|
85
101
|
if (t) {
|
|
86
102
|
for (; e.firstChild; )
|
|
@@ -88,126 +104,130 @@ function z(e) {
|
|
|
88
104
|
e.remove();
|
|
89
105
|
}
|
|
90
106
|
}
|
|
91
|
-
function
|
|
107
|
+
function C(e, t) {
|
|
92
108
|
if (e.panelVisible = t, t) {
|
|
93
|
-
|
|
109
|
+
Y(), j(e), e.root.setAttribute("data-rte-comments-open", "true"), e.panelElement && (e.panelElement.classList.add("is-open"), e.panelElement.setAttribute("aria-hidden", "false")), F(e);
|
|
94
110
|
return;
|
|
95
111
|
}
|
|
96
|
-
e.root.removeAttribute("data-rte-comments-open"),
|
|
112
|
+
e.root.removeAttribute("data-rte-comments-open"), Z(e), e.panelElement && (e.panelElement.remove(), e.panelElement = null);
|
|
97
113
|
}
|
|
98
|
-
function
|
|
114
|
+
function j(e) {
|
|
99
115
|
if (e.panelElement) return;
|
|
100
116
|
const t = document.createElement("aside");
|
|
101
117
|
t.className = "rte-comments-panel", t.setAttribute("role", "complementary"), t.setAttribute("aria-label", "Comments"), t.setAttribute("aria-hidden", "true"), window.getComputedStyle(e.root).position === "static" && (e.root.style.position = "relative"), e.root.appendChild(t), e.panelElement = t;
|
|
102
118
|
}
|
|
103
|
-
function
|
|
119
|
+
function F(e) {
|
|
104
120
|
e.selectionChangeListener || (e.selectionChangeListener = () => {
|
|
105
121
|
const t = window.getSelection();
|
|
106
122
|
if (!t || t.rangeCount === 0 || t.isCollapsed) return;
|
|
107
123
|
const r = t.getRangeAt(0);
|
|
108
|
-
|
|
124
|
+
k(r, e.root) && (e.savedSelection = r.cloneRange(), x = e.root);
|
|
109
125
|
}, document.addEventListener("selectionchange", e.selectionChangeListener));
|
|
110
126
|
}
|
|
111
|
-
function
|
|
127
|
+
function Z(e) {
|
|
112
128
|
e.selectionChangeListener && (document.removeEventListener("selectionchange", e.selectionChangeListener), e.selectionChangeListener = null);
|
|
113
129
|
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
116
|
-
(t, r) => r.createdAt.localeCompare(t.createdAt)
|
|
117
|
-
);
|
|
130
|
+
function z(e) {
|
|
131
|
+
return P(e).sort((t, r) => r.createdAt.localeCompare(t.createdAt));
|
|
118
132
|
}
|
|
119
|
-
function
|
|
133
|
+
function V(e) {
|
|
120
134
|
return new Date(e).toLocaleString();
|
|
121
135
|
}
|
|
122
|
-
function
|
|
136
|
+
function K(e, t) {
|
|
123
137
|
const r = e.expandedComments.has(t.id), o = document.createElement("article");
|
|
124
138
|
o.className = `rte-comment-item${t.resolved ? " resolved" : ""}`, o.innerHTML = `
|
|
125
139
|
<header class="rte-comment-header">
|
|
126
140
|
<div class="rte-comment-meta">
|
|
127
|
-
<strong class="rte-comment-author"
|
|
128
|
-
<time class="rte-comment-date">${
|
|
141
|
+
<strong class="rte-comment-author"></strong>
|
|
142
|
+
<time class="rte-comment-date">${V(t.createdAt)}</time>
|
|
129
143
|
</div>
|
|
130
144
|
<button class="rte-comment-expand" type="button" aria-label="Toggle details">
|
|
131
145
|
${r ? "▾" : "▸"}
|
|
132
146
|
</button>
|
|
133
147
|
</header>
|
|
134
148
|
<div class="rte-comment-text"></div>
|
|
135
|
-
${t.selectedText ?
|
|
149
|
+
${t.selectedText ? '<blockquote class="rte-comment-selection"></blockquote>' : ""}
|
|
136
150
|
<section class="rte-comment-expanded${r ? " show" : ""}"></section>
|
|
137
151
|
`;
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
const i = o.querySelector(".rte-comment-
|
|
141
|
-
i
|
|
142
|
-
|
|
152
|
+
const n = o.querySelector(".rte-comment-author");
|
|
153
|
+
n && (n.textContent = t.author);
|
|
154
|
+
const i = o.querySelector(".rte-comment-text");
|
|
155
|
+
i && (i.textContent = t.text);
|
|
156
|
+
const f = o.querySelector(".rte-comment-selection");
|
|
157
|
+
f && (f.textContent = t.selectedText);
|
|
158
|
+
const d = o.querySelector(".rte-comment-expand");
|
|
159
|
+
d == null || d.addEventListener("click", () => {
|
|
160
|
+
e.expandedComments.has(t.id) ? e.expandedComments.delete(t.id) : e.expandedComments.add(t.id), p(e);
|
|
143
161
|
});
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
162
|
+
const l = o.querySelector(".rte-comment-expanded");
|
|
163
|
+
if (l && r) {
|
|
146
164
|
if (t.replies.length > 0) {
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
165
|
+
const a = document.createElement("div");
|
|
166
|
+
a.className = "rte-comment-replies", t.replies.forEach((c) => {
|
|
167
|
+
const m = document.createElement("div");
|
|
168
|
+
m.className = "rte-comment-reply", m.innerHTML = `
|
|
151
169
|
<div class="rte-comment-reply-header">
|
|
152
|
-
<strong
|
|
153
|
-
<time>${
|
|
170
|
+
<strong class="rte-comment-reply-author"></strong>
|
|
171
|
+
<time>${V(c.createdAt)}</time>
|
|
154
172
|
</div>
|
|
155
173
|
<div class="rte-comment-reply-text"></div>
|
|
156
174
|
`;
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
175
|
+
const g = m.querySelector(".rte-comment-reply-author");
|
|
176
|
+
g && (g.textContent = c.author);
|
|
177
|
+
const b = m.querySelector(".rte-comment-reply-text");
|
|
178
|
+
b && (b.textContent = c.text), a.appendChild(m);
|
|
179
|
+
}), l.appendChild(a);
|
|
160
180
|
}
|
|
161
181
|
if (!t.resolved) {
|
|
162
|
-
const
|
|
163
|
-
|
|
182
|
+
const a = document.createElement("div");
|
|
183
|
+
a.className = "rte-comment-reply-composer", a.innerHTML = `
|
|
164
184
|
<textarea class="rte-comment-reply-textarea" rows="2" placeholder="Reply..."></textarea>
|
|
165
185
|
<button type="button" class="rte-comment-btn primary">Reply</button>
|
|
166
186
|
`;
|
|
167
|
-
const
|
|
187
|
+
const c = a.querySelector(
|
|
168
188
|
".rte-comment-reply-textarea"
|
|
169
|
-
),
|
|
189
|
+
), m = a.querySelector(
|
|
170
190
|
".rte-comment-btn.primary"
|
|
171
191
|
);
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
|
|
192
|
+
if (c && m) {
|
|
193
|
+
c.value = e.replyTexts[t.id] || "";
|
|
194
|
+
const g = () => {
|
|
195
|
+
const b = !!c.value.trim();
|
|
196
|
+
m.disabled = !b;
|
|
177
197
|
};
|
|
178
|
-
|
|
179
|
-
e.replyTexts[t.id] =
|
|
180
|
-
}),
|
|
181
|
-
const
|
|
182
|
-
|
|
198
|
+
g(), c.addEventListener("input", () => {
|
|
199
|
+
e.replyTexts[t.id] = c.value, g();
|
|
200
|
+
}), m.addEventListener("click", () => {
|
|
201
|
+
const b = c.value.trim();
|
|
202
|
+
b && (Q(t.id, T, b), e.replyTexts[t.id] = "", p(e));
|
|
183
203
|
});
|
|
184
204
|
}
|
|
185
|
-
|
|
205
|
+
l.appendChild(a);
|
|
186
206
|
}
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
},
|
|
207
|
+
const s = document.createElement("div");
|
|
208
|
+
if (s.className = "rte-comment-actions", t.anchorId) {
|
|
209
|
+
const a = document.createElement("button");
|
|
210
|
+
a.type = "button", a.className = "rte-comment-btn ghost", a.textContent = "Jump to text", a.onclick = () => {
|
|
211
|
+
const c = E(e, t);
|
|
212
|
+
c && (c.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), y(e, t.id, !0), window.setTimeout(() => y(e, t.id, !1), 1200));
|
|
213
|
+
}, s.appendChild(a);
|
|
194
214
|
}
|
|
195
215
|
if (t.resolved) {
|
|
196
|
-
const
|
|
197
|
-
|
|
216
|
+
const a = document.createElement("button");
|
|
217
|
+
a.type = "button", a.className = "rte-comment-btn ghost", a.textContent = "Reopen", a.onclick = () => G(t.id), s.appendChild(a);
|
|
198
218
|
} else {
|
|
199
|
-
const
|
|
200
|
-
|
|
219
|
+
const a = document.createElement("button");
|
|
220
|
+
a.type = "button", a.className = "rte-comment-btn success", a.textContent = "Resolve", a.onclick = () => X(t.id, T), s.appendChild(a);
|
|
201
221
|
}
|
|
202
|
-
const
|
|
203
|
-
|
|
222
|
+
const h = document.createElement("button");
|
|
223
|
+
h.type = "button", h.className = "rte-comment-btn danger", h.textContent = "Delete", h.onclick = () => J(t.id), s.appendChild(h), l.appendChild(s);
|
|
204
224
|
}
|
|
205
|
-
return o.addEventListener("mouseenter", () =>
|
|
225
|
+
return o.addEventListener("mouseenter", () => y(e, t.id, !0)), o.addEventListener("mouseleave", () => y(e, t.id, !1)), o;
|
|
206
226
|
}
|
|
207
|
-
function
|
|
227
|
+
function p(e) {
|
|
208
228
|
const t = e || u();
|
|
209
229
|
if (!(t != null && t.panelElement)) return;
|
|
210
|
-
const r =
|
|
230
|
+
const r = z(t);
|
|
211
231
|
t.panelElement.innerHTML = `
|
|
212
232
|
<div class="rte-comments-header">
|
|
213
233
|
<div>
|
|
@@ -226,148 +246,168 @@ function m(e) {
|
|
|
226
246
|
`;
|
|
227
247
|
const o = t.panelElement.querySelector(".rte-comments-close");
|
|
228
248
|
o == null || o.addEventListener("click", () => {
|
|
229
|
-
|
|
249
|
+
C(t, !1);
|
|
230
250
|
});
|
|
231
|
-
const
|
|
251
|
+
const n = t.panelElement.querySelector(
|
|
232
252
|
".new-comment-textarea"
|
|
233
253
|
), i = t.panelElement.querySelector(
|
|
234
254
|
".add-comment-btn"
|
|
235
255
|
);
|
|
236
|
-
if (
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
i.disabled = !
|
|
256
|
+
if (n && i) {
|
|
257
|
+
n.value = t.newCommentText;
|
|
258
|
+
const d = () => {
|
|
259
|
+
const l = !!n.value.trim();
|
|
260
|
+
i.disabled = !l;
|
|
241
261
|
};
|
|
242
|
-
|
|
243
|
-
t.newCommentText =
|
|
244
|
-
}),
|
|
245
|
-
(
|
|
262
|
+
d(), n.addEventListener("input", () => {
|
|
263
|
+
t.newCommentText = n.value, d();
|
|
264
|
+
}), n.addEventListener("keydown", (l) => {
|
|
265
|
+
(l.ctrlKey || l.metaKey) && l.key === "Enter" && (l.preventDefault(), i.click());
|
|
246
266
|
}), i.addEventListener("click", () => {
|
|
247
|
-
const
|
|
248
|
-
if (!
|
|
249
|
-
const
|
|
250
|
-
|
|
267
|
+
const l = n.value.trim();
|
|
268
|
+
if (!l) return;
|
|
269
|
+
const s = !!t.savedSelection;
|
|
270
|
+
W(T, l, !s), t.newCommentText = "", p(t);
|
|
251
271
|
});
|
|
252
272
|
}
|
|
253
273
|
const f = t.panelElement.querySelector(".rte-comments-list");
|
|
254
|
-
f && r.forEach((
|
|
255
|
-
f.appendChild(
|
|
274
|
+
f && r.forEach((d) => {
|
|
275
|
+
f.appendChild(K(t, d));
|
|
256
276
|
});
|
|
257
277
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
278
|
+
const L = /* @__PURE__ */ new WeakMap();
|
|
279
|
+
function U(e) {
|
|
280
|
+
L.has(e) || L.set(
|
|
281
|
+
e,
|
|
282
|
+
window.setTimeout(() => {
|
|
283
|
+
L.delete(e), e.panelVisible && p(e);
|
|
284
|
+
}, 120)
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
function I() {
|
|
288
|
+
R || (R = !0, document.addEventListener("focusin", (e) => {
|
|
289
|
+
const t = v(e.target);
|
|
261
290
|
t && (x = t);
|
|
291
|
+
}), document.addEventListener("click", (e) => {
|
|
292
|
+
const t = e.target instanceof Element ? e.target : null, r = t == null ? void 0 : t.closest(".rte-comment-anchor");
|
|
293
|
+
if (!r) return;
|
|
294
|
+
const o = v(r), n = o ? w.get(o) : null, i = r.getAttribute("data-comment-id");
|
|
295
|
+
!n || !i || !n.comments.has(i) || (e.preventDefault(), e.stopPropagation(), x = n.root, n.expandedComments.add(i), C(n, !0), p(n));
|
|
296
|
+
}), document.addEventListener("input", (e) => {
|
|
297
|
+
const t = e.target instanceof Element ? e.target : null;
|
|
298
|
+
if (!t || t.closest(".rte-comments-panel")) return;
|
|
299
|
+
const r = v(t), o = r ? w.get(r) : null;
|
|
300
|
+
o != null && o.panelVisible && U(o);
|
|
262
301
|
}), document.addEventListener("selectionchange", () => {
|
|
263
302
|
const e = window.getSelection();
|
|
264
303
|
if (!e || e.rangeCount === 0) return;
|
|
265
|
-
const t = e.getRangeAt(0), r =
|
|
304
|
+
const t = e.getRangeAt(0), r = v(t.commonAncestorContainer);
|
|
266
305
|
if (!r) return;
|
|
267
306
|
x = r;
|
|
268
|
-
const o =
|
|
269
|
-
!o || e.isCollapsed ||
|
|
307
|
+
const o = w.get(r);
|
|
308
|
+
!o || e.isCollapsed || k(t, r) && (o.savedSelection = t.cloneRange());
|
|
270
309
|
}), document.addEventListener(
|
|
271
310
|
"keydown",
|
|
272
311
|
(e) => {
|
|
273
312
|
if (e.key !== "Escape") return;
|
|
274
313
|
const t = u();
|
|
275
|
-
!t || !t.panelVisible || (e.preventDefault(), e.stopPropagation(),
|
|
314
|
+
!t || !t.panelVisible || (e.preventDefault(), e.stopPropagation(), C(t, !1));
|
|
276
315
|
},
|
|
277
316
|
!0
|
|
278
317
|
));
|
|
279
318
|
}
|
|
280
|
-
function
|
|
319
|
+
function te() {
|
|
281
320
|
const e = u();
|
|
282
|
-
return e ?
|
|
321
|
+
return e ? z(e) : [];
|
|
283
322
|
}
|
|
284
|
-
function
|
|
285
|
-
var p;
|
|
323
|
+
function W(e, t, r = !1) {
|
|
286
324
|
const o = u();
|
|
287
325
|
if (!o) return "";
|
|
288
|
-
const
|
|
289
|
-
if (!
|
|
326
|
+
const n = t.trim();
|
|
327
|
+
if (!n) return "";
|
|
290
328
|
if (r) {
|
|
291
|
-
const
|
|
292
|
-
return o.comments.set(
|
|
293
|
-
id:
|
|
329
|
+
const c = S("comment");
|
|
330
|
+
return o.comments.set(c, {
|
|
331
|
+
id: c,
|
|
294
332
|
anchorId: "",
|
|
295
333
|
selectedText: "",
|
|
296
334
|
author: e,
|
|
297
|
-
text:
|
|
335
|
+
text: n,
|
|
298
336
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
299
337
|
resolved: !1,
|
|
300
338
|
replies: []
|
|
301
|
-
}),
|
|
339
|
+
}), p(o), c;
|
|
302
340
|
}
|
|
303
|
-
const i = o.savedSelection ||
|
|
304
|
-
if (!i || !
|
|
341
|
+
const i = o.savedSelection || M(o.root);
|
|
342
|
+
if (!i || !k(i, o.root)) return "";
|
|
305
343
|
const f = i.toString().trim();
|
|
306
344
|
if (!f) return "";
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
345
|
+
const d = S("comment"), l = S("comment-anchor"), s = document.createElement("span");
|
|
346
|
+
if (s.id = l, s.className = "rte-comment-anchor", s.setAttribute("data-comment-id", d), s.setAttribute("title", "Commented text"), !A(o, () => {
|
|
347
|
+
var c;
|
|
348
|
+
try {
|
|
349
|
+
const m = i.cloneRange(), g = m.extractContents();
|
|
350
|
+
return (c = g.textContent) != null && c.trim() ? (s.appendChild(g), m.insertNode(s), !0) : !1;
|
|
351
|
+
} catch (m) {
|
|
352
|
+
return !1;
|
|
353
|
+
}
|
|
354
|
+
})) return "";
|
|
355
|
+
o.comments.set(d, {
|
|
356
|
+
id: d,
|
|
357
|
+
anchorId: l,
|
|
319
358
|
selectedText: f,
|
|
320
359
|
author: e,
|
|
321
|
-
text:
|
|
360
|
+
text: n,
|
|
322
361
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
323
362
|
resolved: !1,
|
|
324
363
|
replies: []
|
|
325
364
|
}), o.savedSelection = null;
|
|
326
|
-
const
|
|
327
|
-
return
|
|
365
|
+
const a = window.getSelection();
|
|
366
|
+
return a == null || a.removeAllRanges(), p(o), d;
|
|
328
367
|
}
|
|
329
|
-
function
|
|
368
|
+
function X(e, t) {
|
|
330
369
|
const r = u();
|
|
331
370
|
if (!r) return;
|
|
332
371
|
const o = r.comments.get(e);
|
|
333
|
-
o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(),
|
|
372
|
+
o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), A(r, () => N(r, o)), p(r));
|
|
334
373
|
}
|
|
335
|
-
function
|
|
374
|
+
function G(e) {
|
|
336
375
|
const t = u();
|
|
337
376
|
if (!t) return;
|
|
338
377
|
const r = t.comments.get(e);
|
|
339
|
-
r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0,
|
|
378
|
+
r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, A(t, () => N(t, r)), p(t));
|
|
340
379
|
}
|
|
341
|
-
function
|
|
380
|
+
function J(e) {
|
|
342
381
|
const t = u();
|
|
343
382
|
if (!t) return;
|
|
344
383
|
const r = t.comments.get(e);
|
|
345
384
|
if (r) {
|
|
346
385
|
if (r.anchorId) {
|
|
347
|
-
const o = t
|
|
348
|
-
o &&
|
|
349
|
-
}
|
|
350
|
-
|
|
386
|
+
const o = E(t, r);
|
|
387
|
+
o && A(t, () => _(o));
|
|
388
|
+
} else
|
|
389
|
+
t.comments.delete(e), t.expandedComments.delete(e), delete t.replyTexts[e];
|
|
390
|
+
p(t);
|
|
351
391
|
}
|
|
352
392
|
}
|
|
353
|
-
function
|
|
393
|
+
function Q(e, t, r) {
|
|
354
394
|
const o = u();
|
|
355
395
|
if (!o) return;
|
|
356
|
-
const
|
|
357
|
-
if (!
|
|
396
|
+
const n = o.comments.get(e);
|
|
397
|
+
if (!n) return;
|
|
358
398
|
const i = r.trim();
|
|
359
|
-
i && (
|
|
360
|
-
id:
|
|
399
|
+
i && (n.replies.push({
|
|
400
|
+
id: S("reply"),
|
|
361
401
|
author: t,
|
|
362
402
|
text: i,
|
|
363
403
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
364
|
-
}),
|
|
404
|
+
}), p(o));
|
|
365
405
|
}
|
|
366
|
-
function
|
|
406
|
+
function re(e, t) {
|
|
367
407
|
const r = u();
|
|
368
|
-
r &&
|
|
408
|
+
r && y(r, e, t);
|
|
369
409
|
}
|
|
370
|
-
function
|
|
410
|
+
function Y() {
|
|
371
411
|
if (document.getElementById("rte-comments-panel-styles")) return;
|
|
372
412
|
const e = document.createElement("style");
|
|
373
413
|
e.id = "rte-comments-panel-styles", e.textContent = `
|
|
@@ -688,14 +728,22 @@ function Z() {
|
|
|
688
728
|
}
|
|
689
729
|
`, document.head.appendChild(e);
|
|
690
730
|
}
|
|
691
|
-
const
|
|
731
|
+
const oe = () => ({
|
|
692
732
|
name: "comments",
|
|
693
733
|
toolbar: [
|
|
694
734
|
{
|
|
695
735
|
label: "Add Comment",
|
|
696
736
|
command: "addComment",
|
|
697
737
|
type: "button",
|
|
698
|
-
|
|
738
|
+
// The upstream SVGRepo export used a class-based <style> block for the
|
|
739
|
+
// transparent bounding rect (`.cls-1{fill:none}`). That's fine when an
|
|
740
|
+
// icon is scoped (shadow DOM, or one icon per page) but this markup is
|
|
741
|
+
// inserted via raw innerHTML into plain light-DOM content alongside
|
|
742
|
+
// every other plugin's icons, so the <style> tag applies document-wide
|
|
743
|
+
// - any other icon reusing the same auto-generated class name would
|
|
744
|
+
// collide with it. Inlined the one declaration it held (fill="none")
|
|
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" id="icon" 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>'
|
|
699
747
|
},
|
|
700
748
|
{
|
|
701
749
|
label: "Show / Hide Comments",
|
|
@@ -706,36 +754,36 @@ const X = () => ({
|
|
|
706
754
|
],
|
|
707
755
|
commands: {
|
|
708
756
|
addComment: (e, t) => {
|
|
709
|
-
var
|
|
710
|
-
|
|
757
|
+
var n;
|
|
758
|
+
q(t), I();
|
|
711
759
|
const r = u();
|
|
712
760
|
if (!r) return !1;
|
|
713
|
-
if (r.savedSelection =
|
|
761
|
+
if (r.savedSelection = M(r.root), r.savedSelection) {
|
|
714
762
|
const i = window.getSelection();
|
|
715
763
|
i == null || i.removeAllRanges();
|
|
716
764
|
}
|
|
717
|
-
|
|
718
|
-
const o = (
|
|
765
|
+
C(r, !0), p(r);
|
|
766
|
+
const o = (n = r.panelElement) == null ? void 0 : n.querySelector(
|
|
719
767
|
".new-comment-textarea"
|
|
720
768
|
);
|
|
721
769
|
return o == null || o.focus({ preventScroll: !0 }), !0;
|
|
722
770
|
},
|
|
723
771
|
toggleComments: (e, t) => {
|
|
724
|
-
|
|
772
|
+
q(t), I();
|
|
725
773
|
const r = u();
|
|
726
|
-
return r ? (
|
|
774
|
+
return r ? (C(r, !r.panelVisible), r.panelVisible && p(r), !0) : !1;
|
|
727
775
|
}
|
|
728
776
|
},
|
|
729
777
|
keymap: {}
|
|
730
778
|
});
|
|
731
779
|
export {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
780
|
+
oe as CommentsPlugin,
|
|
781
|
+
W as addCommentCommand,
|
|
782
|
+
J as deleteComment,
|
|
783
|
+
te as getAllComments,
|
|
784
|
+
re as highlightComment,
|
|
785
|
+
G as reopenComment,
|
|
786
|
+
Q as replyToComment,
|
|
787
|
+
X as resolveComment
|
|
740
788
|
};
|
|
741
|
-
//# sourceMappingURL=CommentsPlugin.native-
|
|
789
|
+
//# sourceMappingURL=CommentsPlugin.native-CLip9wAO.mjs.map
|