@editora/core 1.0.3 → 1.0.5

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.
Files changed (131) hide show
  1. package/README.md +34 -0
  2. package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
  3. package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
  4. package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
  5. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
  6. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
  7. package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-B263UI8O.mjs} +624 -473
  8. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +384 -0
  9. package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
  10. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
  11. package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
  12. package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
  13. package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
  14. package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
  15. package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
  16. package/dist/HistoryPlugin.native-TDnVMsEO.mjs +257 -0
  17. package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
  18. package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
  19. package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
  20. package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
  21. package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
  22. package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
  23. package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +419 -0
  24. package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
  25. package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
  26. package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
  27. package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
  28. package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
  29. package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
  30. package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
  31. package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
  32. package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
  33. package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
  34. package/dist/core.css +1 -1
  35. package/dist/editora.min.js +31 -29
  36. package/dist/editora.umd.js +31 -29
  37. package/dist/index-CqWQFb3D.js +10 -0
  38. package/dist/index-OwnkG39N.mjs +2227 -0
  39. package/dist/index.cjs.js +14 -18
  40. package/dist/index.esm.js +204 -521
  41. package/dist/plugin-loader.js +26 -26
  42. package/dist/webcomponent-core.js +1286 -295
  43. package/dist/webcomponent-core.min.css +1 -1
  44. package/dist/webcomponent-core.min.js +111 -78
  45. package/dist/webcomponent.cjs.js +1 -1
  46. package/dist/webcomponent.esm.js +1 -1
  47. package/dist/webcomponent.js +1252 -261
  48. package/dist/webcomponent.min.css +1 -1
  49. package/dist/webcomponent.min.js +3552 -2037
  50. package/index.d.ts +355 -0
  51. package/package.json +21 -18
  52. package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
  53. package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
  54. package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
  55. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
  56. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
  57. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
  58. package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
  59. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
  60. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
  61. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
  62. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
  63. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
  64. package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
  65. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
  66. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
  67. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
  68. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
  69. package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
  70. package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
  71. package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
  72. package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
  73. package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
  74. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
  75. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
  76. package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
  77. package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
  78. package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
  79. package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
  80. package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
  81. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
  82. package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
  83. package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
  84. package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
  85. package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
  86. package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
  87. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
  88. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
  89. package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
  90. package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
  91. package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
  92. package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
  93. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
  94. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
  95. package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
  96. package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
  97. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
  98. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
  99. package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
  100. package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
  101. package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
  102. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
  103. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
  104. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
  105. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
  106. package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
  107. package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
  108. package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
  109. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
  110. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
  111. package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
  112. package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
  113. package/dist/documentManager-irzj9n3V.mjs.map +0 -1
  114. package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
  115. package/dist/editora.min.js.map +0 -1
  116. package/dist/editora.umd.js.map +0 -1
  117. package/dist/index-BF5RBhL9.js +0 -4
  118. package/dist/index-BF5RBhL9.js.map +0 -1
  119. package/dist/index-BPsf460l.mjs +0 -1243
  120. package/dist/index-BPsf460l.mjs.map +0 -1
  121. package/dist/index.cjs.js.map +0 -1
  122. package/dist/index.es-CuicffkQ.mjs.map +0 -1
  123. package/dist/index.esm.js.map +0 -1
  124. package/dist/plugin-loader.js.map +0 -1
  125. package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
  126. package/dist/webcomponent-core.js.map +0 -1
  127. package/dist/webcomponent-core.min.js.map +0 -1
  128. package/dist/webcomponent.cjs.js.map +0 -1
  129. package/dist/webcomponent.esm.js.map +0 -1
  130. package/dist/webcomponent.js.map +0 -1
  131. package/dist/webcomponent.min.js.map +0 -1
