@editora/core 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/LICENSE +21 -0
- package/dist/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
- package/dist/ApprovalWorkflowPlugin.native-C3jtAYjG.mjs +1076 -0
- package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
- package/dist/BlocksLibraryPlugin.native-HMWKxWNs.mjs +1327 -0
- package/dist/CitationsPlugin.native-BnU0qCwR.mjs +1464 -0
- package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
- package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
- package/dist/ConditionalContentPlugin.native-CfhY46rU.mjs +1367 -0
- package/dist/ContentRulesPlugin.native-nBLQ8QFZ.mjs +1099 -0
- package/dist/DataBindingPlugin.native-jQ1JPRTp.mjs +917 -0
- package/dist/DocSchemaPlugin.native-CHOge18O.mjs +1325 -0
- 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/MentionPlugin.native-BMDlOqur.mjs +734 -0
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
- package/dist/PIIRedactionPlugin.native-DcsjmtV1.mjs +1396 -0
- package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +86 -77
- package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +30 -30
- package/dist/SlashCommandsPlugin.native-CmxvMEaE.mjs +755 -0
- package/dist/SmartPastePlugin.native-BOKKtF07.mjs +1398 -0
- 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/TrackChangesPlugin.native-Bghu2q4a.mjs +761 -0
- package/dist/TranslationWorkflowPlugin.native-Bz6jDGvj.mjs +1728 -0
- package/dist/VersionDiffPlugin.native-Bvxgy--t.mjs +776 -0
- 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 +13 -13
- package/dist/editora.umd.js +13 -13
- package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/index-D1LOqg5C.js +10 -0
- package/dist/{index-OwnkG39N.mjs → index-DqC57IEH.mjs} +438 -328
- 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 +77 -40
- package/dist/webcomponent-core.js +456 -346
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +87 -107
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +503 -356
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +6003 -658
- package/package.json +2 -2
- 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
- package/dist/index-CqWQFb3D.js +0 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ajay Kumar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { f as
|
|
2
|
-
const b = /* @__PURE__ */ new Set(),
|
|
1
|
+
import { f as D, g as S } from "./editorContainerHelpers-C7kdWnS0.mjs";
|
|
2
|
+
const b = /* @__PURE__ */ new Set(), y = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
3
|
+
function z(t, l) {
|
|
4
|
+
if (l === t.innerHTML) return;
|
|
5
|
+
const i = window.execEditorCommand || window.executeEditorCommand;
|
|
6
|
+
if (typeof i == "function")
|
|
7
|
+
try {
|
|
8
|
+
i("recordDomTransaction", t, l, t.innerHTML);
|
|
9
|
+
} catch (r) {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
3
12
|
function R() {
|
|
4
13
|
if (typeof window == "undefined" || window.__anchorObserverInitialized) return;
|
|
5
14
|
window.__anchorObserverInitialized = !0, new MutationObserver((l) => {
|
|
6
|
-
l.forEach((
|
|
7
|
-
|
|
15
|
+
l.forEach((i) => {
|
|
16
|
+
i.removedNodes.forEach((r) => {
|
|
8
17
|
var n, e;
|
|
9
18
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
10
19
|
const a = r;
|
|
@@ -12,10 +21,10 @@ function R() {
|
|
|
12
21
|
const c = a.id;
|
|
13
22
|
c && b.delete(c);
|
|
14
23
|
}
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
24
|
+
const f = (e = a.querySelectorAll) == null ? void 0 : e.call(a, ".rte-anchor");
|
|
25
|
+
f == null || f.forEach((c) => {
|
|
26
|
+
const u = c.id;
|
|
27
|
+
u && b.delete(u);
|
|
19
28
|
});
|
|
20
29
|
}
|
|
21
30
|
});
|
|
@@ -25,36 +34,36 @@ function R() {
|
|
|
25
34
|
subtree: !0
|
|
26
35
|
});
|
|
27
36
|
}
|
|
28
|
-
function A(
|
|
29
|
-
return !
|
|
37
|
+
function A(t) {
|
|
38
|
+
return !t || t.trim().length === 0 ? { valid: !1, error: "Anchor ID cannot be empty" } : t.length > 256 ? { valid: !1, error: "Anchor ID must be less than 256 characters" } : /^[a-z_]/.test(t) ? /^[a-z0-9\-_]+$/.test(t) ? { valid: !0, error: "" } : { valid: !1, error: "Anchor ID can only contain letters, numbers, hyphens, and underscores" } : { valid: !1, error: "Anchor ID must start with a letter or underscore" };
|
|
30
39
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
34
|
-
const l =
|
|
40
|
+
function M() {
|
|
41
|
+
const t = D();
|
|
42
|
+
if (!t) return;
|
|
43
|
+
const l = S(t);
|
|
35
44
|
if (!l) return;
|
|
36
|
-
const
|
|
37
|
-
|
|
45
|
+
const i = l.querySelectorAll(".rte-anchor"), r = /* @__PURE__ */ new Set();
|
|
46
|
+
i.forEach((n) => {
|
|
38
47
|
const e = n.id;
|
|
39
48
|
e && r.add(e);
|
|
40
49
|
}), b.clear(), r.forEach((n) => b.add(n));
|
|
41
50
|
}
|
|
42
|
-
function
|
|
43
|
-
if (
|
|
44
|
-
const r =
|
|
45
|
-
if (n != null && n.closest(
|
|
51
|
+
function H(t) {
|
|
52
|
+
if (t) {
|
|
53
|
+
const r = t.startContainer, n = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
54
|
+
if (n != null && n.closest(y)) return !0;
|
|
46
55
|
}
|
|
47
56
|
const l = window.getSelection();
|
|
48
57
|
if (l && l.rangeCount > 0) {
|
|
49
58
|
const r = l.getRangeAt(0).startContainer, n = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
50
|
-
if (n != null && n.closest(
|
|
59
|
+
if (n != null && n.closest(y)) return !0;
|
|
51
60
|
}
|
|
52
|
-
const
|
|
53
|
-
return
|
|
61
|
+
const i = document.activeElement;
|
|
62
|
+
return i != null && i.closest(y) ? !0 : document.body.matches(y) || document.documentElement.matches(y);
|
|
54
63
|
}
|
|
55
|
-
function _(
|
|
56
|
-
|
|
57
|
-
const n =
|
|
64
|
+
function _(t, l, i, r) {
|
|
65
|
+
M();
|
|
66
|
+
const n = H(r), e = n ? {
|
|
58
67
|
overlay: "rgba(0, 0, 0, 0.62)",
|
|
59
68
|
dialogBg: "#1f2937",
|
|
60
69
|
panelBg: "#222d3a",
|
|
@@ -116,8 +125,8 @@ function _(o, l, d, r) {
|
|
|
116
125
|
z-index: 10000;
|
|
117
126
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
118
127
|
`;
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
128
|
+
const f = document.createElement("div");
|
|
129
|
+
if (f.className = "rte-anchor-dialog", f.style.cssText = `
|
|
121
130
|
background: ${e.dialogBg};
|
|
122
131
|
border: 1px solid ${e.border};
|
|
123
132
|
border-radius: 8px;
|
|
@@ -127,8 +136,8 @@ function _(o, l, d, r) {
|
|
|
127
136
|
overflow: hidden;
|
|
128
137
|
animation: rte-anchor-dialog-appear 0.2s ease;
|
|
129
138
|
`, !document.getElementById("rte-anchor-dialog-styles")) {
|
|
130
|
-
const
|
|
131
|
-
|
|
139
|
+
const d = document.createElement("style");
|
|
140
|
+
d.id = "rte-anchor-dialog-styles", d.textContent = `
|
|
132
141
|
@keyframes rte-anchor-dialog-appear {
|
|
133
142
|
from { opacity: 0; transform: scale(0.95); }
|
|
134
143
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -136,11 +145,11 @@ function _(o, l, d, r) {
|
|
|
136
145
|
.rte-anchor-dialog input:focus {
|
|
137
146
|
outline: none !important;
|
|
138
147
|
}
|
|
139
|
-
`, document.head.appendChild(
|
|
148
|
+
`, document.head.appendChild(d);
|
|
140
149
|
}
|
|
141
150
|
let c = "";
|
|
142
|
-
const
|
|
143
|
-
|
|
151
|
+
const u = document.createElement("div");
|
|
152
|
+
u.style.cssText = `
|
|
144
153
|
display: flex;
|
|
145
154
|
align-items: center;
|
|
146
155
|
justify-content: space-between;
|
|
@@ -148,8 +157,8 @@ function _(o, l, d, r) {
|
|
|
148
157
|
border-bottom: 1px solid ${e.border};
|
|
149
158
|
background: ${e.panelBg};
|
|
150
159
|
`;
|
|
151
|
-
const
|
|
152
|
-
|
|
160
|
+
const m = document.createElement("h3");
|
|
161
|
+
m.style.cssText = `margin: 0; font-size: 18px; font-weight: 600; color: ${e.text};`, m.textContent = "Add Anchor";
|
|
153
162
|
const p = document.createElement("button");
|
|
154
163
|
p.textContent = "✕", p.style.cssText = `
|
|
155
164
|
background: none;
|
|
@@ -169,15 +178,15 @@ function _(o, l, d, r) {
|
|
|
169
178
|
p.style.background = e.closeHoverBg, p.style.color = "#f8fafc";
|
|
170
179
|
}, p.onmouseout = () => {
|
|
171
180
|
p.style.background = "none", p.style.color = e.muted;
|
|
172
|
-
},
|
|
181
|
+
}, u.appendChild(m), u.appendChild(p);
|
|
173
182
|
const C = document.createElement("div");
|
|
174
183
|
C.style.cssText = "padding: 20px;";
|
|
175
184
|
const x = document.createElement("div");
|
|
176
185
|
x.style.cssText = "margin-bottom: 0;";
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
|
|
186
|
+
const v = document.createElement("label");
|
|
187
|
+
v.textContent = "Anchor ID", v.style.cssText = `display: block; font-size: 14px; font-weight: 500; color: ${e.text}; margin-bottom: 8px;`, v.setAttribute("for", "anchor-id-input");
|
|
188
|
+
const o = document.createElement("input");
|
|
189
|
+
o.id = "anchor-id-input", o.type = "text", o.placeholder = "e.g., section-introduction", o.value = "", o.style.cssText = `
|
|
181
190
|
width: 100%;
|
|
182
191
|
padding: 10px 12px;
|
|
183
192
|
font-size: 14px;
|
|
@@ -188,18 +197,18 @@ function _(o, l, d, r) {
|
|
|
188
197
|
background: ${e.fieldBg};
|
|
189
198
|
transition: all 0.2s ease;
|
|
190
199
|
box-sizing: border-box;
|
|
191
|
-
`,
|
|
192
|
-
const
|
|
193
|
-
|
|
200
|
+
`, o.style.setProperty("caret-color", e.fieldText);
|
|
201
|
+
const g = document.createElement("div");
|
|
202
|
+
g.style.cssText = `
|
|
194
203
|
color: #d32f2f;
|
|
195
204
|
font-size: 12px;
|
|
196
205
|
margin-top: 6px;
|
|
197
206
|
display: none;
|
|
198
207
|
`;
|
|
199
208
|
const B = document.createElement("div");
|
|
200
|
-
B.textContent = "URL-safe ID (letters, numbers, hyphens, underscores). Must start with letter or underscore.", B.style.cssText = `color: ${e.help}; font-size: 12px; margin-top: 8px; line-height: 1.4;`, x.appendChild(
|
|
201
|
-
const
|
|
202
|
-
|
|
209
|
+
B.textContent = "URL-safe ID (letters, numbers, hyphens, underscores). Must start with letter or underscore.", B.style.cssText = `color: ${e.help}; font-size: 12px; margin-top: 8px; line-height: 1.4;`, x.appendChild(v), x.appendChild(o), x.appendChild(g), x.appendChild(B), C.appendChild(x);
|
|
210
|
+
const w = document.createElement("div");
|
|
211
|
+
w.style.cssText = `
|
|
203
212
|
display: flex;
|
|
204
213
|
gap: 12px;
|
|
205
214
|
padding: 16px 20px;
|
|
@@ -207,8 +216,8 @@ function _(o, l, d, r) {
|
|
|
207
216
|
background: ${e.panelBg};
|
|
208
217
|
justify-content: flex-end;
|
|
209
218
|
`;
|
|
210
|
-
const
|
|
211
|
-
|
|
219
|
+
const h = document.createElement("button");
|
|
220
|
+
h.textContent = "Cancel", h.style.cssText = `
|
|
212
221
|
padding: 8px 16px;
|
|
213
222
|
font-size: 14px;
|
|
214
223
|
font-weight: 500;
|
|
@@ -218,9 +227,9 @@ function _(o, l, d, r) {
|
|
|
218
227
|
transition: all 0.2s ease;
|
|
219
228
|
background: ${e.cancelBg};
|
|
220
229
|
color: ${e.cancelText};
|
|
221
|
-
`,
|
|
222
|
-
const
|
|
223
|
-
|
|
230
|
+
`, h.onmouseover = () => h.style.background = e.cancelHover, h.onmouseout = () => h.style.background = e.cancelBg;
|
|
231
|
+
const s = document.createElement("button");
|
|
232
|
+
s.textContent = "Add Anchor", s.style.cssText = `
|
|
224
233
|
padding: 8px 16px;
|
|
225
234
|
font-size: 14px;
|
|
226
235
|
font-weight: 500;
|
|
@@ -230,66 +239,81 @@ function _(o, l, d, r) {
|
|
|
230
239
|
transition: all 0.2s ease;
|
|
231
240
|
background: ${e.saveBg};
|
|
232
241
|
color: white;
|
|
233
|
-
`,
|
|
234
|
-
const
|
|
235
|
-
|
|
242
|
+
`, s.disabled = !o.value.trim();
|
|
243
|
+
const $ = () => {
|
|
244
|
+
o.value.trim() ? (s.disabled = !1, s.style.background = e.saveBg, s.style.color = "white", s.style.cursor = "pointer") : (s.disabled = !0, s.style.background = e.saveDisabledBg, s.style.color = e.saveDisabledText, s.style.cursor = "not-allowed");
|
|
236
245
|
};
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
},
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
const k = A(
|
|
245
|
-
k.valid ? b.has(
|
|
246
|
+
s.onmouseover = () => {
|
|
247
|
+
s.disabled || (s.style.background = e.saveHover, s.style.boxShadow = n ? "0 2px 8px rgba(59, 130, 246, 0.35)" : "0 2px 8px rgba(0, 102, 204, 0.3)");
|
|
248
|
+
}, s.onmouseout = () => {
|
|
249
|
+
s.disabled || (s.style.background = e.saveBg, s.style.boxShadow = "none");
|
|
250
|
+
}, w.appendChild(h), w.appendChild(s), o.oninput = () => {
|
|
251
|
+
const d = o.value;
|
|
252
|
+
if ($(), d.trim()) {
|
|
253
|
+
const k = A(d);
|
|
254
|
+
k.valid ? b.has(d) ? (c = `Anchor ID already exists: ${d}`, g.textContent = "⚠ " + c, g.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg) : (c = "", g.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg) : (c = k.error, g.textContent = "⚠ " + c, g.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg);
|
|
246
255
|
} else
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
},
|
|
251
|
-
|
|
256
|
+
g.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg;
|
|
257
|
+
}, o.onfocus = () => {
|
|
258
|
+
o.style.borderColor = c ? e.fieldErrorBorder : e.saveBg, o.style.boxShadow = c ? `0 0 0 3px ${e.errorRing}` : `0 0 0 3px ${e.focusRing}`, o.style.background = c ? e.fieldErrorBg : e.fieldFocusBg;
|
|
259
|
+
}, o.onblur = () => {
|
|
260
|
+
o.style.boxShadow = "none", c || (o.style.background = e.fieldBg);
|
|
252
261
|
};
|
|
253
262
|
const T = () => {
|
|
254
|
-
const
|
|
255
|
-
!
|
|
256
|
-
},
|
|
263
|
+
const d = o.value.trim();
|
|
264
|
+
!d || !A(d).valid || b.has(d) || (i && i(d), a.remove());
|
|
265
|
+
}, E = () => {
|
|
257
266
|
a.remove();
|
|
258
267
|
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}, a.onclick = (
|
|
262
|
-
|
|
263
|
-
},
|
|
268
|
+
s.onclick = T, h.onclick = E, p.onclick = E, o.onkeydown = (d) => {
|
|
269
|
+
d.key === "Enter" ? (d.preventDefault(), T()) : d.key === "Escape" && (d.preventDefault(), E());
|
|
270
|
+
}, a.onclick = (d) => {
|
|
271
|
+
d.target === a && E();
|
|
272
|
+
}, f.appendChild(u), f.appendChild(C), f.appendChild(w), a.appendChild(f), document.body.appendChild(a), setTimeout(() => o.focus(), 100);
|
|
264
273
|
}
|
|
265
|
-
function
|
|
266
|
-
|
|
274
|
+
function I(t, l) {
|
|
275
|
+
var c;
|
|
276
|
+
let i;
|
|
267
277
|
if (l)
|
|
268
|
-
|
|
278
|
+
i = l;
|
|
269
279
|
else {
|
|
270
|
-
const
|
|
271
|
-
if (!
|
|
272
|
-
|
|
280
|
+
const u = window.getSelection();
|
|
281
|
+
if (!u || u.rangeCount === 0) return;
|
|
282
|
+
i = u.getRangeAt(0);
|
|
273
283
|
}
|
|
274
|
-
|
|
275
|
-
|
|
284
|
+
let r = null, n = i.startContainer;
|
|
285
|
+
for (; n && n !== document.body; ) {
|
|
286
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
287
|
+
const u = n;
|
|
288
|
+
if (u.getAttribute("contenteditable") === "true") {
|
|
289
|
+
r = u;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
n = n.parentNode;
|
|
294
|
+
}
|
|
295
|
+
const e = (c = r == null ? void 0 : r.innerHTML) != null ? c : "", a = document.createElement("span");
|
|
296
|
+
a.id = t, a.className = "rte-anchor", a.setAttribute("data-type", "anchor"), a.setAttribute("data-anchor-id", t), a.setAttribute("title", `Anchor: ${t}`), a.style.cssText = `
|
|
276
297
|
display: inline;
|
|
277
298
|
position: relative;
|
|
278
299
|
cursor: pointer;
|
|
279
|
-
`,
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
|
|
300
|
+
`, i.insertNode(a), b.add(t), i.setStart(a.nextSibling || a.parentNode, 0), i.collapse(!0);
|
|
301
|
+
const f = window.getSelection();
|
|
302
|
+
if (f && (f.removeAllRanges(), f.addRange(i)), r)
|
|
303
|
+
z(r, e), r.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
304
|
+
else {
|
|
305
|
+
const u = D();
|
|
306
|
+
if (u) {
|
|
307
|
+
const m = S(u);
|
|
308
|
+
m && m.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
309
|
+
}
|
|
286
310
|
}
|
|
287
|
-
|
|
311
|
+
N();
|
|
288
312
|
}
|
|
289
|
-
function
|
|
313
|
+
function N() {
|
|
290
314
|
if (document.getElementById("rte-anchor-styles")) return;
|
|
291
|
-
const
|
|
292
|
-
|
|
315
|
+
const t = document.createElement("style");
|
|
316
|
+
t.id = "rte-anchor-styles", t.textContent = `
|
|
293
317
|
.rte-anchor {
|
|
294
318
|
display: inline;
|
|
295
319
|
position: relative;
|
|
@@ -367,9 +391,9 @@ function $() {
|
|
|
367
391
|
outline: 2px solid #0066cc;
|
|
368
392
|
outline-offset: 2px;
|
|
369
393
|
}
|
|
370
|
-
`, document.head.appendChild(
|
|
394
|
+
`, document.head.appendChild(t);
|
|
371
395
|
}
|
|
372
|
-
const O = () => (typeof window != "undefined" && (R(),
|
|
396
|
+
const O = () => (typeof window != "undefined" && (R(), N()), {
|
|
373
397
|
name: "anchor",
|
|
374
398
|
toolbar: [
|
|
375
399
|
{
|
|
@@ -382,15 +406,15 @@ const O = () => (typeof window != "undefined" && (R(), $()), {
|
|
|
382
406
|
commands: {
|
|
383
407
|
insertAnchor: () => {
|
|
384
408
|
try {
|
|
385
|
-
const
|
|
386
|
-
if (!
|
|
409
|
+
const t = window.getSelection();
|
|
410
|
+
if (!t || t.rangeCount === 0)
|
|
387
411
|
return alert("Please place your cursor where you want to insert the anchor."), !1;
|
|
388
|
-
const l =
|
|
389
|
-
return _("add", "", (
|
|
390
|
-
|
|
412
|
+
const l = t.getRangeAt(0).cloneRange();
|
|
413
|
+
return _("add", "", (i) => {
|
|
414
|
+
I(i, l);
|
|
391
415
|
}, l), !0;
|
|
392
|
-
} catch (
|
|
393
|
-
return console.error("Failed to insert anchor:",
|
|
416
|
+
} catch (t) {
|
|
417
|
+
return console.error("Failed to insert anchor:", t), !1;
|
|
394
418
|
}
|
|
395
419
|
}
|
|
396
420
|
},
|
|
@@ -401,4 +425,4 @@ const O = () => (typeof window != "undefined" && (R(), $()), {
|
|
|
401
425
|
export {
|
|
402
426
|
O as AnchorPlugin
|
|
403
427
|
};
|
|
404
|
-
//# sourceMappingURL=AnchorPlugin.native-
|
|
428
|
+
//# sourceMappingURL=AnchorPlugin.native-BcYGEtd9.mjs.map
|