@editora/core 1.0.14 → 1.0.16
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/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
- package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
- package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
- package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
- package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
- package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
- package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
- package/dist/{CodePlugin.native-veDC_kx5.mjs → CodePlugin.native-BH-K4xmW.mjs} +1049 -917
- package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
- package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
- package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
- package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
- package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
- package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
- package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
- package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
- package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
- package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
- package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
- package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
- package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
- package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
- package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
- package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
- package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
- package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
- package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
- package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
- package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
- package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
- package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
- package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
- package/dist/core.css +1 -1
- package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
- package/dist/{documentManager-vQ1VkbUY.mjs → documentManager-BcBIv5P-.mjs} +3 -3
- package/dist/editora.min.js +26 -24
- package/dist/editora.umd.js +26 -24
- package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
- package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
- package/dist/index-B1_vtXRz.mjs +3910 -0
- package/dist/index-C6BoNR2t.js +12 -0
- package/dist/{index-BslAFzmv.mjs → index-CavM-mEM.mjs} +6391 -6203
- package/dist/index.cjs.js +3 -3
- package/dist/{index.es-BYD2KEo6.mjs → index.es-BK-4TPv8.mjs} +1562 -1546
- package/dist/index.esm.js +17 -14
- package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-BsnKYYHL.mjs} +4 -3
- package/dist/plugin-loader.js +53 -52
- package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-DhWKBjsL.mjs} +3 -3
- package/dist/webcomponent-core.js +2039 -473
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +100 -70
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +2208 -641
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1575 -1209
- package/index.d.ts +32 -0
- package/package.json +10 -3
- package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
- package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
- package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
- package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
- package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
- package/dist/index-B9MPiUAR.mjs +0 -2341
- package/dist/index-BLm1MtzH.js +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const S = ".rte-content, .editora-content", ht = "rte-citations-styles", m = "rte-citations-panel", it = ".rte-citation-ref[data-citation-id]", G = '.rte-citation-bibliography[data-type="citation-bibliography"]', V = '.rte-citation-footnotes[data-type="citation-footnotes"]', x = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', L = ["apa", "mla", "chicago"], Pt = {
|
|
2
2
|
panelTitle: "Citations",
|
|
3
3
|
panelAriaLabel: "Citations panel",
|
|
4
4
|
styleLabel: "Citation style",
|
|
@@ -19,176 +19,168 @@ const $ = ".rte-content, .editora-content", pt = "rte-citations-styles", m = "rt
|
|
|
19
19
|
deleteRecentText: "x",
|
|
20
20
|
summaryPrefix: "Citations",
|
|
21
21
|
invalidMessage: "Author and title are required."
|
|
22
|
-
}, f = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(),
|
|
23
|
-
let
|
|
22
|
+
}, f = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), xt = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new Set();
|
|
23
|
+
let B = null, O = null, P = null, k = null, X = 0, Dt = 0, st = 0, M = null, p = null;
|
|
24
24
|
function g(t) {
|
|
25
25
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function Ht(t) {
|
|
28
28
|
return t.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const e =
|
|
30
|
+
function yt(t, n) {
|
|
31
|
+
const e = n(t);
|
|
32
32
|
if (!e) return "";
|
|
33
33
|
const i = e.match(/\d{4}/);
|
|
34
34
|
return i ? i[0] : e;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const e =
|
|
36
|
+
function Ct(t, n) {
|
|
37
|
+
const e = n(t);
|
|
38
38
|
return e ? /^https?:\/\//i.test(e) ? e : `https://${e}` : "";
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function _(t) {
|
|
41
41
|
return t.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function wt(t, n) {
|
|
44
44
|
return {
|
|
45
|
-
id:
|
|
46
|
-
author:
|
|
47
|
-
year:
|
|
48
|
-
title:
|
|
49
|
-
source:
|
|
50
|
-
url:
|
|
51
|
-
note:
|
|
45
|
+
id: _(n.normalizeText(t.id || "")),
|
|
46
|
+
author: n.normalizeText(t.author || ""),
|
|
47
|
+
year: yt(t.year || "", n.normalizeText) || void 0,
|
|
48
|
+
title: n.normalizeText(t.title || ""),
|
|
49
|
+
source: n.normalizeText(t.source || "") || void 0,
|
|
50
|
+
url: Ct(t.url || "", n.normalizeText) || void 0,
|
|
51
|
+
note: n.normalizeText(t.note || "") || void 0
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
var i,
|
|
56
|
-
const
|
|
57
|
-
...
|
|
54
|
+
function Q(t = {}) {
|
|
55
|
+
var i, o;
|
|
56
|
+
const n = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", e = {
|
|
57
|
+
...Pt,
|
|
58
58
|
...t.labels || {}
|
|
59
59
|
};
|
|
60
60
|
return {
|
|
61
|
-
defaultStyle:
|
|
61
|
+
defaultStyle: n,
|
|
62
62
|
enableFootnoteSync: t.enableFootnoteSync !== !1,
|
|
63
63
|
debounceMs: Math.max(80, Number((i = t.debounceMs) != null ? i : 220)),
|
|
64
|
-
maxRecentCitations: Math.max(3, Math.min(30, Number((
|
|
64
|
+
maxRecentCitations: Math.max(3, Math.min(30, Number((o = t.maxRecentCitations) != null ? o : 8))),
|
|
65
65
|
labels: e,
|
|
66
|
-
normalizeText: t.normalizeText ||
|
|
66
|
+
normalizeText: t.normalizeText || Ht,
|
|
67
67
|
generateCitationId: typeof t.generateCitationId == "function" ? t.generateCitationId : void 0
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function vt(t) {
|
|
71
71
|
return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function ut(t) {
|
|
74
74
|
return t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || t;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function J(t) {
|
|
77
77
|
return t ? (t.getAttribute("data-theme") || t.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : t.classList.contains("dark") || t.classList.contains("editora-theme-dark") || t.classList.contains("rte-theme-dark") : !1;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
const e =
|
|
83
|
-
return
|
|
79
|
+
function Ft(t) {
|
|
80
|
+
const n = ut(t);
|
|
81
|
+
if (J(n)) return !0;
|
|
82
|
+
const e = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
83
|
+
return J(e) ? !0 : J(document.documentElement) || J(document.body);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
t.classList.remove("rte-citations-theme-dark"),
|
|
85
|
+
function et(t, n) {
|
|
86
|
+
t.classList.remove("rte-citations-theme-dark"), Ft(n) && t.classList.add("rte-citations-theme-dark");
|
|
87
87
|
}
|
|
88
|
-
function h(t,
|
|
88
|
+
function h(t, n = !0) {
|
|
89
89
|
if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement) return t.contentElement;
|
|
90
90
|
if ((t == null ? void 0 : t.editorElement) instanceof HTMLElement) {
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
93
|
-
const r =
|
|
91
|
+
const o = t.editorElement;
|
|
92
|
+
if (o.matches(S)) return o;
|
|
93
|
+
const r = o.querySelector(S);
|
|
94
94
|
if (r instanceof HTMLElement) return r;
|
|
95
95
|
}
|
|
96
96
|
const e = window.getSelection();
|
|
97
97
|
if (e && e.rangeCount > 0) {
|
|
98
|
-
const
|
|
98
|
+
const o = e.getRangeAt(0).startContainer, r = vt(o), a = r == null ? void 0 : r.closest(S);
|
|
99
99
|
if (a) return a;
|
|
100
100
|
}
|
|
101
101
|
const i = document.activeElement;
|
|
102
102
|
if (i) {
|
|
103
|
-
if (i.matches(
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
103
|
+
if (i.matches(S)) return i;
|
|
104
|
+
const o = i.closest(S);
|
|
105
|
+
if (o) return o;
|
|
106
106
|
}
|
|
107
|
-
return p && p.isConnected ? p : (p && !p.isConnected && (p = null),
|
|
107
|
+
return p && p.isConnected ? p : (p && !p.isConnected && (p = null), n ? document.querySelector(S) : null);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function $(t) {
|
|
110
110
|
return t.getAttribute("contenteditable") === "false" || t.getAttribute("data-readonly") === "true";
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
const
|
|
114
|
-
return
|
|
112
|
+
function j(t) {
|
|
113
|
+
const n = vt(t);
|
|
114
|
+
return n ? !!(n.closest(G) || n.closest(V)) : !1;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
if (
|
|
118
|
-
const e =
|
|
116
|
+
function _t(t, n) {
|
|
117
|
+
if (st += 1, n.generateCitationId) {
|
|
118
|
+
const e = n.generateCitationId({ editor: t, index: st }), i = _(n.normalizeText(e || ""));
|
|
119
119
|
if (i) return i;
|
|
120
120
|
}
|
|
121
|
-
return `cite-${Date.now().toString(36)}-${
|
|
121
|
+
return `cite-${Date.now().toString(36)}-${st.toString(36)}`;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return t.map((
|
|
123
|
+
function ct(t) {
|
|
124
|
+
return t.map((n) => (n || "").trim()).filter(Boolean).join(" ").trim();
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function qt(t, n) {
|
|
127
127
|
const e = t.author || "Unknown", i = t.year || "n.d.";
|
|
128
|
-
return
|
|
129
|
-
}
|
|
130
|
-
function
|
|
131
|
-
const
|
|
132
|
-
return
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
128
|
+
return n === "mla" ? `(${e} ${i})` : n === "chicago" ? `(${e} ${i})` : `(${e}, ${i})`;
|
|
129
|
+
}
|
|
130
|
+
function N(t) {
|
|
131
|
+
const n = t.trim();
|
|
132
|
+
return !n || /[.!?]$/.test(n) ? n : `${n}.`;
|
|
133
|
+
}
|
|
134
|
+
function dt(t, n) {
|
|
135
|
+
const e = N(t.author || "Unknown"), i = t.year || "n.d.", o = t.title || "Untitled", r = (t.source || "").trim(), a = t.url || "";
|
|
136
|
+
return ct(n === "mla" ? [
|
|
137
|
+
e,
|
|
138
|
+
`"${N(o)}"`,
|
|
139
|
+
r ? `${r.replace(/[.,]$/, "")},` : "",
|
|
136
140
|
`${i}.`,
|
|
137
141
|
a
|
|
138
|
-
] :
|
|
139
|
-
`${e}.`,
|
|
140
|
-
`${n}.`,
|
|
141
|
-
r ? `${r}.` : "",
|
|
142
|
-
`(${i}).`,
|
|
143
|
-
a
|
|
144
|
-
] : [
|
|
145
|
-
`${e}.`,
|
|
146
|
-
`(${i}).`,
|
|
147
|
-
`${n}.`,
|
|
148
|
-
r ? `${r}.` : "",
|
|
149
|
-
a
|
|
150
|
-
]);
|
|
142
|
+
] : n === "chicago" ? [e, N(o), N(r), `(${i}).`, a] : [e, `(${i}).`, N(o), N(r), a]);
|
|
151
143
|
}
|
|
152
144
|
function R(t) {
|
|
153
|
-
return Array.from(t.querySelectorAll(
|
|
154
|
-
(
|
|
145
|
+
return Array.from(t.querySelectorAll(it)).filter(
|
|
146
|
+
(n) => !n.closest(G) && !n.closest(V)
|
|
155
147
|
);
|
|
156
148
|
}
|
|
157
|
-
function
|
|
158
|
-
const e =
|
|
149
|
+
function Et(t, n) {
|
|
150
|
+
const e = _(n.normalizeText(t.getAttribute("data-citation-id") || ""));
|
|
159
151
|
if (!e) return null;
|
|
160
|
-
const i =
|
|
152
|
+
const i = n.normalizeText(t.getAttribute("data-citation-author") || ""), o = n.normalizeText(t.getAttribute("data-citation-title") || "");
|
|
161
153
|
return {
|
|
162
154
|
id: e,
|
|
163
155
|
author: i || "Unknown",
|
|
164
|
-
year:
|
|
165
|
-
title:
|
|
166
|
-
source:
|
|
167
|
-
url:
|
|
168
|
-
note:
|
|
156
|
+
year: yt(t.getAttribute("data-citation-year") || "", n.normalizeText) || void 0,
|
|
157
|
+
title: o || "Untitled",
|
|
158
|
+
source: n.normalizeText(t.getAttribute("data-citation-source") || "") || void 0,
|
|
159
|
+
url: Ct(t.getAttribute("data-citation-url") || "", n.normalizeText) || void 0,
|
|
160
|
+
note: n.normalizeText(t.getAttribute("data-citation-note") || "") || void 0
|
|
169
161
|
};
|
|
170
162
|
}
|
|
171
|
-
function
|
|
172
|
-
t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id",
|
|
163
|
+
function St(t, n, e) {
|
|
164
|
+
t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", n.id), t.setAttribute("data-citation-author", n.author || ""), t.setAttribute("data-citation-year", n.year || ""), t.setAttribute("data-citation-title", n.title || ""), t.setAttribute("data-citation-source", n.source || ""), t.setAttribute("data-citation-url", n.url || ""), t.setAttribute("data-citation-note", n.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", e), t.textContent = qt(n, e);
|
|
173
165
|
}
|
|
174
|
-
function
|
|
175
|
-
const i =
|
|
166
|
+
function rt(t, n, e) {
|
|
167
|
+
const i = ut(t);
|
|
176
168
|
Array.from(
|
|
177
169
|
i.querySelectorAll(
|
|
178
|
-
`.rte-toolbar-button[data-command="${
|
|
170
|
+
`.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`
|
|
179
171
|
)
|
|
180
172
|
).forEach((r) => {
|
|
181
173
|
r.classList.toggle("active", e), r.setAttribute("data-active", e ? "true" : "false"), r.setAttribute("aria-pressed", e ? "true" : "false");
|
|
182
174
|
});
|
|
183
175
|
}
|
|
184
|
-
function
|
|
176
|
+
function z(t, n) {
|
|
185
177
|
const e = T.get(t);
|
|
186
|
-
return e && L.includes(e) ? e : (
|
|
178
|
+
return e && L.includes(e) ? e : (n == null ? void 0 : n.defaultStyle) || "apa";
|
|
187
179
|
}
|
|
188
|
-
function
|
|
180
|
+
function U(t, n) {
|
|
189
181
|
const e = R(t), i = /* @__PURE__ */ new Map();
|
|
190
|
-
return e.forEach((
|
|
191
|
-
const r =
|
|
182
|
+
return e.forEach((o) => {
|
|
183
|
+
const r = Et(o, n);
|
|
192
184
|
if (!r) return;
|
|
193
185
|
if (!i.has(r.id)) {
|
|
194
186
|
i.set(r.id, r);
|
|
@@ -206,80 +198,80 @@ function j(t, o) {
|
|
|
206
198
|
});
|
|
207
199
|
}), Array.from(i.values());
|
|
208
200
|
}
|
|
209
|
-
function
|
|
210
|
-
const i =
|
|
201
|
+
function Kt(t, n, e) {
|
|
202
|
+
const i = wt(n, e);
|
|
211
203
|
if (!i.id || !i.author || !i.title) return;
|
|
212
|
-
const r = (
|
|
213
|
-
|
|
204
|
+
const r = (H.get(t) || []).filter((a) => a.id !== i.id);
|
|
205
|
+
H.set(t, [i, ...r].slice(0, e.maxRecentCitations));
|
|
214
206
|
}
|
|
215
|
-
function
|
|
216
|
-
const i =
|
|
217
|
-
|
|
218
|
-
a.id &&
|
|
207
|
+
function at(t, n, e) {
|
|
208
|
+
const i = H.get(t) || [], o = /* @__PURE__ */ new Map();
|
|
209
|
+
n.slice(Math.max(0, n.length - e.maxRecentCitations)).reverse().forEach((a) => {
|
|
210
|
+
a.id && o.set(a.id, a);
|
|
219
211
|
}), i.forEach((a) => {
|
|
220
|
-
!a.id ||
|
|
212
|
+
!a.id || o.has(a.id) || o.set(a.id, a);
|
|
221
213
|
});
|
|
222
|
-
const r = Array.from(
|
|
223
|
-
return
|
|
214
|
+
const r = Array.from(o.values()).slice(0, e.maxRecentCitations);
|
|
215
|
+
return H.set(t, r), r;
|
|
224
216
|
}
|
|
225
|
-
function $t(t,
|
|
226
|
-
const
|
|
227
|
-
return
|
|
217
|
+
function $t(t, n, e, i) {
|
|
218
|
+
const o = _(i.normalizeText(n || ""));
|
|
219
|
+
return o && at(t, e, i).find((a) => a.id === o) || null;
|
|
228
220
|
}
|
|
229
|
-
function
|
|
230
|
-
const i =
|
|
221
|
+
function jt(t, n, e) {
|
|
222
|
+
const i = _(e.normalizeText(n || ""));
|
|
231
223
|
if (!i) return !1;
|
|
232
|
-
const
|
|
233
|
-
return r.length ===
|
|
224
|
+
const o = H.get(t) || [], r = o.filter((a) => a.id !== i);
|
|
225
|
+
return r.length === o.length ? !1 : (H.set(t, r), !0);
|
|
234
226
|
}
|
|
235
|
-
function
|
|
227
|
+
function At(t, n, e) {
|
|
236
228
|
const i = document.createElement("section");
|
|
237
|
-
i.className = t, i.setAttribute("data-type",
|
|
238
|
-
const
|
|
239
|
-
|
|
229
|
+
i.className = t, i.setAttribute("data-type", n), i.setAttribute("contenteditable", "false"), i.setAttribute("aria-label", e), n === "citation-bibliography" ? i.setAttribute("role", "doc-bibliography") : n === "citation-footnotes" && i.setAttribute("role", "doc-endnotes");
|
|
230
|
+
const o = document.createElement("h3");
|
|
231
|
+
o.className = "rte-citation-section-title", o.textContent = e;
|
|
240
232
|
const r = document.createElement("ol");
|
|
241
|
-
return r.className = "rte-citation-list", r.setAttribute("role", "list"), i.appendChild(
|
|
233
|
+
return r.className = "rte-citation-list", r.setAttribute("role", "list"), i.appendChild(o), i.appendChild(r), i;
|
|
242
234
|
}
|
|
243
|
-
function
|
|
244
|
-
let e = t.querySelector(
|
|
245
|
-
e || (e =
|
|
235
|
+
function Ut(t, n) {
|
|
236
|
+
let e = t.querySelector(G);
|
|
237
|
+
e || (e = At("rte-citation-bibliography", "citation-bibliography", n.labels.bibliographyTitle), t.appendChild(e));
|
|
246
238
|
const i = e.querySelector(".rte-citation-section-title");
|
|
247
|
-
return i && (i.textContent =
|
|
239
|
+
return i && (i.textContent = n.labels.bibliographyTitle), e.setAttribute("aria-label", n.labels.bibliographyTitle), e;
|
|
248
240
|
}
|
|
249
|
-
function
|
|
250
|
-
let e = t.querySelector(
|
|
251
|
-
e || (e =
|
|
241
|
+
function Wt(t, n) {
|
|
242
|
+
let e = t.querySelector(V);
|
|
243
|
+
e || (e = At("rte-citation-footnotes", "citation-footnotes", n.labels.footnotesTitle), t.appendChild(e));
|
|
252
244
|
const i = e.querySelector(".rte-citation-section-title");
|
|
253
|
-
return i && (i.textContent =
|
|
245
|
+
return i && (i.textContent = n.labels.footnotesTitle), e.setAttribute("aria-label", n.labels.footnotesTitle), e;
|
|
254
246
|
}
|
|
255
|
-
function
|
|
256
|
-
const e = t.querySelector(
|
|
247
|
+
function kt(t, n) {
|
|
248
|
+
const e = t.querySelector(n);
|
|
257
249
|
e == null || e.remove();
|
|
258
250
|
}
|
|
259
|
-
function
|
|
260
|
-
if (
|
|
261
|
-
|
|
251
|
+
function Gt(t, n, e, i) {
|
|
252
|
+
if (n.length === 0) {
|
|
253
|
+
kt(t, G);
|
|
262
254
|
return;
|
|
263
255
|
}
|
|
264
|
-
const r =
|
|
256
|
+
const r = Ut(t, e).querySelector(".rte-citation-list");
|
|
265
257
|
if (!r) return;
|
|
266
258
|
const a = document.createDocumentFragment();
|
|
267
|
-
|
|
259
|
+
n.forEach((s, d) => {
|
|
268
260
|
const c = document.createElement("li");
|
|
269
|
-
c.className = "rte-citation-item", c.id = `rte-citation-entry-${s.id}`, c.setAttribute("data-citation-id", s.id), c.setAttribute("data-citation-number", String(d + 1)), c.textContent =
|
|
261
|
+
c.className = "rte-citation-item", c.id = `rte-citation-entry-${s.id}`, c.setAttribute("data-citation-id", s.id), c.setAttribute("data-citation-number", String(d + 1)), c.textContent = dt(s, i), a.appendChild(c);
|
|
270
262
|
}), r.innerHTML = "", r.appendChild(a);
|
|
271
263
|
}
|
|
272
|
-
function
|
|
273
|
-
if (!e.enableFootnoteSync ||
|
|
274
|
-
|
|
264
|
+
function Vt(t, n, e, i) {
|
|
265
|
+
if (!e.enableFootnoteSync || n.length === 0) {
|
|
266
|
+
kt(t, V), R(t).forEach((l) => {
|
|
275
267
|
l.removeAttribute("data-footnote-number"), l.removeAttribute("data-footnote-target");
|
|
276
268
|
});
|
|
277
269
|
return;
|
|
278
270
|
}
|
|
279
|
-
const r =
|
|
271
|
+
const r = Wt(t, e).querySelector(".rte-citation-list");
|
|
280
272
|
if (!r) return;
|
|
281
273
|
const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
282
|
-
|
|
274
|
+
n.forEach((l, u) => {
|
|
283
275
|
s.set(l.id, u + 1);
|
|
284
276
|
});
|
|
285
277
|
const d = /* @__PURE__ */ new Map();
|
|
@@ -294,42 +286,42 @@ function Gt(t, o, e, i) {
|
|
|
294
286
|
l.setAttribute("data-footnote-number", String(A)), l.setAttribute("data-footnote-target", `rte-citation-note-${u}`), a.has(u) || a.set(u, w);
|
|
295
287
|
});
|
|
296
288
|
const c = document.createDocumentFragment();
|
|
297
|
-
|
|
289
|
+
n.forEach((l, u) => {
|
|
298
290
|
const b = document.createElement("li");
|
|
299
291
|
b.className = "rte-citation-item rte-citation-footnote-item", b.id = `rte-citation-note-${l.id}`, b.setAttribute("data-citation-id", l.id);
|
|
300
292
|
const w = document.createElement("span");
|
|
301
293
|
w.className = "rte-citation-footnote-number", w.textContent = `${u + 1}. `;
|
|
302
294
|
const A = document.createElement("span");
|
|
303
295
|
A.className = "rte-citation-footnote-text";
|
|
304
|
-
const
|
|
305
|
-
A.textContent = `${
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
308
|
-
const
|
|
309
|
-
|
|
296
|
+
const Ot = l.note ? `${l.note}. ` : "";
|
|
297
|
+
A.textContent = `${Ot}${dt(l, i)}`, b.appendChild(w), b.appendChild(A);
|
|
298
|
+
const pt = a.get(l.id);
|
|
299
|
+
if (pt) {
|
|
300
|
+
const q = document.createElement("a");
|
|
301
|
+
q.className = "rte-citation-backref", q.href = `#${pt}`, q.setAttribute("aria-label", `Back to citation ${u + 1}`), q.textContent = "Back", b.appendChild(q);
|
|
310
302
|
}
|
|
311
303
|
c.appendChild(b);
|
|
312
304
|
}), r.innerHTML = "", r.appendChild(c);
|
|
313
305
|
}
|
|
314
|
-
function
|
|
315
|
-
const
|
|
316
|
-
t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${
|
|
306
|
+
function Yt(t, n, e, i) {
|
|
307
|
+
const o = dt(n, e);
|
|
308
|
+
t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${o}`);
|
|
317
309
|
}
|
|
318
|
-
function
|
|
310
|
+
function Xt(t, n, e) {
|
|
319
311
|
const i = R(t);
|
|
320
|
-
let
|
|
312
|
+
let o = `${n}:${e ? "1" : "0"}:${i.length}`;
|
|
321
313
|
return i.forEach((r) => {
|
|
322
|
-
|
|
323
|
-
}),
|
|
314
|
+
o += `|${r.getAttribute("data-citation-id") || ""}`, o += `|${r.getAttribute("data-citation-author") || ""}`, o += `|${r.getAttribute("data-citation-year") || ""}`, o += `|${r.getAttribute("data-citation-title") || ""}`, o += `|${r.getAttribute("data-citation-source") || ""}`, o += `|${r.getAttribute("data-citation-url") || ""}`, o += `|${r.getAttribute("data-citation-note") || ""}`;
|
|
315
|
+
}), o;
|
|
324
316
|
}
|
|
325
|
-
function
|
|
326
|
-
const
|
|
327
|
-
if (!
|
|
317
|
+
function F(t) {
|
|
318
|
+
const n = v.get(t);
|
|
319
|
+
if (!n) return;
|
|
328
320
|
const e = f.get(t) || M;
|
|
329
321
|
if (!e) return;
|
|
330
|
-
const i =
|
|
322
|
+
const i = z(t, e), o = U(t, e), r = at(t, o, e), a = n.querySelector(".rte-citations-status"), s = n.querySelector('[data-action="cycle-style"]'), d = n.querySelector(".rte-citations-recent-list");
|
|
331
323
|
if (a) {
|
|
332
|
-
const c =
|
|
324
|
+
const c = o.length;
|
|
333
325
|
a.textContent = `${e.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${e.enableFootnoteSync ? "On" : "Off"}`;
|
|
334
326
|
}
|
|
335
327
|
if (s && (s.textContent = `${e.labels.styleButtonPrefix}: ${i.toUpperCase()}`, s.setAttribute("aria-label", `${e.labels.styleButtonPrefix}: ${i.toUpperCase()}`)), d) {
|
|
@@ -364,189 +356,189 @@ function H(t) {
|
|
|
364
356
|
).join("");
|
|
365
357
|
}
|
|
366
358
|
}
|
|
367
|
-
function y(t,
|
|
368
|
-
const i =
|
|
369
|
-
if (!e &&
|
|
370
|
-
return
|
|
359
|
+
function y(t, n, e = !1) {
|
|
360
|
+
const i = z(t, n), o = Xt(t, i, n.enableFootnoteSync);
|
|
361
|
+
if (!e && xt.get(t) === o)
|
|
362
|
+
return U(t, n);
|
|
371
363
|
const r = R(t), a = /* @__PURE__ */ new Map();
|
|
372
364
|
r.forEach((c) => {
|
|
373
|
-
const l =
|
|
365
|
+
const l = Et(c, n);
|
|
374
366
|
l && (a.has(l.id) || a.set(l.id, l));
|
|
375
367
|
});
|
|
376
368
|
const s = Array.from(a.values());
|
|
377
|
-
|
|
369
|
+
at(t, s, n);
|
|
378
370
|
const d = /* @__PURE__ */ new Map();
|
|
379
371
|
return s.forEach((c, l) => {
|
|
380
372
|
d.set(c.id, l + 1);
|
|
381
373
|
}), r.forEach((c) => {
|
|
382
374
|
const l = c.getAttribute("data-citation-id") || "", u = a.get(l);
|
|
383
375
|
if (!u) return;
|
|
384
|
-
|
|
376
|
+
St(c, u, i);
|
|
385
377
|
const b = d.get(u.id) || 1;
|
|
386
|
-
|
|
387
|
-
}),
|
|
378
|
+
Yt(c, u, i, Math.max(1, b));
|
|
379
|
+
}), Gt(t, s, n, i), Vt(t, s, n, i), xt.set(t, o), F(t), t.dispatchEvent(
|
|
388
380
|
new CustomEvent("editora:citations-refreshed", {
|
|
389
381
|
bubbles: !0,
|
|
390
382
|
detail: {
|
|
391
383
|
citations: s,
|
|
392
384
|
style: i,
|
|
393
|
-
footnoteSync:
|
|
385
|
+
footnoteSync: n.enableFootnoteSync
|
|
394
386
|
}
|
|
395
387
|
})
|
|
396
388
|
), s;
|
|
397
389
|
}
|
|
398
|
-
function kt(t) {
|
|
399
|
-
const o = Q.get(t);
|
|
400
|
-
typeof o == "number" && (window.clearTimeout(o), q.delete(o), Q.delete(t));
|
|
401
|
-
}
|
|
402
390
|
function Tt(t) {
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
391
|
+
const n = tt.get(t);
|
|
392
|
+
typeof n == "number" && (window.clearTimeout(n), K.delete(n), tt.delete(t));
|
|
393
|
+
}
|
|
394
|
+
function Mt(t) {
|
|
395
|
+
const n = f.get(t) || M;
|
|
396
|
+
if (!n) return;
|
|
397
|
+
Tt(t);
|
|
406
398
|
const e = window.setTimeout(() => {
|
|
407
|
-
|
|
408
|
-
},
|
|
409
|
-
|
|
410
|
-
}
|
|
411
|
-
function
|
|
412
|
-
const
|
|
413
|
-
if (!
|
|
414
|
-
if (
|
|
415
|
-
const a =
|
|
416
|
-
if (t.contains(a.commonAncestorContainer) && !
|
|
399
|
+
K.delete(e), tt.delete(t), y(t, n, !1);
|
|
400
|
+
}, n.debounceMs);
|
|
401
|
+
K.add(e), tt.set(t, e);
|
|
402
|
+
}
|
|
403
|
+
function Jt(t) {
|
|
404
|
+
const n = window.getSelection();
|
|
405
|
+
if (!n) throw new Error("Selection unavailable");
|
|
406
|
+
if (n.rangeCount > 0) {
|
|
407
|
+
const a = n.getRangeAt(0);
|
|
408
|
+
if (t.contains(a.commonAncestorContainer) && !j(a.commonAncestorContainer))
|
|
417
409
|
return a.cloneRange();
|
|
418
410
|
}
|
|
419
|
-
const e = document.createRange(), i = t.querySelector(
|
|
411
|
+
const e = document.createRange(), i = t.querySelector(G), o = t.querySelector(V), r = i || o;
|
|
420
412
|
return r ? (e.setStartBefore(r), e.collapse(!0), e) : (e.selectNodeContents(t), e.collapse(!1), e);
|
|
421
413
|
}
|
|
422
|
-
function
|
|
414
|
+
function ft(t) {
|
|
423
415
|
t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
424
416
|
}
|
|
425
|
-
function
|
|
426
|
-
if (
|
|
417
|
+
function bt(t, n) {
|
|
418
|
+
if (n === t.innerHTML) return;
|
|
427
419
|
const e = window.execEditorCommand || window.executeEditorCommand;
|
|
428
420
|
if (typeof e == "function")
|
|
429
421
|
try {
|
|
430
|
-
e("recordDomTransaction", t,
|
|
422
|
+
e("recordDomTransaction", t, n, t.innerHTML);
|
|
431
423
|
} catch (i) {
|
|
432
424
|
}
|
|
433
425
|
}
|
|
434
|
-
function
|
|
426
|
+
function Lt(t, n) {
|
|
435
427
|
const e = window.getSelection();
|
|
436
428
|
if (!e) return;
|
|
437
429
|
const i = document.createRange();
|
|
438
430
|
if (t.nodeType === Node.TEXT_NODE) {
|
|
439
|
-
const
|
|
440
|
-
i.setStart(
|
|
431
|
+
const o = t, r = Math.max(0, Math.min(n, o.length));
|
|
432
|
+
i.setStart(o, r);
|
|
441
433
|
} else {
|
|
442
|
-
const
|
|
434
|
+
const o = t.childNodes.length, r = Math.max(0, Math.min(n, o));
|
|
443
435
|
i.setStart(t, r);
|
|
444
436
|
}
|
|
445
437
|
i.collapse(!0), e.removeAllRanges(), e.addRange(i);
|
|
446
438
|
}
|
|
447
|
-
function
|
|
439
|
+
function Rt(t) {
|
|
448
440
|
if (t.collapsed || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1 || !(t.startContainer instanceof Element || t.startContainer instanceof DocumentFragment))
|
|
449
441
|
return null;
|
|
450
|
-
const
|
|
451
|
-
return !(
|
|
442
|
+
const n = t.startContainer.childNodes[t.startOffset];
|
|
443
|
+
return !(n instanceof HTMLElement) || !n.matches(it) ? null : n;
|
|
452
444
|
}
|
|
453
|
-
function
|
|
454
|
-
const { startContainer: i, startOffset:
|
|
445
|
+
function Z(t, n, e) {
|
|
446
|
+
const { startContainer: i, startOffset: o } = t;
|
|
455
447
|
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
456
448
|
const a = i;
|
|
457
449
|
if (e === "previous") {
|
|
458
|
-
if (
|
|
459
|
-
} else if (
|
|
460
|
-
return a.childNodes[
|
|
450
|
+
if (o > 0) return a.childNodes[o - 1] || null;
|
|
451
|
+
} else if (o < a.childNodes.length)
|
|
452
|
+
return a.childNodes[o] || null;
|
|
461
453
|
}
|
|
462
|
-
if (i.nodeType === Node.TEXT_NODE && (e === "previous" &&
|
|
454
|
+
if (i.nodeType === Node.TEXT_NODE && (e === "previous" && o < i.data.length || e === "next" && o > 0))
|
|
463
455
|
return null;
|
|
464
456
|
let r = i;
|
|
465
|
-
for (; r && r !==
|
|
457
|
+
for (; r && r !== n; ) {
|
|
466
458
|
const a = e === "previous" ? r.previousSibling : r.nextSibling;
|
|
467
459
|
if (a) return a;
|
|
468
460
|
r = r.parentNode;
|
|
469
461
|
}
|
|
470
462
|
return null;
|
|
471
463
|
}
|
|
472
|
-
function
|
|
464
|
+
function zt(t, n, e) {
|
|
473
465
|
if (!t.collapsed) return null;
|
|
474
|
-
const i = (a) => a instanceof HTMLElement && a.matches(
|
|
475
|
-
if (
|
|
476
|
-
const a =
|
|
466
|
+
const i = (a) => a instanceof HTMLElement && a.matches(it) ? a : null, { startContainer: o, startOffset: r } = t;
|
|
467
|
+
if (o.nodeType === Node.ELEMENT_NODE) {
|
|
468
|
+
const a = o;
|
|
477
469
|
return e === "Backspace" && r > 0 ? i(a.childNodes[r - 1] || null) : e === "Delete" ? i(a.childNodes[r] || null) : null;
|
|
478
470
|
}
|
|
479
|
-
if (
|
|
480
|
-
const a =
|
|
471
|
+
if (o.nodeType === Node.TEXT_NODE) {
|
|
472
|
+
const a = o;
|
|
481
473
|
if (e === "Backspace" && r === 0) {
|
|
482
474
|
const s = i(a.previousSibling);
|
|
483
|
-
return s || i(
|
|
475
|
+
return s || i(Z(t, n, "previous"));
|
|
484
476
|
}
|
|
485
477
|
if (e === "Delete" && r === a.data.length) {
|
|
486
478
|
const s = i(a.nextSibling);
|
|
487
|
-
return s || i(
|
|
479
|
+
return s || i(Z(t, n, "next"));
|
|
488
480
|
}
|
|
489
481
|
}
|
|
490
|
-
return i(e === "Backspace" ?
|
|
482
|
+
return i(e === "Backspace" ? Z(t, n, "previous") : Z(t, n, "next"));
|
|
491
483
|
}
|
|
492
|
-
function
|
|
493
|
-
const i = t.closest(
|
|
494
|
-
if (!i ||
|
|
495
|
-
const
|
|
496
|
-
if (!
|
|
497
|
-
const r = i.innerHTML, a = Array.from(
|
|
484
|
+
function D(t, n, e) {
|
|
485
|
+
const i = t.closest(S);
|
|
486
|
+
if (!i || j(t)) return !1;
|
|
487
|
+
const o = t.parentNode;
|
|
488
|
+
if (!o) return !1;
|
|
489
|
+
const r = i.innerHTML, a = Array.from(o.childNodes).indexOf(t);
|
|
498
490
|
if (a < 0) return !1;
|
|
499
491
|
const s = t.nextSibling;
|
|
500
|
-
return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(),
|
|
492
|
+
return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Lt(o, a), y(i, e, !0), bt(i, r), ft(i), n === "Delete" && i.focus({ preventScroll: !0 }), !0;
|
|
501
493
|
}
|
|
502
|
-
function
|
|
494
|
+
function Zt(t, n, e) {
|
|
503
495
|
if (t.key !== "Backspace" && t.key !== "Delete") return !1;
|
|
504
|
-
const i = t.key,
|
|
505
|
-
if (
|
|
506
|
-
return t.preventDefault(), t.stopPropagation(),
|
|
496
|
+
const i = t.key, o = t.target;
|
|
497
|
+
if (o != null && o.matches(it) && n.contains(o) && !j(o))
|
|
498
|
+
return t.preventDefault(), t.stopPropagation(), D(o, i, e);
|
|
507
499
|
const r = window.getSelection();
|
|
508
500
|
if (!r || r.rangeCount === 0) return !1;
|
|
509
501
|
const a = r.getRangeAt(0);
|
|
510
|
-
if (!
|
|
511
|
-
const s =
|
|
502
|
+
if (!n.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer)) return !1;
|
|
503
|
+
const s = Rt(a);
|
|
512
504
|
if (s)
|
|
513
|
-
return t.preventDefault(), t.stopPropagation(),
|
|
514
|
-
const d =
|
|
515
|
-
return d ? (t.preventDefault(), t.stopPropagation(),
|
|
505
|
+
return t.preventDefault(), t.stopPropagation(), D(s, i, e);
|
|
506
|
+
const d = zt(a, n, i);
|
|
507
|
+
return d ? (t.preventDefault(), t.stopPropagation(), D(d, i, e)) : !1;
|
|
516
508
|
}
|
|
517
|
-
function Nt(t,
|
|
518
|
-
const i =
|
|
509
|
+
function Nt(t, n, e) {
|
|
510
|
+
const i = _(e.normalizeText(n || ""));
|
|
519
511
|
if (!i) return !1;
|
|
520
|
-
const
|
|
521
|
-
if (
|
|
522
|
-
if (
|
|
523
|
-
return
|
|
512
|
+
const o = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
|
|
513
|
+
if (o.length === 0) return !1;
|
|
514
|
+
if (o.length === 1)
|
|
515
|
+
return D(o[0], "Delete", e);
|
|
524
516
|
const r = t.innerHTML;
|
|
525
|
-
return
|
|
517
|
+
return o.forEach((a) => {
|
|
526
518
|
const s = a.nextSibling;
|
|
527
519
|
s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), a.remove();
|
|
528
|
-
}),
|
|
520
|
+
}), Lt(t, t.childNodes.length), y(t, e, !0), bt(t, r), ft(t), t.focus({ preventScroll: !0 }), !0;
|
|
529
521
|
}
|
|
530
|
-
function
|
|
522
|
+
function Qt(t, n) {
|
|
531
523
|
const e = window.getSelection();
|
|
532
524
|
if (!e || e.rangeCount === 0) return !1;
|
|
533
525
|
const i = e.getRangeAt(0);
|
|
534
|
-
if (!t.contains(i.commonAncestorContainer) ||
|
|
535
|
-
const
|
|
536
|
-
if (
|
|
537
|
-
return
|
|
538
|
-
const r =
|
|
539
|
-
return r ?
|
|
540
|
-
}
|
|
541
|
-
function
|
|
526
|
+
if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer)) return !1;
|
|
527
|
+
const o = Rt(i);
|
|
528
|
+
if (o)
|
|
529
|
+
return D(o, "Delete", n);
|
|
530
|
+
const r = zt(i, t, "Backspace");
|
|
531
|
+
return r ? D(r, "Backspace", n) : !1;
|
|
532
|
+
}
|
|
533
|
+
function nt(t, n, e) {
|
|
542
534
|
var l, u;
|
|
543
|
-
const i =
|
|
535
|
+
const i = wt(n, e);
|
|
544
536
|
if (!i.author || !i.title) return !1;
|
|
545
|
-
i.id || (i.id =
|
|
546
|
-
const
|
|
537
|
+
i.id || (i.id = _t(t, e));
|
|
538
|
+
const o = t.innerHTML;
|
|
547
539
|
let r;
|
|
548
540
|
try {
|
|
549
|
-
r =
|
|
541
|
+
r = Jt(t);
|
|
550
542
|
} catch (b) {
|
|
551
543
|
return !1;
|
|
552
544
|
}
|
|
@@ -554,7 +546,7 @@ function et(t, o, e) {
|
|
|
554
546
|
if (!a) return !1;
|
|
555
547
|
r.collapsed || r.deleteContents();
|
|
556
548
|
const s = document.createElement("span");
|
|
557
|
-
|
|
549
|
+
St(s, i, z(t, e));
|
|
558
550
|
try {
|
|
559
551
|
r.insertNode(s);
|
|
560
552
|
} catch (b) {
|
|
@@ -568,71 +560,73 @@ function et(t, o, e) {
|
|
|
568
560
|
c.setStart(d.parentNode, Math.max(0, b));
|
|
569
561
|
} else
|
|
570
562
|
c.setStartAfter(s);
|
|
571
|
-
return c.collapse(!0), a.removeAllRanges(), a.addRange(c),
|
|
563
|
+
return c.collapse(!0), a.removeAllRanges(), a.addRange(c), Kt(t, i, e), y(t, e, !0), bt(t, o), ft(t), !0;
|
|
572
564
|
}
|
|
573
|
-
function
|
|
574
|
-
if (!
|
|
575
|
-
const e = R(t).find((r) => r.getAttribute("data-citation-id") ===
|
|
565
|
+
function te(t, n) {
|
|
566
|
+
if (!n) return !1;
|
|
567
|
+
const e = R(t).find((r) => r.getAttribute("data-citation-id") === n) || null;
|
|
576
568
|
if (!e) return !1;
|
|
577
569
|
e.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 });
|
|
578
570
|
const i = window.getSelection();
|
|
579
571
|
if (!i) return !0;
|
|
580
|
-
const
|
|
581
|
-
return
|
|
572
|
+
const o = document.createRange();
|
|
573
|
+
return o.selectNode(e), i.removeAllRanges(), i.addRange(o), !0;
|
|
582
574
|
}
|
|
583
|
-
function
|
|
584
|
-
return
|
|
575
|
+
function ot(t) {
|
|
576
|
+
return Y.get(t) === !0;
|
|
585
577
|
}
|
|
586
|
-
function
|
|
578
|
+
function W(t, n = !1) {
|
|
587
579
|
const e = v.get(t);
|
|
588
|
-
e && (e.classList.remove("show"),
|
|
580
|
+
e && (e.classList.remove("show"), Y.set(t, !1), rt(t, "toggleCitationsPanel", !1), n && t.focus({ preventScroll: !0 }));
|
|
589
581
|
}
|
|
590
|
-
function
|
|
591
|
-
v.forEach((
|
|
592
|
-
e !== t &&
|
|
582
|
+
function ee(t) {
|
|
583
|
+
v.forEach((n, e) => {
|
|
584
|
+
e !== t && W(e, !1);
|
|
593
585
|
});
|
|
594
586
|
}
|
|
595
|
-
function
|
|
596
|
-
if (!
|
|
597
|
-
const i =
|
|
598
|
-
|
|
587
|
+
function lt(t, n) {
|
|
588
|
+
if (!n.classList.contains("show")) return;
|
|
589
|
+
const i = ut(t).getBoundingClientRect(), o = Math.min(window.innerWidth - 20, 380), r = Math.max(10, window.innerWidth - o - 10), a = Math.min(Math.max(10, i.right - o), r), s = Math.max(10, Math.min(window.innerHeight - 10 - 260, i.top + 10));
|
|
590
|
+
n.style.width = `${o}px`, n.style.left = `${a}px`, n.style.top = `${s}px`, n.style.maxHeight = `${Math.max(260, window.innerHeight - 24)}px`;
|
|
599
591
|
}
|
|
600
|
-
function C(t,
|
|
601
|
-
return t.querySelector(`[data-field="${
|
|
592
|
+
function C(t, n) {
|
|
593
|
+
return t.querySelector(`[data-field="${n}"]`);
|
|
602
594
|
}
|
|
603
|
-
function
|
|
595
|
+
function ne(t) {
|
|
604
596
|
var s, d, c, l, u, b;
|
|
605
|
-
const
|
|
597
|
+
const n = ((s = C(t, "author")) == null ? void 0 : s.value) || "", e = ((d = C(t, "year")) == null ? void 0 : d.value) || "", i = ((c = C(t, "title")) == null ? void 0 : c.value) || "", o = ((l = C(t, "source")) == null ? void 0 : l.value) || "", r = ((u = C(t, "url")) == null ? void 0 : u.value) || "", a = ((b = C(t, "note")) == null ? void 0 : b.value) || "";
|
|
606
598
|
return {
|
|
607
|
-
author:
|
|
599
|
+
author: n,
|
|
608
600
|
year: e,
|
|
609
601
|
title: i,
|
|
610
|
-
source:
|
|
602
|
+
source: o,
|
|
611
603
|
url: r,
|
|
612
604
|
note: a
|
|
613
605
|
};
|
|
614
606
|
}
|
|
615
|
-
function E(t,
|
|
616
|
-
const
|
|
617
|
-
|
|
607
|
+
function E(t, n, e = !1) {
|
|
608
|
+
const i = t.querySelector(".rte-citations-live");
|
|
609
|
+
i && (i.textContent = n);
|
|
610
|
+
const o = t.querySelector(".rte-citations-status");
|
|
611
|
+
o && (o.textContent = n, o.classList.toggle("rte-citations-status-error", e));
|
|
618
612
|
}
|
|
619
|
-
function
|
|
620
|
-
const i = C(
|
|
621
|
-
i && (i.value =
|
|
613
|
+
function oe(t, n, e) {
|
|
614
|
+
const i = C(n, "style");
|
|
615
|
+
i && (i.value = z(t, e));
|
|
622
616
|
}
|
|
623
|
-
function
|
|
624
|
-
const i = L.includes(
|
|
617
|
+
function It(t, n, e) {
|
|
618
|
+
const i = L.includes(n) ? n : e.defaultStyle;
|
|
625
619
|
return T.set(t, i), y(t, e, !0), i;
|
|
626
620
|
}
|
|
627
|
-
function
|
|
628
|
-
const e =
|
|
629
|
-
return T.set(t,
|
|
621
|
+
function mt(t, n) {
|
|
622
|
+
const e = z(t, n), i = L.indexOf(e), o = L[(i + 1) % L.length];
|
|
623
|
+
return T.set(t, o), y(t, n, !0), o;
|
|
630
624
|
}
|
|
631
|
-
function
|
|
632
|
-
const
|
|
633
|
-
if (
|
|
634
|
-
const e = f.get(t) || M ||
|
|
635
|
-
|
|
625
|
+
function ie(t) {
|
|
626
|
+
const n = v.get(t);
|
|
627
|
+
if (n) return n;
|
|
628
|
+
const e = f.get(t) || M || Q(), i = `rte-citations-panel-${Dt++}`, o = document.createElement("section");
|
|
629
|
+
o.className = m, o.id = i, o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false"), o.setAttribute("aria-label", e.labels.panelAriaLabel), o.setAttribute("tabindex", "-1"), o.innerHTML = `
|
|
636
630
|
<header class="rte-citations-header">
|
|
637
631
|
<h2 class="rte-citations-title">${g(e.labels.panelTitle)}</h2>
|
|
638
632
|
<button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(e.labels.closeText)}">✕</button>
|
|
@@ -686,69 +680,70 @@ function oe(t) {
|
|
|
686
680
|
<ul class="rte-citations-recent-list" role="list"></ul>
|
|
687
681
|
</section>
|
|
688
682
|
|
|
683
|
+
<p class="rte-citations-status" aria-hidden="true"></p>
|
|
689
684
|
<p class="rte-citations-shortcut">Shortcut: Ctrl/Cmd + Alt + Shift + C</p>
|
|
690
685
|
<span class="rte-citations-live" aria-live="polite"></span>
|
|
691
686
|
</div>
|
|
692
|
-
`,
|
|
687
|
+
`, o.addEventListener("click", (a) => {
|
|
693
688
|
const s = a.target;
|
|
694
689
|
if (!s) return;
|
|
695
690
|
const d = s.closest("[data-action]");
|
|
696
691
|
if (!d) return;
|
|
697
692
|
const c = d.getAttribute("data-action") || "", l = f.get(t) || M || e;
|
|
698
693
|
if (f.set(t, l), c === "close") {
|
|
699
|
-
|
|
694
|
+
W(t, !0);
|
|
700
695
|
return;
|
|
701
696
|
}
|
|
702
697
|
if (c === "insert") {
|
|
703
|
-
if (
|
|
704
|
-
const u =
|
|
698
|
+
if ($(t)) return;
|
|
699
|
+
const u = ne(o);
|
|
705
700
|
if (!l.normalizeText(u.author) || !l.normalizeText(u.title)) {
|
|
706
|
-
E(
|
|
701
|
+
E(o, l.labels.invalidMessage, !0);
|
|
707
702
|
return;
|
|
708
703
|
}
|
|
709
|
-
if (!
|
|
710
|
-
E(
|
|
704
|
+
if (!nt(t, u, l)) {
|
|
705
|
+
E(o, l.labels.invalidMessage, !0);
|
|
711
706
|
return;
|
|
712
707
|
}
|
|
713
|
-
E(
|
|
714
|
-
const w = C(
|
|
708
|
+
E(o, "Citation inserted.");
|
|
709
|
+
const w = C(o, "title"), A = C(o, "note");
|
|
715
710
|
w && (w.value = ""), A && (A.value = "");
|
|
716
711
|
return;
|
|
717
712
|
}
|
|
718
713
|
if (c === "refresh") {
|
|
719
714
|
const u = y(t, l, !0);
|
|
720
|
-
E(
|
|
715
|
+
E(o, `Refreshed ${u.length} citation${u.length === 1 ? "" : "s"}.`);
|
|
721
716
|
return;
|
|
722
717
|
}
|
|
723
718
|
if (c === "cycle-style") {
|
|
724
|
-
const u =
|
|
725
|
-
|
|
719
|
+
const u = mt(t, l);
|
|
720
|
+
oe(t, o, l), E(o, `Style changed to ${u.toUpperCase()}.`);
|
|
726
721
|
return;
|
|
727
722
|
}
|
|
728
723
|
if (c === "insert-from-recent") {
|
|
729
|
-
if (
|
|
730
|
-
const u = d.getAttribute("data-citation-id") || "", b = $t(t, u,
|
|
724
|
+
if ($(t)) return;
|
|
725
|
+
const u = d.getAttribute("data-citation-id") || "", b = $t(t, u, U(t, l), l);
|
|
731
726
|
if (!b) return;
|
|
732
|
-
|
|
727
|
+
nt(t, b, l), E(o, `Inserted citation: ${b.title}.`);
|
|
733
728
|
return;
|
|
734
729
|
}
|
|
735
730
|
if (c === "delete-by-id") {
|
|
736
|
-
if (
|
|
731
|
+
if ($(t)) return;
|
|
737
732
|
const u = d.getAttribute("data-citation-id") || "";
|
|
738
733
|
if (Nt(t, u, l)) {
|
|
739
|
-
E(
|
|
734
|
+
E(o, "Citation deleted.");
|
|
740
735
|
return;
|
|
741
736
|
}
|
|
742
|
-
|
|
737
|
+
jt(t, u, l) && (F(t), E(o, "Removed from recent citations."));
|
|
743
738
|
}
|
|
744
|
-
}),
|
|
739
|
+
}), o.addEventListener("keydown", (a) => {
|
|
745
740
|
if (a.key === "Escape") {
|
|
746
|
-
a.preventDefault(),
|
|
741
|
+
a.preventDefault(), W(t, !0);
|
|
747
742
|
return;
|
|
748
743
|
}
|
|
749
744
|
const s = a.target;
|
|
750
745
|
if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp") return;
|
|
751
|
-
const d = Array.from(
|
|
746
|
+
const d = Array.from(o.querySelectorAll(".rte-citations-recent-btn"));
|
|
752
747
|
if (d.length === 0) return;
|
|
753
748
|
const c = d.indexOf(s);
|
|
754
749
|
if (c < 0) return;
|
|
@@ -756,84 +751,84 @@ function oe(t) {
|
|
|
756
751
|
const l = a.key === "ArrowDown" ? 1 : -1, u = (c + l + d.length) % d.length;
|
|
757
752
|
d[u].focus();
|
|
758
753
|
});
|
|
759
|
-
const r = C(
|
|
754
|
+
const r = C(o, "style");
|
|
760
755
|
return r == null || r.addEventListener("change", () => {
|
|
761
756
|
const a = f.get(t) || M || e, s = r.value;
|
|
762
|
-
|
|
763
|
-
}),
|
|
757
|
+
It(t, s, a), E(o, `Style changed to ${s.toUpperCase()}.`);
|
|
758
|
+
}), et(o, t), document.body.appendChild(o), v.set(t, o), Y.set(t, !1), F(t), o;
|
|
764
759
|
}
|
|
765
|
-
function
|
|
766
|
-
const
|
|
767
|
-
|
|
768
|
-
const e = C(
|
|
760
|
+
function I(t) {
|
|
761
|
+
const n = ie(t);
|
|
762
|
+
ee(t), n.classList.add("show"), Y.set(t, !0), rt(t, "toggleCitationsPanel", !0), et(n, t), lt(t, n), F(t);
|
|
763
|
+
const e = C(n, "author");
|
|
769
764
|
e == null || e.focus();
|
|
770
765
|
}
|
|
771
|
-
function
|
|
772
|
-
const e =
|
|
773
|
-
return (typeof
|
|
766
|
+
function Bt(t, n) {
|
|
767
|
+
const e = ot(t);
|
|
768
|
+
return (typeof n == "boolean" ? n : !e) ? I(t) : W(t, !1), !0;
|
|
774
769
|
}
|
|
775
|
-
function
|
|
770
|
+
function gt(t) {
|
|
776
771
|
return typeof t.key == "string" ? t.key.toLowerCase() : "";
|
|
777
772
|
}
|
|
778
|
-
function ie(t) {
|
|
779
|
-
const o = mt(t);
|
|
780
|
-
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "c";
|
|
781
|
-
}
|
|
782
773
|
function re(t) {
|
|
783
|
-
const
|
|
784
|
-
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey &&
|
|
774
|
+
const n = gt(t);
|
|
775
|
+
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "c";
|
|
785
776
|
}
|
|
786
777
|
function ae(t) {
|
|
787
|
-
const
|
|
788
|
-
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey &&
|
|
778
|
+
const n = gt(t);
|
|
779
|
+
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "b";
|
|
789
780
|
}
|
|
790
781
|
function se(t) {
|
|
791
|
-
|
|
792
|
-
|
|
782
|
+
const n = gt(t);
|
|
783
|
+
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "j";
|
|
784
|
+
}
|
|
785
|
+
function ce(t) {
|
|
786
|
+
M = t, B || (B = (n) => {
|
|
787
|
+
const e = n.target, i = e == null ? void 0 : e.closest(S);
|
|
793
788
|
if (!i) return;
|
|
794
789
|
p = i, f.has(i) || f.set(i, t), T.has(i) || T.set(i, t.defaultStyle);
|
|
795
|
-
const
|
|
796
|
-
|
|
797
|
-
}, document.addEventListener("focusin",
|
|
798
|
-
const e =
|
|
799
|
-
i && (p = i,
|
|
800
|
-
}, document.addEventListener("input",
|
|
801
|
-
if (
|
|
802
|
-
const e =
|
|
803
|
-
if (!
|
|
804
|
-
const r = f.get(
|
|
805
|
-
if (f.set(
|
|
806
|
-
|
|
790
|
+
const o = v.get(i);
|
|
791
|
+
o && (et(o, i), lt(i, o)), rt(i, "toggleCitationsPanel", ot(i));
|
|
792
|
+
}, document.addEventListener("focusin", B, !0)), O || (O = (n) => {
|
|
793
|
+
const e = n.target, i = e == null ? void 0 : e.closest(S);
|
|
794
|
+
i && (p = i, Mt(i));
|
|
795
|
+
}, document.addEventListener("input", O, !0)), P || (P = (n) => {
|
|
796
|
+
if (n.defaultPrevented) return;
|
|
797
|
+
const e = n.target, i = !!(e != null && e.closest(`.${m} input, .${m} textarea, .${m} select`)), o = h(void 0, !1);
|
|
798
|
+
if (!o || $(o)) return;
|
|
799
|
+
const r = f.get(o) || M || t;
|
|
800
|
+
if (f.set(o, r), p = o, n.key === "Escape" && ot(o)) {
|
|
801
|
+
n.preventDefault(), W(o, !0);
|
|
807
802
|
return;
|
|
808
803
|
}
|
|
809
|
-
if (!i && !
|
|
810
|
-
if (
|
|
811
|
-
|
|
804
|
+
if (!i && !Zt(n, o, r)) {
|
|
805
|
+
if (re(n)) {
|
|
806
|
+
n.preventDefault(), n.stopPropagation(), Bt(o);
|
|
812
807
|
return;
|
|
813
808
|
}
|
|
814
|
-
if (
|
|
815
|
-
|
|
809
|
+
if (ae(n)) {
|
|
810
|
+
n.preventDefault(), n.stopPropagation(), y(o, r, !0), I(o);
|
|
816
811
|
return;
|
|
817
812
|
}
|
|
818
|
-
|
|
813
|
+
se(n) && (n.preventDefault(), n.stopPropagation(), mt(o, r));
|
|
819
814
|
}
|
|
820
|
-
}, document.addEventListener("keydown",
|
|
821
|
-
v.forEach((
|
|
822
|
-
if (!e.isConnected || !
|
|
823
|
-
|
|
815
|
+
}, document.addEventListener("keydown", P, !0)), k || (k = () => {
|
|
816
|
+
v.forEach((n, e) => {
|
|
817
|
+
if (!e.isConnected || !n.isConnected) {
|
|
818
|
+
Tt(e), n.remove(), v.delete(e), Y.delete(e);
|
|
824
819
|
return;
|
|
825
820
|
}
|
|
826
|
-
|
|
821
|
+
et(n, e), lt(e, n);
|
|
827
822
|
});
|
|
828
823
|
}, window.addEventListener("scroll", k, !0), window.addEventListener("resize", k));
|
|
829
824
|
}
|
|
830
|
-
function ce() {
|
|
831
|
-
I && (document.removeEventListener("focusin", I, !0), I = null), B && (document.removeEventListener("input", B, !0), B = null), O && (document.removeEventListener("keydown", O, !0), O = null), k && (window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k), k = null), v.forEach((t) => t.remove()), v.clear(), M = null, p = null;
|
|
832
|
-
}
|
|
833
825
|
function le() {
|
|
834
|
-
|
|
826
|
+
B && (document.removeEventListener("focusin", B, !0), B = null), O && (document.removeEventListener("input", O, !0), O = null), P && (document.removeEventListener("keydown", P, !0), P = null), k && (window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k), k = null), v.forEach((t) => t.remove()), v.clear(), M = null, p = null;
|
|
827
|
+
}
|
|
828
|
+
function ue() {
|
|
829
|
+
if (typeof document == "undefined" || document.getElementById(ht)) return;
|
|
835
830
|
const t = document.createElement("style");
|
|
836
|
-
t.id =
|
|
831
|
+
t.id = ht, t.textContent = `
|
|
837
832
|
.rte-toolbar-group-items.citations,
|
|
838
833
|
.editora-toolbar-group-items.citations {
|
|
839
834
|
display: flex;
|
|
@@ -1199,6 +1194,30 @@ function le() {
|
|
|
1199
1194
|
color: #94a3b8;
|
|
1200
1195
|
}
|
|
1201
1196
|
|
|
1197
|
+
.rte-citations-status {
|
|
1198
|
+
margin: 0;
|
|
1199
|
+
min-height: 16px;
|
|
1200
|
+
font-size: 12px;
|
|
1201
|
+
font-weight: 600;
|
|
1202
|
+
color: #166534;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
.rte-citations-status:empty {
|
|
1206
|
+
display: none;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
.rte-citations-status.rte-citations-status-error {
|
|
1210
|
+
color: #b91c1c;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
.${m}.rte-citations-theme-dark .rte-citations-status {
|
|
1214
|
+
color: #86efac;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
.${m}.rte-citations-theme-dark .rte-citations-status.rte-citations-status-error {
|
|
1218
|
+
color: #fca5a5;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1202
1221
|
.rte-citations-live {
|
|
1203
1222
|
position: absolute;
|
|
1204
1223
|
width: 1px;
|
|
@@ -1303,9 +1322,9 @@ function le() {
|
|
|
1303
1322
|
}
|
|
1304
1323
|
`, document.head.appendChild(t);
|
|
1305
1324
|
}
|
|
1306
|
-
const
|
|
1307
|
-
const
|
|
1308
|
-
return
|
|
1325
|
+
const de = (t = {}) => {
|
|
1326
|
+
const n = Q(t);
|
|
1327
|
+
return ue(), {
|
|
1309
1328
|
name: "citations",
|
|
1310
1329
|
toolbar: [
|
|
1311
1330
|
{
|
|
@@ -1340,68 +1359,68 @@ const ue = (t = {}) => {
|
|
|
1340
1359
|
],
|
|
1341
1360
|
commands: {
|
|
1342
1361
|
citations: (e, i) => {
|
|
1343
|
-
const
|
|
1344
|
-
if (!
|
|
1345
|
-
const r = f.get(
|
|
1346
|
-
return f.set(
|
|
1362
|
+
const o = h(i);
|
|
1363
|
+
if (!o || $(o)) return !1;
|
|
1364
|
+
const r = f.get(o) || n;
|
|
1365
|
+
return f.set(o, r), T.set(o, z(o, r)), p = o, I(o), y(o, r, !1), !0;
|
|
1347
1366
|
},
|
|
1348
1367
|
toggleCitationsPanel: (e, i) => {
|
|
1349
|
-
const
|
|
1350
|
-
if (!
|
|
1351
|
-
const r = f.get(
|
|
1352
|
-
f.set(
|
|
1353
|
-
const a =
|
|
1354
|
-
return
|
|
1368
|
+
const o = h(i);
|
|
1369
|
+
if (!o || $(o)) return !1;
|
|
1370
|
+
const r = f.get(o) || n;
|
|
1371
|
+
f.set(o, r), p = o;
|
|
1372
|
+
const a = Bt(o, typeof e == "boolean" ? e : void 0);
|
|
1373
|
+
return ot(o) && y(o, r, !1), a;
|
|
1355
1374
|
},
|
|
1356
1375
|
insertCitation: (e, i) => {
|
|
1357
|
-
const
|
|
1358
|
-
if (!
|
|
1359
|
-
const r = f.get(
|
|
1360
|
-
f.set(
|
|
1361
|
-
const a =
|
|
1362
|
-
return a &&
|
|
1376
|
+
const o = h(i);
|
|
1377
|
+
if (!o || $(o) || !e || typeof e != "object") return !1;
|
|
1378
|
+
const r = f.get(o) || n;
|
|
1379
|
+
f.set(o, r), p = o;
|
|
1380
|
+
const a = nt(o, e, r);
|
|
1381
|
+
return a && I(o), a;
|
|
1363
1382
|
},
|
|
1364
1383
|
refreshCitations: (e, i) => {
|
|
1365
|
-
const
|
|
1366
|
-
if (!
|
|
1367
|
-
const r = f.get(
|
|
1368
|
-
return f.set(
|
|
1384
|
+
const o = h(i);
|
|
1385
|
+
if (!o) return !1;
|
|
1386
|
+
const r = f.get(o) || n;
|
|
1387
|
+
return f.set(o, r), p = o, y(o, r, !0), I(o), !0;
|
|
1369
1388
|
},
|
|
1370
1389
|
setCitationStyle: (e, i) => {
|
|
1371
|
-
const
|
|
1372
|
-
if (!
|
|
1373
|
-
const r = f.get(
|
|
1374
|
-
return f.set(
|
|
1390
|
+
const o = h(i);
|
|
1391
|
+
if (!o || !e) return !1;
|
|
1392
|
+
const r = f.get(o) || n;
|
|
1393
|
+
return f.set(o, r), p = o, It(o, e, r), !0;
|
|
1375
1394
|
},
|
|
1376
1395
|
cycleCitationStyle: (e, i) => {
|
|
1377
|
-
const
|
|
1378
|
-
if (!
|
|
1379
|
-
const r = f.get(
|
|
1380
|
-
return f.set(
|
|
1396
|
+
const o = h(i);
|
|
1397
|
+
if (!o) return !1;
|
|
1398
|
+
const r = f.get(o) || n;
|
|
1399
|
+
return f.set(o, r), p = o, mt(o, r), F(o), !0;
|
|
1381
1400
|
},
|
|
1382
1401
|
getCitationRecords: (e, i) => {
|
|
1383
|
-
const
|
|
1384
|
-
if (!
|
|
1385
|
-
const r = f.get(
|
|
1402
|
+
const o = h(i);
|
|
1403
|
+
if (!o) return !1;
|
|
1404
|
+
const r = f.get(o) || n, a = U(o, r);
|
|
1386
1405
|
if (typeof e == "function")
|
|
1387
1406
|
try {
|
|
1388
1407
|
e(a);
|
|
1389
1408
|
} catch (s) {
|
|
1390
1409
|
}
|
|
1391
|
-
return
|
|
1410
|
+
return o.__citationRecords = a, o.dispatchEvent(
|
|
1392
1411
|
new CustomEvent("editora:citations-data", {
|
|
1393
1412
|
bubbles: !0,
|
|
1394
1413
|
detail: {
|
|
1395
1414
|
records: a,
|
|
1396
|
-
style:
|
|
1415
|
+
style: z(o, r)
|
|
1397
1416
|
}
|
|
1398
1417
|
})
|
|
1399
1418
|
), !0;
|
|
1400
1419
|
},
|
|
1401
1420
|
setCitationsOptions: (e, i) => {
|
|
1402
|
-
const
|
|
1403
|
-
if (!
|
|
1404
|
-
const r = f.get(
|
|
1421
|
+
const o = h(i);
|
|
1422
|
+
if (!o || !e || typeof e != "object") return !1;
|
|
1423
|
+
const r = f.get(o) || n, a = Q({
|
|
1405
1424
|
...r,
|
|
1406
1425
|
...e,
|
|
1407
1426
|
labels: {
|
|
@@ -1411,29 +1430,29 @@ const ue = (t = {}) => {
|
|
|
1411
1430
|
normalizeText: e.normalizeText || r.normalizeText,
|
|
1412
1431
|
generateCitationId: e.generateCitationId || r.generateCitationId
|
|
1413
1432
|
});
|
|
1414
|
-
return f.set(
|
|
1433
|
+
return f.set(o, a), e.defaultStyle && L.includes(e.defaultStyle) && T.set(o, e.defaultStyle), y(o, a, !0), F(o), !0;
|
|
1415
1434
|
},
|
|
1416
1435
|
locateCitation: (e, i) => {
|
|
1417
|
-
const
|
|
1418
|
-
return !
|
|
1436
|
+
const o = h(i);
|
|
1437
|
+
return !o || typeof e != "string" ? !1 : te(o, e);
|
|
1419
1438
|
},
|
|
1420
1439
|
deleteCitation: (e, i) => {
|
|
1421
|
-
const
|
|
1422
|
-
if (!
|
|
1423
|
-
const r = f.get(
|
|
1424
|
-
return f.set(
|
|
1440
|
+
const o = h(i);
|
|
1441
|
+
if (!o || $(o)) return !1;
|
|
1442
|
+
const r = f.get(o) || n;
|
|
1443
|
+
return f.set(o, r), typeof e == "string" && e.trim() ? Nt(o, e, r) : Qt(o, r);
|
|
1425
1444
|
},
|
|
1426
1445
|
insertRecentCitation: (e, i) => {
|
|
1427
|
-
const
|
|
1428
|
-
if (!
|
|
1429
|
-
const r = f.get(
|
|
1430
|
-
f.set(
|
|
1431
|
-
const a =
|
|
1446
|
+
const o = h(i);
|
|
1447
|
+
if (!o || $(o)) return !1;
|
|
1448
|
+
const r = f.get(o) || n;
|
|
1449
|
+
f.set(o, r);
|
|
1450
|
+
const a = U(o, r), s = at(o, a, r);
|
|
1432
1451
|
if (s.length === 0) return !1;
|
|
1433
|
-
const d = typeof e == "string" && e.trim() ? $t(
|
|
1452
|
+
const d = typeof e == "string" && e.trim() ? $t(o, e, a, r) : s[0];
|
|
1434
1453
|
if (!d) return !1;
|
|
1435
|
-
const c =
|
|
1436
|
-
return c &&
|
|
1454
|
+
const c = nt(o, d, r);
|
|
1455
|
+
return c && I(o), c;
|
|
1437
1456
|
}
|
|
1438
1457
|
},
|
|
1439
1458
|
keymap: {
|
|
@@ -1445,23 +1464,23 @@ const ue = (t = {}) => {
|
|
|
1445
1464
|
"Mod-Alt-Shift-J": "cycleCitationStyle"
|
|
1446
1465
|
},
|
|
1447
1466
|
init: function(i) {
|
|
1448
|
-
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1467
|
+
X += 1;
|
|
1468
|
+
const o = this && typeof this.__pluginConfig == "object" ? Q({ ...n, ...this.__pluginConfig }) : n;
|
|
1469
|
+
ce(o);
|
|
1451
1470
|
const r = h(
|
|
1452
1471
|
i && i.editorElement ? { editorElement: i.editorElement } : void 0,
|
|
1453
1472
|
!1
|
|
1454
1473
|
);
|
|
1455
|
-
r && (p = r, f.set(r,
|
|
1474
|
+
r && (p = r, f.set(r, o), T.set(r, o.defaultStyle), rt(r, "toggleCitationsPanel", !1), Mt(r));
|
|
1456
1475
|
},
|
|
1457
1476
|
destroy: () => {
|
|
1458
|
-
|
|
1477
|
+
X = Math.max(0, X - 1), !(X > 0) && (K.forEach((e) => {
|
|
1459
1478
|
window.clearTimeout(e);
|
|
1460
|
-
}),
|
|
1479
|
+
}), K.clear(), le());
|
|
1461
1480
|
}
|
|
1462
1481
|
};
|
|
1463
1482
|
};
|
|
1464
1483
|
export {
|
|
1465
|
-
|
|
1484
|
+
de as CitationsPlugin
|
|
1466
1485
|
};
|
|
1467
|
-
//# sourceMappingURL=CitationsPlugin.native-
|
|
1486
|
+
//# sourceMappingURL=CitationsPlugin.native-C_7wWQ-k.mjs.map
|