@editora/plugins 1.0.22 → 1.1.0
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 +1 -1
- package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-BwhZsI5v.js} +11 -11
- package/dist/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-CojLCp6C.mjs} +61 -53
- package/dist/MediaManagerPlugin.native-CycfjOi4.js +1841 -0
- package/dist/MediaManagerPlugin.native-DZrmcmnm.mjs +4688 -0
- package/dist/a11y-checker.cjs.js +3 -3
- package/dist/a11y-checker.esm.js +6 -4
- package/dist/anchor.cjs.js +4 -4
- package/dist/anchor.esm.js +19 -18
- package/dist/anchoredPopover-BNJ8e7j-.mjs +128 -0
- package/dist/anchoredPopover-Cygmit_o.js +1 -0
- package/dist/approval-workflow.cjs.js +7 -7
- package/dist/approval-workflow.esm.js +55 -54
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +72 -67
- package/dist/blocks-library.cjs.js +18 -19
- package/dist/blocks-library.esm.js +41 -42
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +50 -50
- package/dist/code-sample.cjs.js +10 -10
- package/dist/code-sample.esm.js +4 -4
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/comments.cjs.js +23 -11
- package/dist/comments.esm.js +167 -149
- package/dist/conditional-content.cjs.js +2 -2
- package/dist/conditional-content.esm.js +2 -2
- package/dist/confirmDialog-D3S8BhIM.js +42 -0
- package/dist/confirmDialog-DR4c8j6S.mjs +87 -0
- package/dist/content-rules.cjs.js +6 -6
- package/dist/content-rules.esm.js +51 -51
- package/dist/data-binding.cjs.js +2 -2
- package/dist/data-binding.esm.js +2 -2
- package/dist/dialogHelpers-BbwpIXD9.mjs +183 -0
- package/dist/dialogHelpers-BxSQ7A6M.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-BL98a7YZ.mjs → documentManager-BFjGIeI8.mjs} +793 -781
- package/dist/{documentManager-r8t7yZEd.js → documentManager-C9d17K5W.js} +10 -10
- package/dist/embed-iframe.cjs.js +6 -6
- package/dist/embed-iframe.esm.js +6 -6
- package/dist/emojis.cjs.js +5 -5
- package/dist/emojis.esm.js +3 -3
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +12 -12
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +172 -151
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +96 -83
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +176 -97
- package/dist/{index-D5xugkYA.js → index-CtR8olYy.js} +2 -2
- package/dist/{index-B-VitI3v.mjs → index-Du_Ljqfz.mjs} +36 -35
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +90 -83
- package/dist/katex-Cc3-mvOY.js +257 -0
- package/dist/katex-DoRnZ_sp.mjs +11682 -0
- package/dist/katex.min--Ws3c9be.mjs +5 -0
- package/dist/katex.min-Dk2VscxB.js +2 -0
- package/dist/link.cjs.js +3 -3
- package/dist/link.esm.js +3 -3
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +140 -52
- package/dist/math.cjs.js +14 -14
- package/dist/math.esm.js +149 -136
- package/dist/media-manager.cjs.js +1 -619
- package/dist/media-manager.esm.js +30 -1017
- package/dist/mentions.cjs.js +12 -12
- package/dist/mentions.esm.js +149 -143
- package/dist/merge-tag.cjs.js +5 -3
- package/dist/merge-tag.esm.js +5 -3
- package/dist/notify-BkbzMopb.js +32 -0
- package/dist/notify-zOp-mUOJ.mjs +59 -0
- package/dist/pii-redaction.cjs.js +1 -1
- package/dist/pii-redaction.esm.js +1 -1
- package/dist/preview.cjs.js +1 -1
- package/dist/preview.esm.js +1 -1
- package/dist/shared-config.cjs.js +1 -1
- package/dist/shared-config.esm.js +14 -14
- package/dist/slash-commands.cjs.js +5 -5
- package/dist/slash-commands.esm.js +259 -236
- package/dist/smart-paste.cjs.js +1 -1
- package/dist/smart-paste.esm.js +1 -1
- package/dist/special-characters.cjs.js +3 -3
- package/dist/special-characters.esm.js +3 -3
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +288 -251
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +175 -154
- package/dist/template.cjs.js +5 -3
- package/dist/template.esm.js +15 -13
- package/dist/text-color.cjs.js +4 -4
- package/dist/text-color.esm.js +38 -34
- package/dist/translation-workflow.cjs.js +9 -9
- package/dist/translation-workflow.esm.js +98 -95
- package/dist/version-diff.cjs.js +4 -4
- package/dist/version-diff.esm.js +36 -36
- package/index.d.ts +183 -2
- package/package.json +6 -5
- package/dist/anchoredPopover-Bg-ey7Yo.js +0 -1
- package/dist/anchoredPopover-D_JbjvdA.mjs +0 -111
- package/dist/dialogHelpers-5d5BuOCW.mjs +0 -39
- package/dist/dialogHelpers-zU6zpMIA.js +0 -12
package/dist/comments.esm.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as M, p as N, k as D } from "./dialogHelpers-BbwpIXD9.mjs";
|
|
2
|
+
import { r as $ } from "./historyHelpers-BEKwNOtA.mjs";
|
|
2
3
|
const y = /* @__PURE__ */ new WeakMap();
|
|
3
|
-
let
|
|
4
|
+
let h = null, R = !1, H = 0;
|
|
4
5
|
const T = "User";
|
|
5
6
|
function S(e) {
|
|
6
7
|
return H += 1, `${e}-${Date.now()}-${H}`;
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
+
function g(e) {
|
|
9
10
|
if (!e) return null;
|
|
10
11
|
const t = e instanceof Element ? e : e.parentElement;
|
|
11
12
|
return t ? t.closest("[data-editora-editor]") || t.closest(".rte-editor") || t.closest(".editora-editor") : null;
|
|
@@ -14,32 +15,32 @@ function q(e) {
|
|
|
14
15
|
const t = e?.editorElement || e?.contentElement || null;
|
|
15
16
|
if (!(t instanceof HTMLElement)) return;
|
|
16
17
|
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);
|
|
17
|
-
r && (
|
|
18
|
+
r && (h = r);
|
|
18
19
|
}
|
|
19
20
|
function k(e, t) {
|
|
20
21
|
return t.contains(e.commonAncestorContainer);
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function P() {
|
|
23
24
|
if (typeof window < "u") {
|
|
24
25
|
const o = window.__editoraCommandEditorRoot;
|
|
25
26
|
if (o instanceof HTMLElement) {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
return
|
|
27
|
+
const a = o.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (o.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? o : null);
|
|
28
|
+
if (a)
|
|
29
|
+
return h = a, window.__editoraCommandEditorRoot = null, a;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
const e = document.activeElement, t = e ?
|
|
32
|
+
const e = document.activeElement, t = e ? g(e) : null;
|
|
32
33
|
if (t) return t;
|
|
33
34
|
const r = window.getSelection();
|
|
34
35
|
if (r && r.rangeCount > 0) {
|
|
35
|
-
const o =
|
|
36
|
+
const o = g(
|
|
36
37
|
r.getRangeAt(0).commonAncestorContainer
|
|
37
38
|
);
|
|
38
39
|
if (o) return o;
|
|
39
40
|
}
|
|
40
|
-
return
|
|
41
|
+
return h;
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function O(e) {
|
|
43
44
|
const t = y.get(e);
|
|
44
45
|
if (t) return t;
|
|
45
46
|
const r = {
|
|
@@ -56,22 +57,22 @@ function D(e) {
|
|
|
56
57
|
return y.set(e, r), r;
|
|
57
58
|
}
|
|
58
59
|
function u() {
|
|
59
|
-
const e =
|
|
60
|
-
return e ? (
|
|
60
|
+
const e = P();
|
|
61
|
+
return e ? (h = e, O(e)) : null;
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function V(e) {
|
|
63
64
|
const t = window.getSelection();
|
|
64
65
|
if (!t || t.rangeCount === 0 || t.isCollapsed) return null;
|
|
65
66
|
const r = t.getRangeAt(0);
|
|
66
67
|
return k(r, e) ? r.cloneRange() : null;
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
+
function F(e) {
|
|
69
70
|
return e.root.querySelector(".rte-content") || e.root.querySelector("[contenteditable]");
|
|
70
71
|
}
|
|
71
72
|
function C(e, t) {
|
|
72
73
|
return t.anchorId ? e.root.querySelector(`[id="${t.anchorId}"]`) : null;
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
+
function _(e) {
|
|
75
76
|
const t = [];
|
|
76
77
|
return e.comments.forEach((r) => {
|
|
77
78
|
if (r.anchorId) {
|
|
@@ -83,20 +84,20 @@ function O(e) {
|
|
|
83
84
|
}), t;
|
|
84
85
|
}
|
|
85
86
|
function A(e, t) {
|
|
86
|
-
const r =
|
|
87
|
-
return r && r.innerHTML !== o && (
|
|
87
|
+
const r = F(e), o = r ? r.innerHTML : "", a = t();
|
|
88
|
+
return r && r.innerHTML !== o && ($(r, o), r.dispatchEvent(new Event("input", { bubbles: !0 }))), a;
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function I(e, t) {
|
|
90
91
|
const r = C(e, t);
|
|
91
92
|
r && r.classList.toggle("rte-comment-anchor-resolved", t.resolved);
|
|
92
93
|
}
|
|
93
94
|
function E(e, t, r) {
|
|
94
95
|
const o = e.comments.get(t);
|
|
95
96
|
if (!o) return;
|
|
96
|
-
const
|
|
97
|
-
|
|
97
|
+
const a = C(e, o);
|
|
98
|
+
a && a.classList.toggle("highlighted", r);
|
|
98
99
|
}
|
|
99
|
-
function
|
|
100
|
+
function j(e) {
|
|
100
101
|
const t = e.parentNode;
|
|
101
102
|
if (t) {
|
|
102
103
|
for (; e.firstChild; )
|
|
@@ -106,34 +107,37 @@ function P(e) {
|
|
|
106
107
|
}
|
|
107
108
|
function w(e, t) {
|
|
108
109
|
if (e.panelVisible = t, t) {
|
|
109
|
-
|
|
110
|
+
re(), Z(e), e.root.setAttribute("data-rte-comments-open", "true"), e.panelElement && (e.panelElement.classList.add("is-open"), e.panelElement.setAttribute("aria-hidden", "false")), K(e), M(e.panelElement);
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
|
-
e.root.removeAttribute("data-rte-comments-open"),
|
|
113
|
+
if (e.root.removeAttribute("data-rte-comments-open"), U(e), e.panelElement) {
|
|
114
|
+
const r = N(e.panelElement);
|
|
115
|
+
e.panelElement.remove(), e.panelElement = null, r && e.root.querySelector('[contenteditable="true"]')?.focus({ preventScroll: !0 });
|
|
116
|
+
}
|
|
113
117
|
}
|
|
114
|
-
function
|
|
118
|
+
function Z(e) {
|
|
115
119
|
if (e.panelElement) return;
|
|
116
120
|
const t = document.createElement("aside");
|
|
117
121
|
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;
|
|
118
122
|
}
|
|
119
|
-
function
|
|
123
|
+
function K(e) {
|
|
120
124
|
e.selectionChangeListener || (e.selectionChangeListener = () => {
|
|
121
125
|
const t = window.getSelection();
|
|
122
126
|
if (!t || t.rangeCount === 0 || t.isCollapsed) return;
|
|
123
127
|
const r = t.getRangeAt(0);
|
|
124
|
-
k(r, e.root) && (e.savedSelection = r.cloneRange(),
|
|
128
|
+
k(r, e.root) && (e.savedSelection = r.cloneRange(), h = e.root);
|
|
125
129
|
}, document.addEventListener("selectionchange", e.selectionChangeListener));
|
|
126
130
|
}
|
|
127
|
-
function
|
|
131
|
+
function U(e) {
|
|
128
132
|
e.selectionChangeListener && (document.removeEventListener("selectionchange", e.selectionChangeListener), e.selectionChangeListener = null);
|
|
129
133
|
}
|
|
130
|
-
function
|
|
131
|
-
return
|
|
134
|
+
function W(e) {
|
|
135
|
+
return _(e).sort((t, r) => r.createdAt.localeCompare(t.createdAt));
|
|
132
136
|
}
|
|
133
137
|
function B(e) {
|
|
134
138
|
return new Date(e).toLocaleString();
|
|
135
139
|
}
|
|
136
|
-
function
|
|
140
|
+
function X(e, t) {
|
|
137
141
|
const r = e.expandedComments.has(t.id), o = document.createElement("article");
|
|
138
142
|
o.className = `rte-comment-item${t.resolved ? " resolved" : ""}`, o.innerHTML = `
|
|
139
143
|
<header class="rte-comment-header">
|
|
@@ -149,84 +153,85 @@ function K(e, t) {
|
|
|
149
153
|
${t.selectedText ? '<blockquote class="rte-comment-selection"></blockquote>' : ""}
|
|
150
154
|
<section class="rte-comment-expanded${r ? " show" : ""}"></section>
|
|
151
155
|
`;
|
|
152
|
-
const
|
|
153
|
-
|
|
156
|
+
const a = o.querySelector(".rte-comment-author");
|
|
157
|
+
a && (a.textContent = t.author);
|
|
154
158
|
const c = o.querySelector(".rte-comment-text");
|
|
155
159
|
c && (c.textContent = t.text);
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
e.expandedComments.has(t.id) ? e.expandedComments.delete(t.id) : e.expandedComments.add(t.id),
|
|
160
|
+
const p = o.querySelector(".rte-comment-selection");
|
|
161
|
+
p && (p.textContent = t.selectedText), o.querySelector(".rte-comment-expand")?.addEventListener("click", () => {
|
|
162
|
+
e.expandedComments.has(t.id) ? e.expandedComments.delete(t.id) : e.expandedComments.add(t.id), s(e);
|
|
159
163
|
});
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
164
|
+
const d = o.querySelector(".rte-comment-expanded");
|
|
165
|
+
if (d && r) {
|
|
162
166
|
if (t.replies.length > 0) {
|
|
163
|
-
const
|
|
164
|
-
|
|
167
|
+
const n = document.createElement("div");
|
|
168
|
+
n.className = "rte-comment-replies", t.replies.forEach((l) => {
|
|
165
169
|
const m = document.createElement("div");
|
|
166
170
|
m.className = "rte-comment-reply", m.innerHTML = `
|
|
167
171
|
<div class="rte-comment-reply-header">
|
|
168
172
|
<strong class="rte-comment-reply-author"></strong>
|
|
169
|
-
<time>${B(
|
|
173
|
+
<time>${B(l.createdAt)}</time>
|
|
170
174
|
</div>
|
|
171
175
|
<div class="rte-comment-reply-text"></div>
|
|
172
176
|
`;
|
|
173
177
|
const v = m.querySelector(".rte-comment-reply-author");
|
|
174
|
-
v && (v.textContent =
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
}),
|
|
178
|
+
v && (v.textContent = l.author);
|
|
179
|
+
const b = m.querySelector(".rte-comment-reply-text");
|
|
180
|
+
b && (b.textContent = l.text), n.appendChild(m);
|
|
181
|
+
}), d.appendChild(n);
|
|
178
182
|
}
|
|
179
183
|
if (!t.resolved) {
|
|
180
|
-
const
|
|
181
|
-
|
|
184
|
+
const n = document.createElement("div");
|
|
185
|
+
n.className = "rte-comment-reply-composer", n.innerHTML = `
|
|
182
186
|
<textarea class="rte-comment-reply-textarea" rows="2" placeholder="Reply..."></textarea>
|
|
183
187
|
<button type="button" class="rte-comment-btn primary">Reply</button>
|
|
184
188
|
`;
|
|
185
|
-
const
|
|
189
|
+
const l = n.querySelector(
|
|
186
190
|
".rte-comment-reply-textarea"
|
|
187
|
-
), m =
|
|
191
|
+
), m = n.querySelector(
|
|
188
192
|
".rte-comment-btn.primary"
|
|
189
193
|
);
|
|
190
|
-
if (
|
|
191
|
-
|
|
194
|
+
if (l && m) {
|
|
195
|
+
l.value = e.replyTexts[t.id] || "";
|
|
192
196
|
const v = () => {
|
|
193
|
-
const
|
|
194
|
-
m.disabled = !
|
|
197
|
+
const b = !!l.value.trim();
|
|
198
|
+
m.disabled = !b;
|
|
195
199
|
};
|
|
196
|
-
v(),
|
|
197
|
-
e.replyTexts[t.id] =
|
|
200
|
+
v(), l.addEventListener("input", () => {
|
|
201
|
+
e.replyTexts[t.id] = l.value, v();
|
|
198
202
|
}), m.addEventListener("click", () => {
|
|
199
|
-
const
|
|
200
|
-
|
|
203
|
+
const b = l.value.trim();
|
|
204
|
+
b && (te(t.id, T, b), e.replyTexts[t.id] = "", s(e));
|
|
201
205
|
});
|
|
202
206
|
}
|
|
203
|
-
|
|
207
|
+
d.appendChild(n);
|
|
204
208
|
}
|
|
205
|
-
const
|
|
206
|
-
if (
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
},
|
|
209
|
+
const i = document.createElement("div");
|
|
210
|
+
if (i.className = "rte-comment-actions", t.anchorId) {
|
|
211
|
+
const n = document.createElement("button");
|
|
212
|
+
n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Jump to text", n.onclick = () => {
|
|
213
|
+
const l = C(e, t);
|
|
214
|
+
l && (l.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), E(e, t.id, !0), window.setTimeout(() => E(e, t.id, !1), 1200));
|
|
215
|
+
}, i.appendChild(n);
|
|
212
216
|
}
|
|
213
217
|
if (t.resolved) {
|
|
214
|
-
const
|
|
215
|
-
|
|
218
|
+
const n = document.createElement("button");
|
|
219
|
+
n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () => Y(t.id), i.appendChild(n);
|
|
216
220
|
} else {
|
|
217
|
-
const
|
|
218
|
-
|
|
221
|
+
const n = document.createElement("button");
|
|
222
|
+
n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () => Q(t.id, T), i.appendChild(n);
|
|
219
223
|
}
|
|
220
|
-
const
|
|
221
|
-
|
|
224
|
+
const x = document.createElement("button");
|
|
225
|
+
x.type = "button", x.className = "rte-comment-btn danger", x.textContent = "Delete", x.onclick = () => ee(t.id), i.appendChild(x), d.appendChild(i);
|
|
222
226
|
}
|
|
223
227
|
return o.addEventListener("mouseenter", () => E(e, t.id, !0)), o.addEventListener("mouseleave", () => E(e, t.id, !1)), o;
|
|
224
228
|
}
|
|
225
|
-
function
|
|
229
|
+
function s(e) {
|
|
226
230
|
const t = e || u();
|
|
227
231
|
if (!t?.panelElement) return;
|
|
228
|
-
const r =
|
|
229
|
-
|
|
232
|
+
const r = W(t), o = t.panelElement;
|
|
233
|
+
D(o, () => {
|
|
234
|
+
o.innerHTML = `
|
|
230
235
|
<div class="rte-comments-header">
|
|
231
236
|
<div>
|
|
232
237
|
<h3>Comments (${r.length})</h3>
|
|
@@ -241,65 +246,66 @@ function d(e) {
|
|
|
241
246
|
</div>
|
|
242
247
|
</div>
|
|
243
248
|
${r.length === 0 ? '<div class="rte-comments-empty">No comments yet.</div>' : '<div class="rte-comments-list"></div>'}
|
|
244
|
-
|
|
245
|
-
|
|
249
|
+
`;
|
|
250
|
+
}), t.panelElement.querySelector(".rte-comments-close")?.addEventListener("click", () => {
|
|
251
|
+
w(t, !1), (!t.root.contains(document.activeElement) || document.activeElement === document.body) && t.root.querySelector('[contenteditable="true"]')?.focus({ preventScroll: !0 });
|
|
246
252
|
});
|
|
247
|
-
const
|
|
253
|
+
const c = t.panelElement.querySelector(
|
|
248
254
|
".new-comment-textarea"
|
|
249
|
-
),
|
|
255
|
+
), p = t.panelElement.querySelector(
|
|
250
256
|
".add-comment-btn"
|
|
251
257
|
);
|
|
252
|
-
if (
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
const
|
|
256
|
-
|
|
258
|
+
if (c && p) {
|
|
259
|
+
c.value = t.newCommentText;
|
|
260
|
+
const d = () => {
|
|
261
|
+
const i = !!c.value.trim();
|
|
262
|
+
p.disabled = !i;
|
|
257
263
|
};
|
|
258
|
-
|
|
259
|
-
t.newCommentText =
|
|
260
|
-
}),
|
|
261
|
-
(
|
|
262
|
-
}),
|
|
263
|
-
const
|
|
264
|
-
if (!
|
|
265
|
-
const
|
|
266
|
-
|
|
264
|
+
d(), c.addEventListener("input", () => {
|
|
265
|
+
t.newCommentText = c.value, d();
|
|
266
|
+
}), c.addEventListener("keydown", (i) => {
|
|
267
|
+
(i.ctrlKey || i.metaKey) && i.key === "Enter" && (i.preventDefault(), p.click());
|
|
268
|
+
}), p.addEventListener("click", () => {
|
|
269
|
+
const i = c.value.trim();
|
|
270
|
+
if (!i) return;
|
|
271
|
+
const x = !!t.savedSelection;
|
|
272
|
+
J(T, i, !x), t.newCommentText = "", s(t);
|
|
267
273
|
});
|
|
268
274
|
}
|
|
269
275
|
const f = t.panelElement.querySelector(".rte-comments-list");
|
|
270
|
-
f && r.forEach((
|
|
271
|
-
f.appendChild(
|
|
276
|
+
f && r.forEach((d) => {
|
|
277
|
+
f.appendChild(X(t, d));
|
|
272
278
|
});
|
|
273
279
|
}
|
|
274
280
|
const L = /* @__PURE__ */ new WeakMap();
|
|
275
|
-
function
|
|
281
|
+
function G(e) {
|
|
276
282
|
L.has(e) || L.set(
|
|
277
283
|
e,
|
|
278
284
|
window.setTimeout(() => {
|
|
279
|
-
L.delete(e), e.panelVisible &&
|
|
285
|
+
L.delete(e), e.panelVisible && s(e);
|
|
280
286
|
}, 120)
|
|
281
287
|
);
|
|
282
288
|
}
|
|
283
|
-
function
|
|
289
|
+
function z() {
|
|
284
290
|
R || (R = !0, document.addEventListener("focusin", (e) => {
|
|
285
|
-
const t =
|
|
286
|
-
t && (
|
|
291
|
+
const t = g(e.target);
|
|
292
|
+
t && (h = t);
|
|
287
293
|
}), document.addEventListener("click", (e) => {
|
|
288
294
|
const r = (e.target instanceof Element ? e.target : null)?.closest(".rte-comment-anchor");
|
|
289
295
|
if (!r) return;
|
|
290
|
-
const o =
|
|
291
|
-
!
|
|
296
|
+
const o = g(r), a = o ? y.get(o) : null, c = r.getAttribute("data-comment-id");
|
|
297
|
+
!a || !c || !a.comments.has(c) || (e.preventDefault(), e.stopPropagation(), h = a.root, a.expandedComments.add(c), w(a, !0), s(a));
|
|
292
298
|
}), document.addEventListener("input", (e) => {
|
|
293
299
|
const t = e.target instanceof Element ? e.target : null;
|
|
294
300
|
if (!t || t.closest(".rte-comments-panel")) return;
|
|
295
|
-
const r =
|
|
296
|
-
o?.panelVisible &&
|
|
301
|
+
const r = g(t), o = r ? y.get(r) : null;
|
|
302
|
+
o?.panelVisible && G(o);
|
|
297
303
|
}), document.addEventListener("selectionchange", () => {
|
|
298
304
|
const e = window.getSelection();
|
|
299
305
|
if (!e || e.rangeCount === 0) return;
|
|
300
|
-
const t = e.getRangeAt(0), r =
|
|
306
|
+
const t = e.getRangeAt(0), r = g(t.commonAncestorContainer);
|
|
301
307
|
if (!r) return;
|
|
302
|
-
|
|
308
|
+
h = r;
|
|
303
309
|
const o = y.get(r);
|
|
304
310
|
!o || e.isCollapsed || k(t, r) && (o.savedSelection = t.cloneRange());
|
|
305
311
|
}), document.addEventListener(
|
|
@@ -312,86 +318,86 @@ function V() {
|
|
|
312
318
|
!0
|
|
313
319
|
));
|
|
314
320
|
}
|
|
315
|
-
function
|
|
321
|
+
function J(e, t, r = !1) {
|
|
316
322
|
const o = u();
|
|
317
323
|
if (!o) return "";
|
|
318
|
-
const
|
|
319
|
-
if (!
|
|
324
|
+
const a = t.trim();
|
|
325
|
+
if (!a) return "";
|
|
320
326
|
if (r) {
|
|
321
|
-
const
|
|
322
|
-
return o.comments.set(
|
|
323
|
-
id:
|
|
327
|
+
const l = S("comment");
|
|
328
|
+
return o.comments.set(l, {
|
|
329
|
+
id: l,
|
|
324
330
|
anchorId: "",
|
|
325
331
|
selectedText: "",
|
|
326
332
|
author: e,
|
|
327
|
-
text:
|
|
333
|
+
text: a,
|
|
328
334
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
329
335
|
resolved: !1,
|
|
330
336
|
replies: []
|
|
331
|
-
}),
|
|
337
|
+
}), s(o), l;
|
|
332
338
|
}
|
|
333
|
-
const c = o.savedSelection ||
|
|
339
|
+
const c = o.savedSelection || V(o.root);
|
|
334
340
|
if (!c || !k(c, o.root)) return "";
|
|
335
|
-
const
|
|
336
|
-
if (!
|
|
337
|
-
const
|
|
338
|
-
return
|
|
341
|
+
const p = c.toString().trim();
|
|
342
|
+
if (!p) return "";
|
|
343
|
+
const f = S("comment"), d = S("comment-anchor"), i = document.createElement("span");
|
|
344
|
+
return i.id = d, i.className = "rte-comment-anchor", i.setAttribute("data-comment-id", f), i.setAttribute("title", "Commented text"), A(o, () => {
|
|
339
345
|
try {
|
|
340
|
-
const
|
|
341
|
-
return m.textContent?.trim() ? (
|
|
346
|
+
const l = c.cloneRange(), m = l.extractContents();
|
|
347
|
+
return m.textContent?.trim() ? (i.appendChild(m), l.insertNode(i), !0) : !1;
|
|
342
348
|
} catch {
|
|
343
349
|
return !1;
|
|
344
350
|
}
|
|
345
|
-
}) ? (o.comments.set(
|
|
346
|
-
id:
|
|
347
|
-
anchorId:
|
|
348
|
-
selectedText:
|
|
351
|
+
}) ? (o.comments.set(f, {
|
|
352
|
+
id: f,
|
|
353
|
+
anchorId: d,
|
|
354
|
+
selectedText: p,
|
|
349
355
|
author: e,
|
|
350
|
-
text:
|
|
356
|
+
text: a,
|
|
351
357
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
352
358
|
resolved: !1,
|
|
353
359
|
replies: []
|
|
354
|
-
}), o.savedSelection = null, window.getSelection()?.removeAllRanges(),
|
|
360
|
+
}), o.savedSelection = null, window.getSelection()?.removeAllRanges(), s(o), f) : "";
|
|
355
361
|
}
|
|
356
|
-
function
|
|
362
|
+
function Q(e, t) {
|
|
357
363
|
const r = u();
|
|
358
364
|
if (!r) return;
|
|
359
365
|
const o = r.comments.get(e);
|
|
360
|
-
o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), A(r, () =>
|
|
366
|
+
o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), A(r, () => I(r, o)), s(r));
|
|
361
367
|
}
|
|
362
|
-
function
|
|
368
|
+
function Y(e) {
|
|
363
369
|
const t = u();
|
|
364
370
|
if (!t) return;
|
|
365
371
|
const r = t.comments.get(e);
|
|
366
|
-
r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, A(t, () =>
|
|
372
|
+
r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, A(t, () => I(t, r)), s(t));
|
|
367
373
|
}
|
|
368
|
-
function
|
|
374
|
+
function ee(e) {
|
|
369
375
|
const t = u();
|
|
370
376
|
if (!t) return;
|
|
371
377
|
const r = t.comments.get(e);
|
|
372
378
|
if (r) {
|
|
373
379
|
if (r.anchorId) {
|
|
374
380
|
const o = C(t, r);
|
|
375
|
-
o && A(t, () =>
|
|
381
|
+
o && A(t, () => j(o));
|
|
376
382
|
} else
|
|
377
383
|
t.comments.delete(e), t.expandedComments.delete(e), delete t.replyTexts[e];
|
|
378
|
-
|
|
384
|
+
s(t);
|
|
379
385
|
}
|
|
380
386
|
}
|
|
381
|
-
function
|
|
387
|
+
function te(e, t, r) {
|
|
382
388
|
const o = u();
|
|
383
389
|
if (!o) return;
|
|
384
|
-
const
|
|
385
|
-
if (!
|
|
390
|
+
const a = o.comments.get(e);
|
|
391
|
+
if (!a) return;
|
|
386
392
|
const c = r.trim();
|
|
387
|
-
c && (
|
|
393
|
+
c && (a.replies.push({
|
|
388
394
|
id: S("reply"),
|
|
389
395
|
author: t,
|
|
390
396
|
text: c,
|
|
391
397
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
392
|
-
}),
|
|
398
|
+
}), s(o));
|
|
393
399
|
}
|
|
394
|
-
function
|
|
400
|
+
function re() {
|
|
395
401
|
if (document.getElementById("rte-comments-panel-styles")) return;
|
|
396
402
|
const e = document.createElement("style");
|
|
397
403
|
e.id = "rte-comments-panel-styles", e.textContent = `
|
|
@@ -412,7 +418,9 @@ function Y() {
|
|
|
412
418
|
opacity: 0;
|
|
413
419
|
pointer-events: none;
|
|
414
420
|
transition: transform 180ms ease, opacity 180ms ease;
|
|
415
|
-
z-index:
|
|
421
|
+
/* Above the editor's sticky toolbar (z-index 100): on a narrow screen the panel lies over the editor, and
|
|
422
|
+
under the toolbar its header, and the button that closes it, could not be clicked. */
|
|
423
|
+
z-index: 110;
|
|
416
424
|
}
|
|
417
425
|
|
|
418
426
|
.rte-comments-panel.is-open {
|
|
@@ -421,7 +429,16 @@ function Y() {
|
|
|
421
429
|
pointer-events: auto;
|
|
422
430
|
}
|
|
423
431
|
|
|
424
|
-
|
|
432
|
+
/* The panel's width is set on the editor itself, not only on the panel: the toolbar and the text make room for the
|
|
433
|
+
panel with a margin of that width, and a variable set on the panel is not visible to them (the margin was
|
|
434
|
+
silently 0, so the panel lay over the toolbar and the text and its header could not be reached). */
|
|
435
|
+
[data-rte-comments-open="true"] {
|
|
436
|
+
--rte-comments-panel-width: min(360px, 42vw);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* The toolbar's wrapper is the element that is as wide as the editor, and it sits above the panel (it is sticky,
|
|
440
|
+
z-index 100): it has to give up the panel's width too, or its empty right-hand end covers the panel's header. */
|
|
441
|
+
[data-rte-comments-open="true"] :is(.rte-toolbar-wrapper, .rte-toolbar:not(.rte-toolbar-wrapper .rte-toolbar), .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
|
|
425
442
|
margin-right: var(--rte-comments-panel-width);
|
|
426
443
|
transition: margin-right 180ms ease;
|
|
427
444
|
}
|
|
@@ -702,17 +719,18 @@ function Y() {
|
|
|
702
719
|
}
|
|
703
720
|
|
|
704
721
|
@media (max-width: 900px) {
|
|
722
|
+
[data-rte-comments-open="true"],
|
|
705
723
|
.rte-comments-panel {
|
|
706
724
|
--rte-comments-panel-width: min(420px, 100%);
|
|
707
725
|
}
|
|
708
726
|
|
|
709
|
-
[data-rte-comments-open="true"] :is(.rte-toolbar, .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
|
|
727
|
+
[data-rte-comments-open="true"] :is(.rte-toolbar-wrapper, .rte-toolbar:not(.rte-toolbar-wrapper .rte-toolbar), .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
|
|
710
728
|
margin-right: 0;
|
|
711
729
|
}
|
|
712
730
|
}
|
|
713
731
|
`, document.head.appendChild(e);
|
|
714
732
|
}
|
|
715
|
-
const
|
|
733
|
+
const ae = () => ({
|
|
716
734
|
name: "comments",
|
|
717
735
|
toolbar: [
|
|
718
736
|
{
|
|
@@ -738,20 +756,20 @@ const te = () => ({
|
|
|
738
756
|
],
|
|
739
757
|
commands: {
|
|
740
758
|
addComment: (e, t) => {
|
|
741
|
-
q(t),
|
|
759
|
+
q(t), z();
|
|
742
760
|
const r = u();
|
|
743
|
-
return r ? (r.savedSelection =
|
|
761
|
+
return r ? (r.savedSelection = V(r.root), r.savedSelection && window.getSelection()?.removeAllRanges(), w(r, !0), s(r), r.panelElement?.querySelector(
|
|
744
762
|
".new-comment-textarea"
|
|
745
763
|
)?.focus({ preventScroll: !0 }), !0) : !1;
|
|
746
764
|
},
|
|
747
765
|
toggleComments: (e, t) => {
|
|
748
|
-
q(t),
|
|
766
|
+
q(t), z();
|
|
749
767
|
const r = u();
|
|
750
|
-
return r ? (w(r, !r.panelVisible), r.panelVisible &&
|
|
768
|
+
return r ? (w(r, !r.panelVisible), r.panelVisible && s(r), !0) : !1;
|
|
751
769
|
}
|
|
752
770
|
},
|
|
753
771
|
keymap: {}
|
|
754
772
|
});
|
|
755
773
|
export {
|
|
756
|
-
|
|
774
|
+
ae as CommentsPlugin
|
|
757
775
|
};
|