@editora/plugins 1.0.6 → 1.0.8
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 +57 -4
- package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/anchor.cjs.js +11 -11
- package/dist/anchor.esm.js +130 -107
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/background-color.cjs.js +3 -3
- package/dist/background-color.esm.js +116 -119
- package/dist/code.cjs.js +82 -102
- package/dist/code.esm.js +1172 -662
- package/dist/comments.cjs.js +10 -10
- package/dist/comments.esm.js +195 -177
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/embed-iframe.cjs.js +2 -2
- package/dist/embed-iframe.esm.js +8 -5
- package/dist/emojis.cjs.js +64 -39
- package/dist/emojis.esm.js +133 -104
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/html2canvas.esm-BWVIUcAF.mjs +4802 -0
- package/dist/{index-Bskk414V.mjs → index-BFsKNTTj.mjs} +50 -50
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-Cz1qItab.js → index.es-CE_A4QSm.js} +5 -5
- package/dist/{index.es-DEcRmSTY.mjs → index.es-DQ78mYYo.mjs} +4 -3
- package/dist/index.esm.js +87 -79
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/jspdf.es.min-DQCoX5yh.mjs +7889 -0
- package/dist/link.cjs.js +6 -6
- package/dist/link.esm.js +41 -39
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +151 -112
- package/dist/media-manager.cjs.js +15 -15
- package/dist/media-manager.esm.js +227 -206
- package/dist/merge-tag.cjs.js +44 -12
- package/dist/merge-tag.esm.js +368 -241
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +77 -69
- package/dist/special-characters.cjs.js +83 -45
- package/dist/special-characters.esm.js +149 -100
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +235 -216
- package/dist/template.cjs.js +14 -14
- package/dist/template.esm.js +157 -131
- package/dist/text-color.cjs.js +9 -9
- package/dist/text-color.esm.js +131 -115
- package/index.d.ts +51 -1
- package/package.json +6 -4
- package/dist/colorSelectionApply-C0iOfMWb.js +0 -1
- package/dist/colorSelectionApply-D8r_gV32.mjs +0 -63
- package/dist/documentManager-DRUc1-Cs.mjs +0 -37581
- package/dist/documentManager-_tQQfQi9.js +0 -317
- package/dist/index-D3pJyAsj.js +0 -1
package/dist/comments.esm.js
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
const C = /* @__PURE__ */ new WeakMap();
|
|
2
2
|
let x = null, S = !1, k = 0;
|
|
3
3
|
const E = "User";
|
|
4
|
-
function
|
|
5
|
-
return k += 1, `${
|
|
4
|
+
function v(t) {
|
|
5
|
+
return k += 1, `${t}-${Date.now()}-${k}`;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
if (!
|
|
9
|
-
const
|
|
10
|
-
return
|
|
7
|
+
function y(t) {
|
|
8
|
+
if (!t) return null;
|
|
9
|
+
const e = t instanceof Element ? t : t.parentElement;
|
|
10
|
+
return e ? e.closest("[data-editora-editor]") || e.closest(".rte-editor") || e.closest(".editora-editor") : null;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
12
|
+
function A(t) {
|
|
13
|
+
const e = t?.editorElement || t?.contentElement || null;
|
|
14
|
+
if (!(e instanceof HTMLElement)) return;
|
|
15
|
+
const r = e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? e : null);
|
|
16
|
+
r && (x = r);
|
|
14
17
|
}
|
|
15
|
-
function
|
|
18
|
+
function w(t, e) {
|
|
19
|
+
return e.contains(t.commonAncestorContainer);
|
|
20
|
+
}
|
|
21
|
+
function B() {
|
|
16
22
|
if (typeof window < "u") {
|
|
17
23
|
const o = window.__editoraCommandEditorRoot;
|
|
18
24
|
if (o instanceof HTMLElement) {
|
|
@@ -21,22 +27,22 @@ function I() {
|
|
|
21
27
|
return x = a, window.__editoraCommandEditorRoot = null, a;
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
30
|
+
const t = document.activeElement, e = t ? y(t) : null;
|
|
31
|
+
if (e) return e;
|
|
26
32
|
const r = window.getSelection();
|
|
27
33
|
if (r && r.rangeCount > 0) {
|
|
28
|
-
const o =
|
|
34
|
+
const o = y(
|
|
29
35
|
r.getRangeAt(0).commonAncestorContainer
|
|
30
36
|
);
|
|
31
37
|
if (o) return o;
|
|
32
38
|
}
|
|
33
39
|
return x;
|
|
34
40
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
41
|
+
function H(t) {
|
|
42
|
+
const e = C.get(t);
|
|
43
|
+
if (e) return e;
|
|
38
44
|
const r = {
|
|
39
|
-
root:
|
|
45
|
+
root: t,
|
|
40
46
|
comments: /* @__PURE__ */ new Map(),
|
|
41
47
|
panelVisible: !1,
|
|
42
48
|
panelElement: null,
|
|
@@ -46,107 +52,111 @@ function B(e) {
|
|
|
46
52
|
newCommentText: "",
|
|
47
53
|
selectionChangeListener: null
|
|
48
54
|
};
|
|
49
|
-
return C.set(
|
|
55
|
+
return C.set(t, r), r;
|
|
50
56
|
}
|
|
51
|
-
function
|
|
52
|
-
const
|
|
53
|
-
return
|
|
57
|
+
function u() {
|
|
58
|
+
const t = B();
|
|
59
|
+
return t ? (x = t, H(t)) : null;
|
|
54
60
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
58
|
-
const r =
|
|
59
|
-
return w(r,
|
|
61
|
+
function R(t) {
|
|
62
|
+
const e = window.getSelection();
|
|
63
|
+
if (!e || e.rangeCount === 0 || e.isCollapsed) return null;
|
|
64
|
+
const r = e.getRangeAt(0);
|
|
65
|
+
return w(r, t) ? r.cloneRange() : null;
|
|
60
66
|
}
|
|
61
|
-
function
|
|
62
|
-
if (!
|
|
63
|
-
const r =
|
|
64
|
-
r && r.classList.toggle("rte-comment-anchor-resolved",
|
|
67
|
+
function I(t, e) {
|
|
68
|
+
if (!e.anchorId) return;
|
|
69
|
+
const r = t.root.querySelector(`#${e.anchorId}`);
|
|
70
|
+
r && r.classList.toggle("rte-comment-anchor-resolved", e.resolved);
|
|
65
71
|
}
|
|
66
|
-
function
|
|
67
|
-
const o =
|
|
72
|
+
function h(t, e, r) {
|
|
73
|
+
const o = t.comments.get(e);
|
|
68
74
|
if (!o || !o.anchorId) return;
|
|
69
|
-
const a =
|
|
75
|
+
const a = t.root.querySelector(`#${o.anchorId}`);
|
|
70
76
|
a && a.classList.toggle("highlighted", r);
|
|
71
77
|
}
|
|
72
|
-
function $(
|
|
73
|
-
|
|
74
|
-
o.preventDefault(), o.stopPropagation(), x =
|
|
78
|
+
function $(t, e, r) {
|
|
79
|
+
e.onclick = (o) => {
|
|
80
|
+
o.preventDefault(), o.stopPropagation(), x = t.root, t.expandedComments.add(r), g(t, !0), m(t);
|
|
75
81
|
};
|
|
76
82
|
}
|
|
77
|
-
function q(
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
for (;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
function q(t) {
|
|
84
|
+
const e = t.parentNode;
|
|
85
|
+
if (e) {
|
|
86
|
+
for (; t.firstChild; )
|
|
87
|
+
e.insertBefore(t.firstChild, t);
|
|
88
|
+
t.remove();
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
91
|
+
function g(t, e) {
|
|
92
|
+
if (t.panelVisible = e, e) {
|
|
93
|
+
Z(), N(t), t.root.setAttribute("data-rte-comments-open", "true"), t.panelElement && (t.panelElement.classList.add("is-open"), t.panelElement.setAttribute("aria-hidden", "false")), z(t);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
t.root.removeAttribute("data-rte-comments-open"), V(t), t.panelElement && (t.panelElement.remove(), t.panelElement = null);
|
|
87
97
|
}
|
|
88
|
-
function
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
91
|
-
|
|
98
|
+
function N(t) {
|
|
99
|
+
if (t.panelElement) return;
|
|
100
|
+
const e = document.createElement("aside");
|
|
101
|
+
e.className = "rte-comments-panel", e.setAttribute("role", "complementary"), e.setAttribute("aria-label", "Comments"), e.setAttribute("aria-hidden", "true"), window.getComputedStyle(t.root).position === "static" && (t.root.style.position = "relative"), t.root.appendChild(e), t.panelElement = e;
|
|
92
102
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
97
|
-
const r =
|
|
98
|
-
w(r,
|
|
99
|
-
}, document.addEventListener("selectionchange",
|
|
103
|
+
function z(t) {
|
|
104
|
+
t.selectionChangeListener || (t.selectionChangeListener = () => {
|
|
105
|
+
const e = window.getSelection();
|
|
106
|
+
if (!e || e.rangeCount === 0 || e.isCollapsed) return;
|
|
107
|
+
const r = e.getRangeAt(0);
|
|
108
|
+
w(r, t.root) && (t.savedSelection = r.cloneRange(), x = t.root);
|
|
109
|
+
}, document.addEventListener("selectionchange", t.selectionChangeListener));
|
|
100
110
|
}
|
|
101
|
-
function
|
|
102
|
-
|
|
111
|
+
function V(t) {
|
|
112
|
+
t.selectionChangeListener && (document.removeEventListener("selectionchange", t.selectionChangeListener), t.selectionChangeListener = null);
|
|
103
113
|
}
|
|
104
|
-
function
|
|
105
|
-
return Array.from(
|
|
106
|
-
(
|
|
114
|
+
function M(t) {
|
|
115
|
+
return Array.from(t.comments.values()).sort(
|
|
116
|
+
(e, r) => r.createdAt.localeCompare(e.createdAt)
|
|
107
117
|
);
|
|
108
118
|
}
|
|
109
|
-
function
|
|
110
|
-
return new Date(
|
|
119
|
+
function L(t) {
|
|
120
|
+
return new Date(t).toLocaleString();
|
|
111
121
|
}
|
|
112
|
-
function
|
|
113
|
-
const r =
|
|
114
|
-
o.className = `rte-comment-item${
|
|
122
|
+
function D(t, e) {
|
|
123
|
+
const r = t.expandedComments.has(e.id), o = document.createElement("article");
|
|
124
|
+
o.className = `rte-comment-item${e.resolved ? " resolved" : ""}`, o.innerHTML = `
|
|
115
125
|
<header class="rte-comment-header">
|
|
116
126
|
<div class="rte-comment-meta">
|
|
117
|
-
<strong class="rte-comment-author">${
|
|
118
|
-
<time class="rte-comment-date">${
|
|
127
|
+
<strong class="rte-comment-author">${e.author}</strong>
|
|
128
|
+
<time class="rte-comment-date">${L(e.createdAt)}</time>
|
|
119
129
|
</div>
|
|
120
130
|
<button class="rte-comment-expand" type="button" aria-label="Toggle details">
|
|
121
131
|
${r ? "▾" : "▸"}
|
|
122
132
|
</button>
|
|
123
133
|
</header>
|
|
124
134
|
<div class="rte-comment-text"></div>
|
|
125
|
-
${
|
|
135
|
+
${e.selectedText ? `<blockquote class="rte-comment-selection">${e.selectedText}</blockquote>` : ""}
|
|
126
136
|
<section class="rte-comment-expanded${r ? " show" : ""}"></section>
|
|
127
137
|
`;
|
|
128
138
|
const a = o.querySelector(".rte-comment-text");
|
|
129
|
-
a && (a.textContent =
|
|
130
|
-
|
|
139
|
+
a && (a.textContent = e.text), o.querySelector(".rte-comment-expand")?.addEventListener("click", () => {
|
|
140
|
+
t.expandedComments.has(e.id) ? t.expandedComments.delete(e.id) : t.expandedComments.add(e.id), m(t);
|
|
131
141
|
});
|
|
132
142
|
const p = o.querySelector(".rte-comment-expanded");
|
|
133
143
|
if (p && r) {
|
|
134
|
-
if (
|
|
144
|
+
if (e.replies.length > 0) {
|
|
135
145
|
const n = document.createElement("div");
|
|
136
|
-
n.className = "rte-comment-replies",
|
|
146
|
+
n.className = "rte-comment-replies", e.replies.forEach((s) => {
|
|
137
147
|
const l = document.createElement("div");
|
|
138
148
|
l.className = "rte-comment-reply", l.innerHTML = `
|
|
139
149
|
<div class="rte-comment-reply-header">
|
|
140
150
|
<strong>${s.author}</strong>
|
|
141
|
-
<time>${
|
|
151
|
+
<time>${L(s.createdAt)}</time>
|
|
142
152
|
</div>
|
|
143
153
|
<div class="rte-comment-reply-text"></div>
|
|
144
154
|
`;
|
|
145
|
-
const
|
|
146
|
-
|
|
155
|
+
const f = l.querySelector(".rte-comment-reply-text");
|
|
156
|
+
f && (f.textContent = s.text), n.appendChild(l);
|
|
147
157
|
}), p.appendChild(n);
|
|
148
158
|
}
|
|
149
|
-
if (!
|
|
159
|
+
if (!e.resolved) {
|
|
150
160
|
const n = document.createElement("div");
|
|
151
161
|
n.className = "rte-comment-reply-composer", n.innerHTML = `
|
|
152
162
|
<textarea class="rte-comment-reply-textarea" rows="2" placeholder="Reply..."></textarea>
|
|
@@ -158,45 +168,45 @@ function M(e, t) {
|
|
|
158
168
|
".rte-comment-btn.primary"
|
|
159
169
|
);
|
|
160
170
|
if (s && l) {
|
|
161
|
-
s.value =
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
l.disabled = !
|
|
171
|
+
s.value = t.replyTexts[e.id] || "";
|
|
172
|
+
const f = () => {
|
|
173
|
+
const b = !!s.value.trim();
|
|
174
|
+
l.disabled = !b;
|
|
165
175
|
};
|
|
166
|
-
|
|
167
|
-
|
|
176
|
+
f(), s.addEventListener("input", () => {
|
|
177
|
+
t.replyTexts[e.id] = s.value, f();
|
|
168
178
|
}), l.addEventListener("click", () => {
|
|
169
|
-
const
|
|
170
|
-
|
|
179
|
+
const b = s.value.trim();
|
|
180
|
+
b && (F(e.id, E, b), t.replyTexts[e.id] = "", m(t));
|
|
171
181
|
});
|
|
172
182
|
}
|
|
173
183
|
p.appendChild(n);
|
|
174
184
|
}
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
185
|
+
const c = document.createElement("div");
|
|
186
|
+
if (c.className = "rte-comment-actions", e.anchorId) {
|
|
177
187
|
const n = document.createElement("button");
|
|
178
188
|
n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Jump to text", n.onclick = () => {
|
|
179
|
-
const s =
|
|
180
|
-
s && (s.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }),
|
|
181
|
-
},
|
|
189
|
+
const s = t.root.querySelector(`#${e.anchorId}`);
|
|
190
|
+
s && (s.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), h(t, e.id, !0), window.setTimeout(() => h(t, e.id, !1), 1200));
|
|
191
|
+
}, c.appendChild(n);
|
|
182
192
|
}
|
|
183
|
-
if (
|
|
193
|
+
if (e.resolved) {
|
|
184
194
|
const n = document.createElement("button");
|
|
185
|
-
n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () =>
|
|
195
|
+
n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () => _(e.id), c.appendChild(n);
|
|
186
196
|
} else {
|
|
187
197
|
const n = document.createElement("button");
|
|
188
|
-
n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () =>
|
|
198
|
+
n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () => P(e.id, E), c.appendChild(n);
|
|
189
199
|
}
|
|
190
|
-
const
|
|
191
|
-
|
|
200
|
+
const i = document.createElement("button");
|
|
201
|
+
i.type = "button", i.className = "rte-comment-btn danger", i.textContent = "Delete", i.onclick = () => j(e.id), c.appendChild(i), p.appendChild(c);
|
|
192
202
|
}
|
|
193
|
-
return o.addEventListener("mouseenter", () =>
|
|
203
|
+
return o.addEventListener("mouseenter", () => h(t, e.id, !0)), o.addEventListener("mouseleave", () => h(t, e.id, !1)), o;
|
|
194
204
|
}
|
|
195
|
-
function m(
|
|
196
|
-
const
|
|
197
|
-
if (!
|
|
198
|
-
const r =
|
|
199
|
-
|
|
205
|
+
function m(t) {
|
|
206
|
+
const e = t || u();
|
|
207
|
+
if (!e?.panelElement) return;
|
|
208
|
+
const r = M(e);
|
|
209
|
+
e.panelElement.innerHTML = `
|
|
200
210
|
<div class="rte-comments-header">
|
|
201
211
|
<div>
|
|
202
212
|
<h3>Comments (${r.length})</h3>
|
|
@@ -211,133 +221,141 @@ function m(e) {
|
|
|
211
221
|
</div>
|
|
212
222
|
</div>
|
|
213
223
|
${r.length === 0 ? '<div class="rte-comments-empty">No comments yet.</div>' : '<div class="rte-comments-list"></div>'}
|
|
214
|
-
`,
|
|
215
|
-
|
|
224
|
+
`, e.panelElement.querySelector(".rte-comments-close")?.addEventListener("click", () => {
|
|
225
|
+
g(e, !1);
|
|
216
226
|
});
|
|
217
|
-
const a =
|
|
227
|
+
const a = e.panelElement.querySelector(
|
|
218
228
|
".new-comment-textarea"
|
|
219
|
-
), d =
|
|
229
|
+
), d = e.panelElement.querySelector(
|
|
220
230
|
".add-comment-btn"
|
|
221
231
|
);
|
|
222
232
|
if (a && d) {
|
|
223
|
-
a.value =
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
d.disabled = !
|
|
233
|
+
a.value = e.newCommentText;
|
|
234
|
+
const c = () => {
|
|
235
|
+
const i = !!a.value.trim();
|
|
236
|
+
d.disabled = !i;
|
|
227
237
|
};
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}), a.addEventListener("keydown", (
|
|
231
|
-
(
|
|
238
|
+
c(), a.addEventListener("input", () => {
|
|
239
|
+
e.newCommentText = a.value, c();
|
|
240
|
+
}), a.addEventListener("keydown", (i) => {
|
|
241
|
+
(i.ctrlKey || i.metaKey) && i.key === "Enter" && (i.preventDefault(), d.click());
|
|
232
242
|
}), d.addEventListener("click", () => {
|
|
233
|
-
const
|
|
234
|
-
if (!
|
|
235
|
-
const n = !!
|
|
236
|
-
|
|
243
|
+
const i = a.value.trim();
|
|
244
|
+
if (!i) return;
|
|
245
|
+
const n = !!e.savedSelection;
|
|
246
|
+
O(E, i, !n), e.newCommentText = "", m(e);
|
|
237
247
|
});
|
|
238
248
|
}
|
|
239
|
-
const p =
|
|
240
|
-
p && r.forEach((
|
|
241
|
-
p.appendChild(
|
|
249
|
+
const p = e.panelElement.querySelector(".rte-comments-list");
|
|
250
|
+
p && r.forEach((c) => {
|
|
251
|
+
p.appendChild(D(e, c));
|
|
242
252
|
});
|
|
243
253
|
}
|
|
244
|
-
function
|
|
245
|
-
S || (S = !0, document.addEventListener("focusin", (
|
|
246
|
-
const
|
|
247
|
-
|
|
254
|
+
function T() {
|
|
255
|
+
S || (S = !0, document.addEventListener("focusin", (t) => {
|
|
256
|
+
const e = y(t.target);
|
|
257
|
+
e && (x = e);
|
|
248
258
|
}), document.addEventListener("selectionchange", () => {
|
|
249
|
-
const
|
|
250
|
-
if (!
|
|
251
|
-
const
|
|
259
|
+
const t = window.getSelection();
|
|
260
|
+
if (!t || t.rangeCount === 0) return;
|
|
261
|
+
const e = t.getRangeAt(0), r = y(e.commonAncestorContainer);
|
|
252
262
|
if (!r) return;
|
|
253
263
|
x = r;
|
|
254
264
|
const o = C.get(r);
|
|
255
|
-
!o ||
|
|
256
|
-
})
|
|
265
|
+
!o || t.isCollapsed || w(e, r) && (o.savedSelection = e.cloneRange());
|
|
266
|
+
}), document.addEventListener(
|
|
267
|
+
"keydown",
|
|
268
|
+
(t) => {
|
|
269
|
+
if (t.key !== "Escape") return;
|
|
270
|
+
const e = u();
|
|
271
|
+
!e || !e.panelVisible || (t.preventDefault(), t.stopPropagation(), g(e, !1));
|
|
272
|
+
},
|
|
273
|
+
!0
|
|
274
|
+
));
|
|
257
275
|
}
|
|
258
|
-
function
|
|
259
|
-
const o =
|
|
276
|
+
function O(t, e, r = !1) {
|
|
277
|
+
const o = u();
|
|
260
278
|
if (!o) return "";
|
|
261
|
-
const a =
|
|
279
|
+
const a = e.trim();
|
|
262
280
|
if (!a) return "";
|
|
263
281
|
if (r) {
|
|
264
|
-
const l =
|
|
282
|
+
const l = v("comment");
|
|
265
283
|
return o.comments.set(l, {
|
|
266
284
|
id: l,
|
|
267
285
|
anchorId: "",
|
|
268
286
|
selectedText: "",
|
|
269
|
-
author:
|
|
287
|
+
author: t,
|
|
270
288
|
text: a,
|
|
271
289
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
272
290
|
resolved: !1,
|
|
273
291
|
replies: []
|
|
274
292
|
}), m(o), l;
|
|
275
293
|
}
|
|
276
|
-
const d = o.savedSelection ||
|
|
294
|
+
const d = o.savedSelection || R(o.root);
|
|
277
295
|
if (!d || !w(d, o.root)) return "";
|
|
278
296
|
const p = d.toString().trim();
|
|
279
297
|
if (!p) return "";
|
|
280
|
-
const
|
|
281
|
-
n.id =
|
|
298
|
+
const c = v("comment"), i = v("comment-anchor"), n = document.createElement("span");
|
|
299
|
+
n.id = i, n.className = "rte-comment-anchor", n.setAttribute("data-comment-id", c), n.setAttribute("title", "Commented text");
|
|
282
300
|
try {
|
|
283
|
-
const l = d.cloneRange(),
|
|
284
|
-
if (!
|
|
285
|
-
n.appendChild(
|
|
301
|
+
const l = d.cloneRange(), f = l.extractContents();
|
|
302
|
+
if (!f.textContent?.trim()) return "";
|
|
303
|
+
n.appendChild(f), l.insertNode(n);
|
|
286
304
|
} catch {
|
|
287
305
|
return "";
|
|
288
306
|
}
|
|
289
|
-
return $(o, n,
|
|
290
|
-
id:
|
|
291
|
-
anchorId:
|
|
307
|
+
return $(o, n, c), o.comments.set(c, {
|
|
308
|
+
id: c,
|
|
309
|
+
anchorId: i,
|
|
292
310
|
selectedText: p,
|
|
293
|
-
author:
|
|
311
|
+
author: t,
|
|
294
312
|
text: a,
|
|
295
313
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
296
314
|
resolved: !1,
|
|
297
315
|
replies: []
|
|
298
|
-
}), o.savedSelection = null, window.getSelection()?.removeAllRanges(), m(o),
|
|
316
|
+
}), o.savedSelection = null, window.getSelection()?.removeAllRanges(), m(o), c;
|
|
299
317
|
}
|
|
300
|
-
function
|
|
301
|
-
const r =
|
|
318
|
+
function P(t, e) {
|
|
319
|
+
const r = u();
|
|
302
320
|
if (!r) return;
|
|
303
|
-
const o = r.comments.get(
|
|
304
|
-
o && (o.resolved = !0, o.resolvedBy =
|
|
321
|
+
const o = r.comments.get(t);
|
|
322
|
+
o && (o.resolved = !0, o.resolvedBy = e, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), I(r, o), m(r));
|
|
305
323
|
}
|
|
306
|
-
function
|
|
307
|
-
const
|
|
308
|
-
if (!
|
|
309
|
-
const r =
|
|
310
|
-
r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0,
|
|
324
|
+
function _(t) {
|
|
325
|
+
const e = u();
|
|
326
|
+
if (!e) return;
|
|
327
|
+
const r = e.comments.get(t);
|
|
328
|
+
r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, I(e, r), m(e));
|
|
311
329
|
}
|
|
312
|
-
function
|
|
313
|
-
const
|
|
314
|
-
if (!
|
|
315
|
-
const r =
|
|
330
|
+
function j(t) {
|
|
331
|
+
const e = u();
|
|
332
|
+
if (!e) return;
|
|
333
|
+
const r = e.comments.get(t);
|
|
316
334
|
if (r) {
|
|
317
335
|
if (r.anchorId) {
|
|
318
|
-
const o =
|
|
336
|
+
const o = e.root.querySelector(`#${r.anchorId}`);
|
|
319
337
|
o && q(o);
|
|
320
338
|
}
|
|
321
|
-
|
|
339
|
+
e.comments.delete(t), e.expandedComments.delete(t), delete e.replyTexts[t], m(e);
|
|
322
340
|
}
|
|
323
341
|
}
|
|
324
|
-
function
|
|
325
|
-
const o =
|
|
342
|
+
function F(t, e, r) {
|
|
343
|
+
const o = u();
|
|
326
344
|
if (!o) return;
|
|
327
|
-
const a = o.comments.get(
|
|
345
|
+
const a = o.comments.get(t);
|
|
328
346
|
if (!a) return;
|
|
329
347
|
const d = r.trim();
|
|
330
348
|
d && (a.replies.push({
|
|
331
|
-
id:
|
|
332
|
-
author:
|
|
349
|
+
id: v("reply"),
|
|
350
|
+
author: e,
|
|
333
351
|
text: d,
|
|
334
352
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
335
353
|
}), m(o));
|
|
336
354
|
}
|
|
337
|
-
function
|
|
355
|
+
function Z() {
|
|
338
356
|
if (document.getElementById("rte-comments-panel-styles")) return;
|
|
339
|
-
const
|
|
340
|
-
|
|
357
|
+
const t = document.createElement("style");
|
|
358
|
+
t.id = "rte-comments-panel-styles", t.textContent = `
|
|
341
359
|
.rte-comments-panel {
|
|
342
360
|
--rte-comments-panel-width: min(360px, 42vw);
|
|
343
361
|
position: absolute;
|
|
@@ -653,9 +671,9 @@ function F() {
|
|
|
653
671
|
margin-right: 0;
|
|
654
672
|
}
|
|
655
673
|
}
|
|
656
|
-
`, document.head.appendChild(
|
|
674
|
+
`, document.head.appendChild(t);
|
|
657
675
|
}
|
|
658
|
-
const
|
|
676
|
+
const K = () => ({
|
|
659
677
|
name: "comments",
|
|
660
678
|
toolbar: [
|
|
661
679
|
{
|
|
@@ -672,21 +690,21 @@ const Z = () => ({
|
|
|
672
690
|
}
|
|
673
691
|
],
|
|
674
692
|
commands: {
|
|
675
|
-
addComment: () => {
|
|
676
|
-
|
|
677
|
-
const
|
|
678
|
-
return
|
|
693
|
+
addComment: (t, e) => {
|
|
694
|
+
A(e), T();
|
|
695
|
+
const r = u();
|
|
696
|
+
return r ? (r.savedSelection = R(r.root), r.savedSelection && window.getSelection()?.removeAllRanges(), g(r, !0), m(r), r.panelElement?.querySelector(
|
|
679
697
|
".new-comment-textarea"
|
|
680
698
|
)?.focus({ preventScroll: !0 }), !0) : !1;
|
|
681
699
|
},
|
|
682
|
-
toggleComments: () => {
|
|
683
|
-
|
|
684
|
-
const
|
|
685
|
-
return
|
|
700
|
+
toggleComments: (t, e) => {
|
|
701
|
+
A(e), T();
|
|
702
|
+
const r = u();
|
|
703
|
+
return r ? (g(r, !r.panelVisible), r.panelVisible && m(r), !0) : !1;
|
|
686
704
|
}
|
|
687
705
|
},
|
|
688
706
|
keymap: {}
|
|
689
707
|
});
|
|
690
708
|
export {
|
|
691
|
-
|
|
709
|
+
K as CommentsPlugin
|
|
692
710
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-tqLTHcO6.js");exports.DocumentManagerPlugin=e.DocumentManagerPlugin;exports.getDocumentManagerConfig=e.getDocumentManagerConfig;exports.setDocumentManagerConfig=e.setDocumentManagerConfig;
|