@editora/core 1.0.5 → 1.0.7
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/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
- package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
- package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
- package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
- package/dist/{DocumentManagerPlugin.native-BvZL5CSG.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +43 -43
- package/dist/{EmbedIframePlugin.native-CSWIB1jm.mjs → EmbedIframePlugin.native-DKJx2OS7.mjs} +61 -58
- package/dist/{EmojisPlugin.native-DxTm_DL-.mjs → EmojisPlugin.native-CitxxlWX.mjs} +135 -104
- package/dist/{LinkPlugin.native-CS2g-G18.mjs → LinkPlugin.native-DYCIcdTm.mjs} +47 -45
- package/dist/{MathPlugin.native-KUxz0o8C.mjs → MathPlugin.native-f_mDp8VL.mjs} +149 -108
- package/dist/{MediaManagerPlugin.native-CgP5iInD.mjs → MediaManagerPlugin.native-BiXiK8FC.mjs} +238 -217
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
- package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-CXdX5fAv.mjs} +77 -68
- package/dist/{SpecialCharactersPlugin.native-DANrbExJ.mjs → SpecialCharactersPlugin.native-CZDato89.mjs} +143 -98
- package/dist/{SpellCheckPlugin.native-C8bPvRHy.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +239 -219
- package/dist/{TemplatePlugin.native-4lKEm-WY.mjs → TemplatePlugin.native-CrpfKRJ8.mjs} +167 -143
- package/dist/{TextColorPlugin.native-Clgtb50j.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +134 -118
- package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/anchoredPopover-Bxds0VoB.mjs +110 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/editora.min.js +10 -10
- package/dist/editora.umd.js +10 -10
- package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
- package/dist/{index-CqWQFb3D.js → index-BpE6GFbz.js} +4 -4
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/{index-OwnkG39N.mjs → index-yzU4NdPT.mjs} +200 -183
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-CuicffkQ.mjs → index.es-BYD2KEo6.mjs} +5 -4
- package/dist/index.esm.js +2 -2
- package/dist/jspdf.es.min-BJGtOnRT.mjs +7890 -0
- package/dist/plugin-loader.js +15 -15
- package/dist/webcomponent-core.js +241 -224
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +86 -106
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +205 -188
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +477 -402
- package/package.json +16 -10
- package/dist/CodePlugin.native-B263UI8O.mjs +0 -2173
- package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +0 -419
- package/dist/colorSelectionApply-CK1My9N2.mjs +0 -67
- package/dist/documentManager-irzj9n3V.mjs +0 -37627
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
const C = /* @__PURE__ */ new WeakMap();
|
|
2
|
-
let
|
|
2
|
+
let x = null, S = !1, k = 0;
|
|
3
3
|
const E = "User";
|
|
4
|
-
function
|
|
4
|
+
function v(e) {
|
|
5
5
|
return k += 1, `${e}-${Date.now()}-${k}`;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function y(e) {
|
|
8
8
|
if (!e) return null;
|
|
9
9
|
const t = e instanceof Element ? e : e.parentElement;
|
|
10
10
|
return t ? t.closest("[data-editora-editor]") || t.closest(".rte-editor") || t.closest(".editora-editor") : null;
|
|
11
11
|
}
|
|
12
|
+
function A(e) {
|
|
13
|
+
const t = (e == null ? void 0 : e.editorElement) || (e == null ? void 0 : e.contentElement) || null;
|
|
14
|
+
if (!(t instanceof HTMLElement)) return;
|
|
15
|
+
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
|
+
r && (x = r);
|
|
17
|
+
}
|
|
12
18
|
function w(e, t) {
|
|
13
19
|
return t.contains(e.commonAncestorContainer);
|
|
14
20
|
}
|
|
@@ -18,19 +24,19 @@ function $() {
|
|
|
18
24
|
if (o instanceof HTMLElement) {
|
|
19
25
|
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);
|
|
20
26
|
if (a)
|
|
21
|
-
return
|
|
27
|
+
return x = a, window.__editoraCommandEditorRoot = null, a;
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
|
-
const e = document.activeElement, t = e ?
|
|
30
|
+
const e = document.activeElement, t = e ? y(e) : null;
|
|
25
31
|
if (t) return t;
|
|
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
|
-
return
|
|
39
|
+
return x;
|
|
34
40
|
}
|
|
35
41
|
function q(e) {
|
|
36
42
|
const t = C.get(e);
|
|
@@ -48,17 +54,17 @@ function q(e) {
|
|
|
48
54
|
};
|
|
49
55
|
return C.set(e, r), r;
|
|
50
56
|
}
|
|
51
|
-
function
|
|
57
|
+
function u() {
|
|
52
58
|
const e = $();
|
|
53
|
-
return e ? (
|
|
59
|
+
return e ? (x = e, q(e)) : null;
|
|
54
60
|
}
|
|
55
|
-
function
|
|
61
|
+
function R(e) {
|
|
56
62
|
const t = window.getSelection();
|
|
57
63
|
if (!t || t.rangeCount === 0 || t.isCollapsed) return null;
|
|
58
64
|
const r = t.getRangeAt(0);
|
|
59
65
|
return w(r, e) ? r.cloneRange() : null;
|
|
60
66
|
}
|
|
61
|
-
function
|
|
67
|
+
function I(e, t) {
|
|
62
68
|
if (!t.anchorId) return;
|
|
63
69
|
const r = e.root.querySelector(`#${t.anchorId}`);
|
|
64
70
|
r && r.classList.toggle("rte-comment-anchor-resolved", t.resolved);
|
|
@@ -69,12 +75,12 @@ function b(e, t, r) {
|
|
|
69
75
|
const a = e.root.querySelector(`#${o.anchorId}`);
|
|
70
76
|
a && a.classList.toggle("highlighted", r);
|
|
71
77
|
}
|
|
72
|
-
function
|
|
78
|
+
function N(e, t, r) {
|
|
73
79
|
t.onclick = (o) => {
|
|
74
|
-
o.preventDefault(), o.stopPropagation(),
|
|
80
|
+
o.preventDefault(), o.stopPropagation(), x = e.root, e.expandedComments.add(r), h(e, !0), m(e);
|
|
75
81
|
};
|
|
76
82
|
}
|
|
77
|
-
function
|
|
83
|
+
function z(e) {
|
|
78
84
|
const t = e.parentNode;
|
|
79
85
|
if (t) {
|
|
80
86
|
for (; e.firstChild; )
|
|
@@ -82,40 +88,44 @@ function N(e) {
|
|
|
82
88
|
e.remove();
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
91
|
+
function h(e, t) {
|
|
92
|
+
if (e.panelVisible = t, t) {
|
|
93
|
+
Z(), V(e), e.root.setAttribute("data-rte-comments-open", "true"), e.panelElement && (e.panelElement.classList.add("is-open"), e.panelElement.setAttribute("aria-hidden", "false")), B(e);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
e.root.removeAttribute("data-rte-comments-open"), M(e), e.panelElement && (e.panelElement.remove(), e.panelElement = null);
|
|
87
97
|
}
|
|
88
|
-
function
|
|
98
|
+
function V(e) {
|
|
89
99
|
if (e.panelElement) return;
|
|
90
100
|
const t = document.createElement("aside");
|
|
91
101
|
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;
|
|
92
102
|
}
|
|
93
|
-
function
|
|
103
|
+
function B(e) {
|
|
94
104
|
e.selectionChangeListener || (e.selectionChangeListener = () => {
|
|
95
105
|
const t = window.getSelection();
|
|
96
106
|
if (!t || t.rangeCount === 0 || t.isCollapsed) return;
|
|
97
107
|
const r = t.getRangeAt(0);
|
|
98
|
-
w(r, e.root) && (e.savedSelection = r.cloneRange(),
|
|
108
|
+
w(r, e.root) && (e.savedSelection = r.cloneRange(), x = e.root);
|
|
99
109
|
}, document.addEventListener("selectionchange", e.selectionChangeListener));
|
|
100
110
|
}
|
|
101
|
-
function
|
|
111
|
+
function M(e) {
|
|
102
112
|
e.selectionChangeListener && (document.removeEventListener("selectionchange", e.selectionChangeListener), e.selectionChangeListener = null);
|
|
103
113
|
}
|
|
104
|
-
function
|
|
114
|
+
function H(e) {
|
|
105
115
|
return Array.from(e.comments.values()).sort(
|
|
106
116
|
(t, r) => r.createdAt.localeCompare(t.createdAt)
|
|
107
117
|
);
|
|
108
118
|
}
|
|
109
|
-
function
|
|
119
|
+
function L(e) {
|
|
110
120
|
return new Date(e).toLocaleString();
|
|
111
121
|
}
|
|
112
|
-
function
|
|
122
|
+
function D(e, t) {
|
|
113
123
|
const r = e.expandedComments.has(t.id), o = document.createElement("article");
|
|
114
124
|
o.className = `rte-comment-item${t.resolved ? " resolved" : ""}`, o.innerHTML = `
|
|
115
125
|
<header class="rte-comment-header">
|
|
116
126
|
<div class="rte-comment-meta">
|
|
117
127
|
<strong class="rte-comment-author">${t.author}</strong>
|
|
118
|
-
<time class="rte-comment-date">${
|
|
128
|
+
<time class="rte-comment-date">${L(t.createdAt)}</time>
|
|
119
129
|
</div>
|
|
120
130
|
<button class="rte-comment-expand" type="button" aria-label="Toggle details">
|
|
121
131
|
${r ? "▾" : "▸"}
|
|
@@ -127,26 +137,26 @@ function M(e, t) {
|
|
|
127
137
|
`;
|
|
128
138
|
const a = o.querySelector(".rte-comment-text");
|
|
129
139
|
a && (a.textContent = t.text);
|
|
130
|
-
const
|
|
131
|
-
|
|
140
|
+
const i = o.querySelector(".rte-comment-expand");
|
|
141
|
+
i == null || i.addEventListener("click", () => {
|
|
132
142
|
e.expandedComments.has(t.id) ? e.expandedComments.delete(t.id) : e.expandedComments.add(t.id), m(e);
|
|
133
143
|
});
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
144
|
+
const f = o.querySelector(".rte-comment-expanded");
|
|
145
|
+
if (f && r) {
|
|
136
146
|
if (t.replies.length > 0) {
|
|
137
147
|
const n = document.createElement("div");
|
|
138
|
-
n.className = "rte-comment-replies", t.replies.forEach((
|
|
148
|
+
n.className = "rte-comment-replies", t.replies.forEach((s) => {
|
|
139
149
|
const p = document.createElement("div");
|
|
140
150
|
p.className = "rte-comment-reply", p.innerHTML = `
|
|
141
151
|
<div class="rte-comment-reply-header">
|
|
142
|
-
<strong>${
|
|
143
|
-
<time>${
|
|
152
|
+
<strong>${s.author}</strong>
|
|
153
|
+
<time>${L(s.createdAt)}</time>
|
|
144
154
|
</div>
|
|
145
155
|
<div class="rte-comment-reply-text"></div>
|
|
146
156
|
`;
|
|
147
157
|
const d = p.querySelector(".rte-comment-reply-text");
|
|
148
|
-
d && (d.textContent =
|
|
149
|
-
}),
|
|
158
|
+
d && (d.textContent = s.text), n.appendChild(p);
|
|
159
|
+
}), f.appendChild(n);
|
|
150
160
|
}
|
|
151
161
|
if (!t.resolved) {
|
|
152
162
|
const n = document.createElement("div");
|
|
@@ -154,50 +164,50 @@ function M(e, t) {
|
|
|
154
164
|
<textarea class="rte-comment-reply-textarea" rows="2" placeholder="Reply..."></textarea>
|
|
155
165
|
<button type="button" class="rte-comment-btn primary">Reply</button>
|
|
156
166
|
`;
|
|
157
|
-
const
|
|
167
|
+
const s = n.querySelector(
|
|
158
168
|
".rte-comment-reply-textarea"
|
|
159
169
|
), p = n.querySelector(
|
|
160
170
|
".rte-comment-btn.primary"
|
|
161
171
|
);
|
|
162
|
-
if (
|
|
163
|
-
|
|
172
|
+
if (s && p) {
|
|
173
|
+
s.value = e.replyTexts[t.id] || "";
|
|
164
174
|
const d = () => {
|
|
165
|
-
const
|
|
166
|
-
p.disabled = !
|
|
175
|
+
const g = !!s.value.trim();
|
|
176
|
+
p.disabled = !g;
|
|
167
177
|
};
|
|
168
|
-
d(),
|
|
169
|
-
e.replyTexts[t.id] =
|
|
178
|
+
d(), s.addEventListener("input", () => {
|
|
179
|
+
e.replyTexts[t.id] = s.value, d();
|
|
170
180
|
}), p.addEventListener("click", () => {
|
|
171
|
-
const
|
|
172
|
-
|
|
181
|
+
const g = s.value.trim();
|
|
182
|
+
g && (F(t.id, E, g), e.replyTexts[t.id] = "", m(e));
|
|
173
183
|
});
|
|
174
184
|
}
|
|
175
|
-
|
|
185
|
+
f.appendChild(n);
|
|
176
186
|
}
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
187
|
+
const l = document.createElement("div");
|
|
188
|
+
if (l.className = "rte-comment-actions", t.anchorId) {
|
|
179
189
|
const n = document.createElement("button");
|
|
180
190
|
n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Jump to text", n.onclick = () => {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
},
|
|
191
|
+
const s = e.root.querySelector(`#${t.anchorId}`);
|
|
192
|
+
s && (s.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), b(e, t.id, !0), window.setTimeout(() => b(e, t.id, !1), 1200));
|
|
193
|
+
}, l.appendChild(n);
|
|
184
194
|
}
|
|
185
195
|
if (t.resolved) {
|
|
186
196
|
const n = document.createElement("button");
|
|
187
|
-
n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () =>
|
|
197
|
+
n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () => _(t.id), l.appendChild(n);
|
|
188
198
|
} else {
|
|
189
199
|
const n = document.createElement("button");
|
|
190
|
-
n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () =>
|
|
200
|
+
n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () => P(t.id, E), l.appendChild(n);
|
|
191
201
|
}
|
|
192
202
|
const c = document.createElement("button");
|
|
193
|
-
c.type = "button", c.className = "rte-comment-btn danger", c.textContent = "Delete", c.onclick = () =>
|
|
203
|
+
c.type = "button", c.className = "rte-comment-btn danger", c.textContent = "Delete", c.onclick = () => j(t.id), l.appendChild(c), f.appendChild(l);
|
|
194
204
|
}
|
|
195
205
|
return o.addEventListener("mouseenter", () => b(e, t.id, !0)), o.addEventListener("mouseleave", () => b(e, t.id, !1)), o;
|
|
196
206
|
}
|
|
197
207
|
function m(e) {
|
|
198
|
-
const t = e ||
|
|
208
|
+
const t = e || u();
|
|
199
209
|
if (!(t != null && t.panelElement)) return;
|
|
200
|
-
const r =
|
|
210
|
+
const r = H(t);
|
|
201
211
|
t.panelElement.innerHTML = `
|
|
202
212
|
<div class="rte-comments-header">
|
|
203
213
|
<div>
|
|
@@ -216,61 +226,69 @@ function m(e) {
|
|
|
216
226
|
`;
|
|
217
227
|
const o = t.panelElement.querySelector(".rte-comments-close");
|
|
218
228
|
o == null || o.addEventListener("click", () => {
|
|
219
|
-
|
|
229
|
+
h(t, !1);
|
|
220
230
|
});
|
|
221
231
|
const a = t.panelElement.querySelector(
|
|
222
232
|
".new-comment-textarea"
|
|
223
|
-
),
|
|
233
|
+
), i = t.panelElement.querySelector(
|
|
224
234
|
".add-comment-btn"
|
|
225
235
|
);
|
|
226
|
-
if (a &&
|
|
236
|
+
if (a && i) {
|
|
227
237
|
a.value = t.newCommentText;
|
|
228
|
-
const
|
|
238
|
+
const l = () => {
|
|
229
239
|
const c = !!a.value.trim();
|
|
230
|
-
|
|
240
|
+
i.disabled = !c;
|
|
231
241
|
};
|
|
232
|
-
|
|
233
|
-
t.newCommentText = a.value,
|
|
242
|
+
l(), a.addEventListener("input", () => {
|
|
243
|
+
t.newCommentText = a.value, l();
|
|
234
244
|
}), a.addEventListener("keydown", (c) => {
|
|
235
|
-
(c.ctrlKey || c.metaKey) && c.key === "Enter" && (c.preventDefault(),
|
|
236
|
-
}),
|
|
245
|
+
(c.ctrlKey || c.metaKey) && c.key === "Enter" && (c.preventDefault(), i.click());
|
|
246
|
+
}), i.addEventListener("click", () => {
|
|
237
247
|
const c = a.value.trim();
|
|
238
248
|
if (!c) return;
|
|
239
249
|
const n = !!t.savedSelection;
|
|
240
|
-
|
|
250
|
+
O(E, c, !n), t.newCommentText = "", m(t);
|
|
241
251
|
});
|
|
242
252
|
}
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
253
|
+
const f = t.panelElement.querySelector(".rte-comments-list");
|
|
254
|
+
f && r.forEach((l) => {
|
|
255
|
+
f.appendChild(D(t, l));
|
|
246
256
|
});
|
|
247
257
|
}
|
|
248
|
-
function
|
|
258
|
+
function T() {
|
|
249
259
|
S || (S = !0, document.addEventListener("focusin", (e) => {
|
|
250
|
-
const t =
|
|
251
|
-
t && (
|
|
260
|
+
const t = y(e.target);
|
|
261
|
+
t && (x = t);
|
|
252
262
|
}), document.addEventListener("selectionchange", () => {
|
|
253
263
|
const e = window.getSelection();
|
|
254
264
|
if (!e || e.rangeCount === 0) return;
|
|
255
|
-
const t = e.getRangeAt(0), r =
|
|
265
|
+
const t = e.getRangeAt(0), r = y(t.commonAncestorContainer);
|
|
256
266
|
if (!r) return;
|
|
257
|
-
|
|
267
|
+
x = r;
|
|
258
268
|
const o = C.get(r);
|
|
259
269
|
!o || e.isCollapsed || w(t, r) && (o.savedSelection = t.cloneRange());
|
|
260
|
-
})
|
|
270
|
+
}), document.addEventListener(
|
|
271
|
+
"keydown",
|
|
272
|
+
(e) => {
|
|
273
|
+
if (e.key !== "Escape") return;
|
|
274
|
+
const t = u();
|
|
275
|
+
!t || !t.panelVisible || (e.preventDefault(), e.stopPropagation(), h(t, !1));
|
|
276
|
+
},
|
|
277
|
+
!0
|
|
278
|
+
));
|
|
261
279
|
}
|
|
262
|
-
function
|
|
263
|
-
const e =
|
|
264
|
-
return e ?
|
|
280
|
+
function K() {
|
|
281
|
+
const e = u();
|
|
282
|
+
return e ? H(e) : [];
|
|
265
283
|
}
|
|
266
|
-
function
|
|
284
|
+
function O(e, t, r = !1) {
|
|
267
285
|
var p;
|
|
268
|
-
const o =
|
|
286
|
+
const o = u();
|
|
269
287
|
if (!o) return "";
|
|
270
288
|
const a = t.trim();
|
|
271
289
|
if (!a) return "";
|
|
272
290
|
if (r) {
|
|
273
|
-
const d =
|
|
291
|
+
const d = v("comment");
|
|
274
292
|
return o.comments.set(d, {
|
|
275
293
|
id: d,
|
|
276
294
|
anchorId: "",
|
|
@@ -282,74 +300,74 @@ function D(e, t, r = !1) {
|
|
|
282
300
|
replies: []
|
|
283
301
|
}), m(o), d;
|
|
284
302
|
}
|
|
285
|
-
const
|
|
286
|
-
if (!
|
|
287
|
-
const
|
|
288
|
-
if (!
|
|
289
|
-
const
|
|
290
|
-
n.id = c, n.className = "rte-comment-anchor", n.setAttribute("data-comment-id",
|
|
303
|
+
const i = o.savedSelection || R(o.root);
|
|
304
|
+
if (!i || !w(i, o.root)) return "";
|
|
305
|
+
const f = i.toString().trim();
|
|
306
|
+
if (!f) return "";
|
|
307
|
+
const l = v("comment"), c = v("comment-anchor"), n = document.createElement("span");
|
|
308
|
+
n.id = c, n.className = "rte-comment-anchor", n.setAttribute("data-comment-id", l), n.setAttribute("title", "Commented text");
|
|
291
309
|
try {
|
|
292
|
-
const d =
|
|
293
|
-
if (!((p =
|
|
294
|
-
n.appendChild(
|
|
310
|
+
const d = i.cloneRange(), g = d.extractContents();
|
|
311
|
+
if (!((p = g.textContent) != null && p.trim())) return "";
|
|
312
|
+
n.appendChild(g), d.insertNode(n);
|
|
295
313
|
} catch (d) {
|
|
296
314
|
return "";
|
|
297
315
|
}
|
|
298
|
-
|
|
299
|
-
id:
|
|
316
|
+
N(o, n, l), o.comments.set(l, {
|
|
317
|
+
id: l,
|
|
300
318
|
anchorId: c,
|
|
301
|
-
selectedText:
|
|
319
|
+
selectedText: f,
|
|
302
320
|
author: e,
|
|
303
321
|
text: a,
|
|
304
322
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
305
323
|
resolved: !1,
|
|
306
324
|
replies: []
|
|
307
325
|
}), o.savedSelection = null;
|
|
308
|
-
const
|
|
309
|
-
return
|
|
326
|
+
const s = window.getSelection();
|
|
327
|
+
return s == null || s.removeAllRanges(), m(o), l;
|
|
310
328
|
}
|
|
311
|
-
function
|
|
312
|
-
const r =
|
|
329
|
+
function P(e, t) {
|
|
330
|
+
const r = u();
|
|
313
331
|
if (!r) return;
|
|
314
332
|
const o = r.comments.get(e);
|
|
315
|
-
o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(),
|
|
333
|
+
o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), I(r, o), m(r));
|
|
316
334
|
}
|
|
317
|
-
function
|
|
318
|
-
const t =
|
|
335
|
+
function _(e) {
|
|
336
|
+
const t = u();
|
|
319
337
|
if (!t) return;
|
|
320
338
|
const r = t.comments.get(e);
|
|
321
|
-
r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0,
|
|
339
|
+
r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, I(t, r), m(t));
|
|
322
340
|
}
|
|
323
|
-
function
|
|
324
|
-
const t =
|
|
341
|
+
function j(e) {
|
|
342
|
+
const t = u();
|
|
325
343
|
if (!t) return;
|
|
326
344
|
const r = t.comments.get(e);
|
|
327
345
|
if (r) {
|
|
328
346
|
if (r.anchorId) {
|
|
329
347
|
const o = t.root.querySelector(`#${r.anchorId}`);
|
|
330
|
-
o &&
|
|
348
|
+
o && z(o);
|
|
331
349
|
}
|
|
332
350
|
t.comments.delete(e), t.expandedComments.delete(e), delete t.replyTexts[e], m(t);
|
|
333
351
|
}
|
|
334
352
|
}
|
|
335
|
-
function
|
|
336
|
-
const o =
|
|
353
|
+
function F(e, t, r) {
|
|
354
|
+
const o = u();
|
|
337
355
|
if (!o) return;
|
|
338
356
|
const a = o.comments.get(e);
|
|
339
357
|
if (!a) return;
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
id:
|
|
358
|
+
const i = r.trim();
|
|
359
|
+
i && (a.replies.push({
|
|
360
|
+
id: v("reply"),
|
|
343
361
|
author: t,
|
|
344
|
-
text:
|
|
362
|
+
text: i,
|
|
345
363
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
346
364
|
}), m(o));
|
|
347
365
|
}
|
|
348
|
-
function
|
|
349
|
-
const r =
|
|
366
|
+
function U(e, t) {
|
|
367
|
+
const r = u();
|
|
350
368
|
r && b(r, e, t);
|
|
351
369
|
}
|
|
352
|
-
function
|
|
370
|
+
function Z() {
|
|
353
371
|
if (document.getElementById("rte-comments-panel-styles")) return;
|
|
354
372
|
const e = document.createElement("style");
|
|
355
373
|
e.id = "rte-comments-panel-styles", e.textContent = `
|
|
@@ -670,7 +688,7 @@ function F() {
|
|
|
670
688
|
}
|
|
671
689
|
`, document.head.appendChild(e);
|
|
672
690
|
}
|
|
673
|
-
const
|
|
691
|
+
const X = () => ({
|
|
674
692
|
name: "comments",
|
|
675
693
|
toolbar: [
|
|
676
694
|
{
|
|
@@ -687,37 +705,37 @@ const U = () => ({
|
|
|
687
705
|
}
|
|
688
706
|
],
|
|
689
707
|
commands: {
|
|
690
|
-
addComment: () => {
|
|
691
|
-
var
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
if (!
|
|
695
|
-
if (
|
|
696
|
-
const
|
|
697
|
-
|
|
708
|
+
addComment: (e, t) => {
|
|
709
|
+
var a;
|
|
710
|
+
A(t), T();
|
|
711
|
+
const r = u();
|
|
712
|
+
if (!r) return !1;
|
|
713
|
+
if (r.savedSelection = R(r.root), r.savedSelection) {
|
|
714
|
+
const i = window.getSelection();
|
|
715
|
+
i == null || i.removeAllRanges();
|
|
698
716
|
}
|
|
699
|
-
|
|
700
|
-
const
|
|
717
|
+
h(r, !0), m(r);
|
|
718
|
+
const o = (a = r.panelElement) == null ? void 0 : a.querySelector(
|
|
701
719
|
".new-comment-textarea"
|
|
702
720
|
);
|
|
703
|
-
return
|
|
721
|
+
return o == null || o.focus({ preventScroll: !0 }), !0;
|
|
704
722
|
},
|
|
705
|
-
toggleComments: () => {
|
|
706
|
-
|
|
707
|
-
const
|
|
708
|
-
return
|
|
723
|
+
toggleComments: (e, t) => {
|
|
724
|
+
A(t), T();
|
|
725
|
+
const r = u();
|
|
726
|
+
return r ? (h(r, !r.panelVisible), r.panelVisible && m(r), !0) : !1;
|
|
709
727
|
}
|
|
710
728
|
},
|
|
711
729
|
keymap: {}
|
|
712
730
|
});
|
|
713
731
|
export {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
732
|
+
X as CommentsPlugin,
|
|
733
|
+
O as addCommentCommand,
|
|
734
|
+
j as deleteComment,
|
|
735
|
+
K as getAllComments,
|
|
736
|
+
U as highlightComment,
|
|
737
|
+
_ as reopenComment,
|
|
738
|
+
F as replyToComment,
|
|
739
|
+
P as resolveComment
|
|
722
740
|
};
|
|
723
|
-
//# sourceMappingURL=CommentsPlugin.native-
|
|
741
|
+
//# sourceMappingURL=CommentsPlugin.native-DPSqTkiv.mjs.map
|
package/dist/{DocumentManagerPlugin.native-BvZL5CSG.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const c = () => ({
|
|
2
2
|
name: "document-manager",
|
|
3
3
|
toolbar: [
|
|
4
4
|
{
|
|
@@ -22,15 +22,15 @@ const i = () => ({
|
|
|
22
22
|
],
|
|
23
23
|
commands: {
|
|
24
24
|
importWord: () => {
|
|
25
|
-
const
|
|
25
|
+
const l = () => {
|
|
26
26
|
const e = window.getSelection();
|
|
27
27
|
if (e && e.rangeCount > 0) {
|
|
28
28
|
let r = e.getRangeAt(0).startContainer;
|
|
29
29
|
for (; r && r !== document.body; ) {
|
|
30
30
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
31
|
+
const d = r;
|
|
32
|
+
if (d.getAttribute("contenteditable") === "true")
|
|
33
|
+
return d;
|
|
34
34
|
}
|
|
35
35
|
r = r.parentNode;
|
|
36
36
|
}
|
|
@@ -38,79 +38,79 @@ const i = () => ({
|
|
|
38
38
|
const n = document.activeElement;
|
|
39
39
|
if ((n == null ? void 0 : n.getAttribute("contenteditable")) === "true")
|
|
40
40
|
return n;
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
},
|
|
44
|
-
return
|
|
45
|
-
var
|
|
46
|
-
const n = (
|
|
41
|
+
const o = n == null ? void 0 : n.closest('[contenteditable="true"]');
|
|
42
|
+
return o || document.querySelector('[contenteditable="true"]');
|
|
43
|
+
}, t = document.createElement("input");
|
|
44
|
+
return t.type = "file", t.accept = ".docx", t.onchange = async (e) => {
|
|
45
|
+
var o;
|
|
46
|
+
const n = (o = e.target.files) == null ? void 0 : o[0];
|
|
47
47
|
if (n)
|
|
48
48
|
try {
|
|
49
|
-
const r =
|
|
49
|
+
const r = l();
|
|
50
50
|
if (r) {
|
|
51
|
-
const { importFromWord:
|
|
51
|
+
const { importFromWord: d } = await import("./documentManager-vQ1VkbUY.mjs"), a = await d(n);
|
|
52
52
|
r.innerHTML = a, r.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
53
53
|
}
|
|
54
54
|
} catch (r) {
|
|
55
55
|
console.error("Import failed:", r), alert("Failed to import Word document. Please check the console for details.");
|
|
56
56
|
}
|
|
57
|
-
},
|
|
57
|
+
}, t.click(), !0;
|
|
58
58
|
},
|
|
59
59
|
exportWord: async () => {
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
let
|
|
64
|
-
for (;
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
67
|
-
|
|
60
|
+
const l = () => {
|
|
61
|
+
const t = window.getSelection();
|
|
62
|
+
if (t && t.rangeCount > 0) {
|
|
63
|
+
let o = t.getRangeAt(0).startContainer;
|
|
64
|
+
for (; o && o !== document.body; ) {
|
|
65
|
+
if (o.nodeType === Node.ELEMENT_NODE && o.getAttribute("contenteditable") === "true")
|
|
66
|
+
return o;
|
|
67
|
+
o = o.parentNode;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
const e = document.activeElement;
|
|
71
71
|
return (e == null ? void 0 : e.getAttribute("contenteditable")) === "true" ? e : (e == null ? void 0 : e.closest('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
|
|
72
72
|
};
|
|
73
73
|
try {
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
const e =
|
|
74
|
+
const t = l();
|
|
75
|
+
if (t) {
|
|
76
|
+
const e = t.innerHTML, { exportToWord: n } = await import("./documentManager-vQ1VkbUY.mjs");
|
|
77
77
|
await n(e, "document.docx");
|
|
78
78
|
}
|
|
79
79
|
return !0;
|
|
80
|
-
} catch (
|
|
81
|
-
return console.error("Export failed:",
|
|
80
|
+
} catch (t) {
|
|
81
|
+
return console.error("Export failed:", t), alert("Failed to export to Word. Please check the console for details."), !1;
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
exportPdf: async () => {
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
let
|
|
89
|
-
for (;
|
|
90
|
-
if (
|
|
91
|
-
return
|
|
92
|
-
|
|
85
|
+
const l = () => {
|
|
86
|
+
const t = window.getSelection();
|
|
87
|
+
if (t && t.rangeCount > 0) {
|
|
88
|
+
let o = t.getRangeAt(0).startContainer;
|
|
89
|
+
for (; o && o !== document.body; ) {
|
|
90
|
+
if (o.nodeType === Node.ELEMENT_NODE && o.getAttribute("contenteditable") === "true")
|
|
91
|
+
return o;
|
|
92
|
+
o = o.parentNode;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
const e = document.activeElement;
|
|
96
96
|
return (e == null ? void 0 : e.getAttribute("contenteditable")) === "true" ? e : (e == null ? void 0 : e.closest('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
|
|
97
97
|
};
|
|
98
98
|
try {
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
const e =
|
|
102
|
-
await n(e, "document.pdf",
|
|
99
|
+
const t = l();
|
|
100
|
+
if (t) {
|
|
101
|
+
const e = t.innerHTML, { exportToPdf: n } = await import("./documentManager-vQ1VkbUY.mjs");
|
|
102
|
+
await n(e, "document.pdf", t);
|
|
103
103
|
} else
|
|
104
104
|
console.error("PDF Export: No editor element found"), alert("No active editor found. Please click in the editor area first.");
|
|
105
105
|
return !0;
|
|
106
|
-
} catch (
|
|
107
|
-
return console.error("PDF Export: Export failed:",
|
|
106
|
+
} catch (t) {
|
|
107
|
+
return console.error("PDF Export: Export failed:", t), alert("Failed to export to PDF. Please check the console for details."), !1;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
keymap: {}
|
|
112
112
|
});
|
|
113
113
|
export {
|
|
114
|
-
|
|
114
|
+
c as DocumentManagerPlugin
|
|
115
115
|
};
|
|
116
|
-
//# sourceMappingURL=DocumentManagerPlugin.native-
|
|
116
|
+
//# sourceMappingURL=DocumentManagerPlugin.native-C2cs_1w4.mjs.map
|