@@ -0,0 +1,723 @@
1
+ const C = /* @__PURE__ */ new WeakMap();
2
+ let g = null, S = !1, k = 0;
3
+ const E = "User";
4
+ function h(e) {
5
+ return k += 1, `${e}-${Date.now()}-${k}`;
6
+ }
7
+ function v(e) {
8
+ if (!e) return null;
9
+ const t = e instanceof Element ? e : e.parentElement;
10
+ return t ? t.closest("[data-editora-editor]") || t.closest(".rte-editor") || t.closest(".editora-editor") : null;
11
+ }
12
+ function w(e, t) {
13
+ return t.contains(e.commonAncestorContainer);
14
+ }
15
+ function $() {
16
+ if (typeof window != "undefined") {
17
+ const o = window.__editoraCommandEditorRoot;
18
+ if (o instanceof HTMLElement) {
19
+ 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
+ if (a)
21
+ return g = a, window.__editoraCommandEditorRoot = null, a;
22
+ }
23
+ }
24
+ const e = document.activeElement, t = e ? v(e) : null;
25
+ if (t) return t;
26
+ const r = window.getSelection();
27
+ if (r && r.rangeCount > 0) {
28
+ const o = v(
29
+ r.getRangeAt(0).commonAncestorContainer
30
+ );
31
+ if (o) return o;
32
+ }
33
+ return g;
34
+ }
35
+ function q(e) {
36
+ const t = C.get(e);
37
+ if (t) return t;
38
+ const r = {
39
+ root: e,
40
+ comments: /* @__PURE__ */ new Map(),
41
+ panelVisible: !1,
42
+ panelElement: null,
43
+ expandedComments: /* @__PURE__ */ new Set(),
44
+ replyTexts: {},
45
+ savedSelection: null,
46
+ newCommentText: "",
47
+ selectionChangeListener: null
48
+ };
49
+ return C.set(e, r), r;
50
+ }
51
+ function f() {
52
+ const e = $();
53
+ return e ? (g = e, q(e)) : null;
54
+ }
55
+ function T(e) {
56
+ const t = window.getSelection();
57
+ if (!t || t.rangeCount === 0 || t.isCollapsed) return null;
58
+ const r = t.getRangeAt(0);
59
+ return w(r, e) ? r.cloneRange() : null;
60
+ }
61
+ function R(e, t) {
62
+ if (!t.anchorId) return;
63
+ const r = e.root.querySelector(`#${t.anchorId}`);
64
+ r && r.classList.toggle("rte-comment-anchor-resolved", t.resolved);
65
+ }
66
+ function b(e, t, r) {
67
+ const o = e.comments.get(t);
68
+ if (!o || !o.anchorId) return;
69
+ const a = e.root.querySelector(`#${o.anchorId}`);
70
+ a && a.classList.toggle("highlighted", r);
71
+ }
72
+ function H(e, t, r) {
73
+ t.onclick = (o) => {
74
+ o.preventDefault(), o.stopPropagation(), g = e.root, e.expandedComments.add(r), y(e, !0), m(e);
75
+ };
76
+ }
77
+ function N(e) {
78
+ const t = e.parentNode;
79
+ if (t) {
80
+ for (; e.firstChild; )
81
+ t.insertBefore(e.firstChild, e);
82
+ e.remove();
83
+ }
84
+ }
85
+ function y(e, t) {
86
+ F(), z(e), e.panelVisible = t, e.root.setAttribute("data-rte-comments-open", t ? "true" : "false"), e.panelElement && (e.panelElement.classList.toggle("is-open", t), e.panelElement.setAttribute("aria-hidden", t ? "false" : "true")), t ? V(e) : B(e);
87
+ }
88
+ function z(e) {
89
+ if (e.panelElement) return;
90
+ const t = document.createElement("aside");
91
+ 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
+ }
93
+ function V(e) {
94
+ e.selectionChangeListener || (e.selectionChangeListener = () => {
95
+ const t = window.getSelection();
96
+ if (!t || t.rangeCount === 0 || t.isCollapsed) return;
97
+ const r = t.getRangeAt(0);
98
+ w(r, e.root) && (e.savedSelection = r.cloneRange(), g = e.root);
99
+ }, document.addEventListener("selectionchange", e.selectionChangeListener));
100
+ }
101
+ function B(e) {
102
+ e.selectionChangeListener && (document.removeEventListener("selectionchange", e.selectionChangeListener), e.selectionChangeListener = null);
103
+ }
104
+ function I(e) {
105
+ return Array.from(e.comments.values()).sort(
106
+ (t, r) => r.createdAt.localeCompare(t.createdAt)
107
+ );
108
+ }
109
+ function A(e) {
110
+ return new Date(e).toLocaleString();
111
+ }
112
+ function M(e, t) {
113
+ const r = e.expandedComments.has(t.id), o = document.createElement("article");
114
+ o.className = `rte-comment-item${t.resolved ? " resolved" : ""}`, o.innerHTML = `
115
+ <header class="rte-comment-header">
116
+ <div class="rte-comment-meta">
117
+ <strong class="rte-comment-author">${t.author}</strong>
118
+ <time class="rte-comment-date">${A(t.createdAt)}</time>
119
+ </div>
120
+ <button class="rte-comment-expand" type="button" aria-label="Toggle details">
121
+ ${r ? "▾" : "▸"}
122
+ </button>
123
+ </header>
124
+ <div class="rte-comment-text"></div>
125
+ ${t.selectedText ? `<blockquote class="rte-comment-selection">${t.selectedText}</blockquote>` : ""}
126
+ <section class="rte-comment-expanded${r ? " show" : ""}"></section>
127
+ `;
128
+ const a = o.querySelector(".rte-comment-text");
129
+ a && (a.textContent = t.text);
130
+ const s = o.querySelector(".rte-comment-expand");
131
+ s == null || s.addEventListener("click", () => {
132
+ e.expandedComments.has(t.id) ? e.expandedComments.delete(t.id) : e.expandedComments.add(t.id), m(e);
133
+ });
134
+ const u = o.querySelector(".rte-comment-expanded");
135
+ if (u && r) {
136
+ if (t.replies.length > 0) {
137
+ const n = document.createElement("div");
138
+ n.className = "rte-comment-replies", t.replies.forEach((l) => {
139
+ const p = document.createElement("div");
140
+ p.className = "rte-comment-reply", p.innerHTML = `
141
+ <div class="rte-comment-reply-header">
142
+ <strong>${l.author}</strong>
143
+ <time>${A(l.createdAt)}</time>
144
+ </div>
145
+ <div class="rte-comment-reply-text"></div>
146
+ `;
147
+ const d = p.querySelector(".rte-comment-reply-text");
148
+ d && (d.textContent = l.text), n.appendChild(p);
149
+ }), u.appendChild(n);
150
+ }
151
+ if (!t.resolved) {
152
+ const n = document.createElement("div");
153
+ n.className = "rte-comment-reply-composer", n.innerHTML = `
154
+ <textarea class="rte-comment-reply-textarea" rows="2" placeholder="Reply..."></textarea>
155
+ <button type="button" class="rte-comment-btn primary">Reply</button>
156
+ `;
157
+ const l = n.querySelector(
158
+ ".rte-comment-reply-textarea"
159
+ ), p = n.querySelector(
160
+ ".rte-comment-btn.primary"
161
+ );
162
+ if (l && p) {
163
+ l.value = e.replyTexts[t.id] || "";
164
+ const d = () => {
165
+ const x = !!l.value.trim();
166
+ p.disabled = !x;
167
+ };
168
+ d(), l.addEventListener("input", () => {
169
+ e.replyTexts[t.id] = l.value, d();
170
+ }), p.addEventListener("click", () => {
171
+ const x = l.value.trim();
172
+ x && (_(t.id, E, x), e.replyTexts[t.id] = "", m(e));
173
+ });
174
+ }
175
+ u.appendChild(n);
176
+ }
177
+ const i = document.createElement("div");
178
+ if (i.className = "rte-comment-actions", t.anchorId) {
179
+ const n = document.createElement("button");
180
+ n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Jump to text", n.onclick = () => {
181
+ const l = e.root.querySelector(`#${t.anchorId}`);
182
+ l && (l.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), b(e, t.id, !0), window.setTimeout(() => b(e, t.id, !1), 1200));
183
+ }, i.appendChild(n);
184
+ }
185
+ if (t.resolved) {
186
+ const n = document.createElement("button");
187
+ n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () => j(t.id), i.appendChild(n);
188
+ } else {
189
+ const n = document.createElement("button");
190
+ n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () => O(t.id, E), i.appendChild(n);
191
+ }
192
+ const c = document.createElement("button");
193
+ c.type = "button", c.className = "rte-comment-btn danger", c.textContent = "Delete", c.onclick = () => P(t.id), i.appendChild(c), u.appendChild(i);
194
+ }
195
+ return o.addEventListener("mouseenter", () => b(e, t.id, !0)), o.addEventListener("mouseleave", () => b(e, t.id, !1)), o;
196
+ }
197
+ function m(e) {
198
+ const t = e || f();
199
+ if (!(t != null && t.panelElement)) return;
200
+ const r = I(t);
201
+ t.panelElement.innerHTML = `
202
+ <div class="rte-comments-header">
203
+ <div>
204
+ <h3>Comments (${r.length})</h3>
205
+ <p>Select text and add comments, or add a general note.</p>
206
+ </div>
207
+ <button class="rte-comments-close" type="button" aria-label="Close comments panel">✕</button>
208
+ </div>
209
+ <div class="rte-comments-composer">
210
+ <textarea class="new-comment-textarea" rows="3" placeholder="Add a comment..."></textarea>
211
+ <div class="rte-comments-composer-actions">
212
+ <button class="rte-comment-btn primary add-comment-btn" type="button">Add Comment</button>
213
+ </div>
214
+ </div>
215
+ ${r.length === 0 ? '<div class="rte-comments-empty">No comments yet.</div>' : '<div class="rte-comments-list"></div>'}
216
+ `;
217
+ const o = t.panelElement.querySelector(".rte-comments-close");
218
+ o == null || o.addEventListener("click", () => {
219
+ y(t, !1);
220
+ });
221
+ const a = t.panelElement.querySelector(
222
+ ".new-comment-textarea"
223
+ ), s = t.panelElement.querySelector(
224
+ ".add-comment-btn"
225
+ );
226
+ if (a && s) {
227
+ a.value = t.newCommentText;
228
+ const i = () => {
229
+ const c = !!a.value.trim();
230
+ s.disabled = !c;
231
+ };
232
+ i(), a.addEventListener("input", () => {
233
+ t.newCommentText = a.value, i();
234
+ }), a.addEventListener("keydown", (c) => {
235
+ (c.ctrlKey || c.metaKey) && c.key === "Enter" && (c.preventDefault(), s.click());
236
+ }), s.addEventListener("click", () => {
237
+ const c = a.value.trim();
238
+ if (!c) return;
239
+ const n = !!t.savedSelection;
240
+ D(E, c, !n), t.newCommentText = "", m(t);
241
+ });
242
+ }
243
+ const u = t.panelElement.querySelector(".rte-comments-list");
244
+ u && r.forEach((i) => {
245
+ u.appendChild(M(t, i));
246
+ });
247
+ }
248
+ function L() {
249
+ S || (S = !0, document.addEventListener("focusin", (e) => {
250
+ const t = v(e.target);
251
+ t && (g = t);
252
+ }), document.addEventListener("selectionchange", () => {
253
+ const e = window.getSelection();
254
+ if (!e || e.rangeCount === 0) return;
255
+ const t = e.getRangeAt(0), r = v(t.commonAncestorContainer);
256
+ if (!r) return;
257
+ g = r;
258
+ const o = C.get(r);
259
+ !o || e.isCollapsed || w(t, r) && (o.savedSelection = t.cloneRange());
260
+ }));
261
+ }
262
+ function Z() {
263
+ const e = f();
264
+ return e ? I(e) : [];
265
+ }
266
+ function D(e, t, r = !1) {
267
+ var p;
268
+ const o = f();
269
+ if (!o) return "";
270
+ const a = t.trim();
271
+ if (!a) return "";
272
+ if (r) {
273
+ const d = h("comment");
274
+ return o.comments.set(d, {
275
+ id: d,
276
+ anchorId: "",
277
+ selectedText: "",
278
+ author: e,
279
+ text: a,
280
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
281
+ resolved: !1,
282
+ replies: []
283
+ }), m(o), d;
284
+ }
285
+ const s = o.savedSelection || T(o.root);
286
+ if (!s || !w(s, o.root)) return "";
287
+ const u = s.toString().trim();
288
+ if (!u) return "";
289
+ const i = h("comment"), c = h("comment-anchor"), n = document.createElement("span");
290
+ n.id = c, n.className = "rte-comment-anchor", n.setAttribute("data-comment-id", i), n.setAttribute("title", "Commented text");
291
+ try {
292
+ const d = s.cloneRange(), x = d.extractContents();
293
+ if (!((p = x.textContent) != null && p.trim())) return "";
294
+ n.appendChild(x), d.insertNode(n);
295
+ } catch (d) {
296
+ return "";
297
+ }
298
+ H(o, n, i), o.comments.set(i, {
299
+ id: i,
300
+ anchorId: c,
301
+ selectedText: u,
302
+ author: e,
303
+ text: a,
304
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
305
+ resolved: !1,
306
+ replies: []
307
+ }), o.savedSelection = null;
308
+ const l = window.getSelection();
309
+ return l == null || l.removeAllRanges(), m(o), i;
310
+ }
311
+ function O(e, t) {
312
+ const r = f();
313
+ if (!r) return;
314
+ const o = r.comments.get(e);
315
+ o && (o.resolved = !0, o.resolvedBy = t, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), R(r, o), m(r));
316
+ }
317
+ function j(e) {
318
+ const t = f();
319
+ if (!t) return;
320
+ const r = t.comments.get(e);
321
+ r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, R(t, r), m(t));
322
+ }
323
+ function P(e) {
324
+ const t = f();
325
+ if (!t) return;
326
+ const r = t.comments.get(e);
327
+ if (r) {
328
+ if (r.anchorId) {
329
+ const o = t.root.querySelector(`#${r.anchorId}`);
330
+ o && N(o);
331
+ }
332
+ t.comments.delete(e), t.expandedComments.delete(e), delete t.replyTexts[e], m(t);
333
+ }
334
+ }
335
+ function _(e, t, r) {
336
+ const o = f();
337
+ if (!o) return;
338
+ const a = o.comments.get(e);
339
+ if (!a) return;
340
+ const s = r.trim();
341
+ s && (a.replies.push({
342
+ id: h("reply"),
343
+ author: t,
344
+ text: s,
345
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
346
+ }), m(o));
347
+ }
348
+ function K(e, t) {
349
+ const r = f();
350
+ r && b(r, e, t);
351
+ }
352
+ function F() {
353
+ if (document.getElementById("rte-comments-panel-styles")) return;
354
+ const e = document.createElement("style");
355
+ e.id = "rte-comments-panel-styles", e.textContent = `
356
+ .rte-comments-panel {
357
+ --rte-comments-panel-width: min(360px, 42vw);
358
+ position: absolute;
359
+ top: 0;
360
+ right: 0;
361
+ bottom: 0;
362
+ width: var(--rte-comments-panel-width);
363
+ display: flex;
364
+ flex-direction: column;
365
+ background: var(--rte-color-bg-primary, #ffffff);
366
+ color: var(--rte-color-text-primary, #111827);
367
+ border-left: 1px solid var(--rte-color-border, #d1d5db);
368
+ box-shadow: -12px 0 28px rgba(15, 23, 42, 0.2);
369
+ transform: translateX(100%);
370
+ opacity: 0;
371
+ pointer-events: none;
372
+ transition: transform 180ms ease, opacity 180ms ease;
373
+ z-index: 55;
374
+ }
375
+
376
+ .rte-comments-panel.is-open {
377
+ transform: translateX(0);
378
+ opacity: 1;
379
+ pointer-events: auto;
380
+ }
381
+
382
+ [data-rte-comments-open="true"] :is(.rte-toolbar, .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
383
+ margin-right: var(--rte-comments-panel-width);
384
+ transition: margin-right 180ms ease;
385
+ }
386
+
387
+ .rte-comments-header {
388
+ display: flex;
389
+ justify-content: space-between;
390
+ align-items: flex-start;
391
+ gap: 12px;
392
+ padding: 14px 14px 12px;
393
+ border-bottom: 1px solid var(--rte-color-border-light, #e5e7eb);
394
+ background: var(--rte-color-bg-secondary, #f8fafc);
395
+ }
396
+
397
+ .rte-comments-header h3 {
398
+ margin: 0;
399
+ font-size: 15px;
400
+ line-height: 1.2;
401
+ }
402
+
403
+ .rte-comments-header p {
404
+ margin: 6px 0 0;
405
+ font-size: 12px;
406
+ color: var(--rte-color-text-muted, #64748b);
407
+ }
408
+
409
+ .rte-comments-close {
410
+ border: 1px solid var(--rte-color-border, #d1d5db);
411
+ background: transparent;
412
+ color: var(--rte-color-text-secondary, #475569);
413
+ border-radius: 6px;
414
+ width: 30px;
415
+ height: 30px;
416
+ cursor: pointer;
417
+ font-size: 16px;
418
+ line-height: 1;
419
+ }
420
+
421
+ .rte-comments-close:hover {
422
+ background: var(--rte-color-bg-hover, #f1f5f9);
423
+ color: var(--rte-color-text-primary, #0f172a);
424
+ }
425
+
426
+ .rte-comments-composer {
427
+ display: flex;
428
+ flex-direction: column;
429
+ gap: 8px;
430
+ padding: 12px 14px;
431
+ border-bottom: 1px solid var(--rte-color-border-light, #e5e7eb);
432
+ background: var(--rte-color-bg-secondary, #f8fafc);
433
+ }
434
+
435
+ .new-comment-textarea,
436
+ .rte-comment-reply-textarea {
437
+ width: 100%;
438
+ resize: vertical;
439
+ min-height: 62px;
440
+ font-family: inherit;
441
+ font-size: 13px;
442
+ line-height: 1.35;
443
+ border: 1px solid var(--rte-color-border, #d1d5db);
444
+ border-radius: 8px;
445
+ background: var(--rte-color-bg-primary, #ffffff);
446
+ color: var(--rte-color-text-primary, #0f172a);
447
+ padding: 8px 10px;
448
+ outline: none;
449
+ }
450
+
451
+ .new-comment-textarea:focus,
452
+ .rte-comment-reply-textarea:focus {
453
+ border-color: var(--rte-color-border-focus, #2563eb);
454
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--rte-color-border-focus, #2563eb) 20%, transparent);
455
+ }
456
+
457
+ .rte-comments-composer-actions {
458
+ display: flex;
459
+ justify-content: flex-end;
460
+ }
461
+
462
+ .rte-comments-list {
463
+ flex: 1;
464
+ overflow: auto;
465
+ padding: 12px;
466
+ display: flex;
467
+ flex-direction: column;
468
+ gap: 10px;
469
+ }
470
+
471
+ .rte-comments-empty {
472
+ padding: 18px 14px;
473
+ color: var(--rte-color-text-muted, #64748b);
474
+ font-size: 13px;
475
+ }
476
+
477
+ .rte-comment-item {
478
+ border: 1px solid var(--rte-color-border-light, #e5e7eb);
479
+ border-radius: 10px;
480
+ background: var(--rte-color-bg-primary, #ffffff);
481
+ padding: 10px;
482
+ }
483
+
484
+ .rte-comment-item.resolved {
485
+ opacity: 0.74;
486
+ }
487
+
488
+ .rte-comment-header {
489
+ display: flex;
490
+ align-items: flex-start;
491
+ justify-content: space-between;
492
+ gap: 8px;
493
+ }
494
+
495
+ .rte-comment-meta {
496
+ display: flex;
497
+ flex-direction: column;
498
+ gap: 2px;
499
+ }
500
+
501
+ .rte-comment-author {
502
+ font-size: 13px;
503
+ color: var(--rte-color-text-primary, #0f172a);
504
+ }
505
+
506
+ .rte-comment-date {
507
+ font-size: 11px;
508
+ color: var(--rte-color-text-muted, #64748b);
509
+ }
510
+
511
+ .rte-comment-expand {
512
+ border: none;
513
+ background: transparent;
514
+ cursor: pointer;
515
+ color: var(--rte-color-text-secondary, #475569);
516
+ font-size: 16px;
517
+ line-height: 1;
518
+ padding: 0;
519
+ }
520
+
521
+ .rte-comment-text {
522
+ margin-top: 8px;
523
+ font-size: 13px;
524
+ line-height: 1.45;
525
+ color: var(--rte-color-text-primary, #0f172a);
526
+ white-space: pre-wrap;
527
+ word-break: break-word;
528
+ }
529
+
530
+ .rte-comment-selection {
531
+ margin: 8px 0 0;
532
+ border-left: 3px solid var(--rte-color-primary, #2563eb);
533
+ background: var(--rte-color-bg-secondary, #f8fafc);
534
+ color: var(--rte-color-text-secondary, #475569);
535
+ padding: 6px 8px;
536
+ border-radius: 6px;
537
+ font-size: 12px;
538
+ font-style: italic;
539
+ white-space: pre-wrap;
540
+ word-break: break-word;
541
+ }
542
+
543
+ .rte-comment-expanded {
544
+ display: none;
545
+ margin-top: 10px;
546
+ padding-top: 10px;
547
+ border-top: 1px solid var(--rte-color-border-light, #e5e7eb);
548
+ }
549
+
550
+ .rte-comment-expanded.show {
551
+ display: block;
552
+ }
553
+
554
+ .rte-comment-replies {
555
+ display: flex;
556
+ flex-direction: column;
557
+ gap: 8px;
558
+ margin-bottom: 10px;
559
+ }
560
+
561
+ .rte-comment-reply {
562
+ border: 1px solid var(--rte-color-border-light, #e5e7eb);
563
+ border-radius: 8px;
564
+ padding: 8px;
565
+ background: var(--rte-color-bg-secondary, #f8fafc);
566
+ }
567
+
568
+ .rte-comment-reply-header {
569
+ display: flex;
570
+ justify-content: space-between;
571
+ gap: 8px;
572
+ margin-bottom: 4px;
573
+ font-size: 11px;
574
+ color: var(--rte-color-text-muted, #64748b);
575
+ }
576
+
577
+ .rte-comment-reply-text {
578
+ font-size: 12px;
579
+ color: var(--rte-color-text-secondary, #334155);
580
+ white-space: pre-wrap;
581
+ word-break: break-word;
582
+ }
583
+
584
+ .rte-comment-reply-composer {
585
+ display: flex;
586
+ flex-direction: column;
587
+ gap: 8px;
588
+ margin-bottom: 10px;
589
+ }
590
+
591
+ .rte-comment-actions {
592
+ display: flex;
593
+ justify-content: flex-end;
594
+ flex-wrap: wrap;
595
+ gap: 6px;
596
+ }
597
+
598
+ .rte-comment-btn {
599
+ border: 1px solid var(--rte-color-border, #d1d5db);
600
+ border-radius: 7px;
601
+ padding: 5px 9px;
602
+ font-size: 12px;
603
+ cursor: pointer;
604
+ background: var(--rte-color-bg-primary, #ffffff);
605
+ color: var(--rte-color-text-secondary, #334155);
606
+ }
607
+
608
+ .rte-comment-btn:hover {
609
+ background: var(--rte-color-bg-hover, #f1f5f9);
610
+ color: var(--rte-color-text-primary, #0f172a);
611
+ }
612
+
613
+ .rte-comment-btn:disabled {
614
+ opacity: 0.5;
615
+ cursor: not-allowed;
616
+ }
617
+
618
+ .rte-comment-btn.primary {
619
+ border-color: var(--rte-color-primary, #2563eb);
620
+ background: var(--rte-color-primary, #2563eb);
621
+ color: var(--rte-color-text-inverse, #ffffff);
622
+ }
623
+
624
+ .rte-comment-btn.primary:hover {
625
+ background: var(--rte-color-primary-hover, #1d4ed8);
626
+ border-color: var(--rte-color-primary-hover, #1d4ed8);
627
+ color: var(--rte-color-text-inverse, #ffffff);
628
+ }
629
+
630
+ .rte-comment-btn.success {
631
+ border-color: color-mix(in srgb, var(--rte-color-success, #15803d) 60%, transparent);
632
+ color: var(--rte-color-success, #15803d);
633
+ }
634
+
635
+ .rte-comment-btn.danger {
636
+ border-color: color-mix(in srgb, var(--rte-color-danger, #b91c1c) 60%, transparent);
637
+ color: var(--rte-color-danger, #b91c1c);
638
+ }
639
+
640
+ .rte-comment-anchor {
641
+ background: rgba(250, 204, 21, 0.34);
642
+ border-bottom: 2px solid rgba(217, 119, 6, 0.75);
643
+ border-radius: 2px;
644
+ cursor: pointer;
645
+ transition: outline-color 120ms ease, box-shadow 120ms ease;
646
+ }
647
+
648
+ .rte-comment-anchor.rte-comment-anchor-resolved {
649
+ background: rgba(148, 163, 184, 0.2);
650
+ border-bottom-color: rgba(100, 116, 139, 0.6);
651
+ }
652
+
653
+ .rte-comment-anchor.highlighted {
654
+ outline: 2px solid var(--rte-color-primary, #2563eb);
655
+ outline-offset: 2px;
656
+ }
657
+
658
+ :is([theme="dark"], [data-theme="dark"], .dark, .editora-theme-dark) .rte-comments-panel {
659
+ box-shadow: -14px 0 30px rgba(0, 0, 0, 0.45);
660
+ }
661
+
662
+ @media (max-width: 900px) {
663
+ .rte-comments-panel {
664
+ --rte-comments-panel-width: min(420px, 100%);
665
+ }
666
+
667
+ [data-rte-comments-open="true"] :is(.rte-toolbar, .editora-toolbar, .rte-content, .editora-content, .editora-statusbar, .editora-statusbar-container) {
668
+ margin-right: 0;
669
+ }
670
+ }
671
+ `, document.head.appendChild(e);
672
+ }
673
+ const U = () => ({
674
+ name: "comments",
675
+ toolbar: [
676
+ {
677
+ label: "Add Comment",
678
+ command: "addComment",
679
+ type: "button",
680
+ icon: '<svg fill="#000000" width="24px" height="24px" viewBox="0 0 32 32" id="icon" xmlns="http://www.w3.org/2000/svg"><defs><style>.cls-1{fill:none;}</style></defs><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 class="cls-1" width="32" height="32"></rect></svg>'
681
+ },
682
+ {
683
+ label: "Show / Hide Comments",
684
+ command: "toggleComments",
685
+ type: "button",
686
+ icon: '<svg width="24px" height="24px" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16 1H4V11H8L10 13L12 11H16V1Z" fill="#000000"></path><path d="M2 5V13H7.17157L8.70711 14.5355L7.29289 15.9497L6.34315 15H0V5H2Z" fill="#000000"></path></svg>'
687
+ }
688
+ ],
689
+ commands: {
690
+ addComment: () => {
691
+ var r;
692
+ L();
693
+ const e = f();
694
+ if (!e) return !1;
695
+ if (e.savedSelection = T(e.root), e.savedSelection) {
696
+ const o = window.getSelection();
697
+ o == null || o.removeAllRanges();
698
+ }
699
+ y(e, !0), m(e);
700
+ const t = (r = e.panelElement) == null ? void 0 : r.querySelector(
701
+ ".new-comment-textarea"
702
+ );
703
+ return t == null || t.focus({ preventScroll: !0 }), !0;
704
+ },
705
+ toggleComments: () => {
706
+ L();
707
+ const e = f();
708
+ return e ? (y(e, !e.panelVisible), e.panelVisible && m(e), !0) : !1;
709
+ }
710
+ },
711
+ keymap: {}
712
+ });
713
+ export {
714
+ U as CommentsPlugin,
715
+ D as addCommentCommand,
716
+ P as deleteComment,
717
+ Z as getAllComments,
718
+ K as highlightComment,
719
+ j as reopenComment,
720
+ _ as replyToComment,
721
+ O as resolveComment
722
+ };
723
+ //# sourceMappingURL=CommentsPlugin.native-tMnWn8a2.mjs.map