@editora/plugins 1.0.16 → 1.0.18
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/CodePlugin.native-Bwf25lLX.js +460 -0
- package/dist/CodePlugin.native-Cpp4u3Jl.mjs +648 -0
- package/dist/a11y-checker.cjs.js +16 -16
- package/dist/a11y-checker.esm.js +79 -75
- package/dist/anchor.cjs.js +9 -9
- package/dist/anchor.esm.js +61 -60
- package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
- package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
- package/dist/approval-workflow.cjs.js +5 -5
- package/dist/approval-workflow.esm.js +105 -104
- package/dist/background-color.cjs.js +1 -1
- package/dist/background-color.esm.js +1 -1
- package/dist/blocks-library.cjs.js +6 -6
- package/dist/blocks-library.esm.js +226 -202
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +9 -4
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +154 -116
- package/dist/citations.cjs.js +43 -18
- package/dist/citations.esm.js +465 -446
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +21 -20
- package/dist/code-sample.cjs.js +85 -66
- package/dist/code-sample.esm.js +301 -190
- package/dist/code.cjs.js +1 -669
- package/dist/code.esm.js +2 -4560
- package/dist/collaboration.cjs.js +68 -0
- package/dist/collaboration.esm.js +7428 -0
- package/dist/comments.cjs.js +11 -11
- package/dist/comments.esm.js +284 -237
- package/dist/conditional-content.cjs.js +67 -60
- package/dist/conditional-content.esm.js +270 -220
- package/dist/data-binding.cjs.js +3 -3
- package/dist/data-binding.esm.js +28 -27
- package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
- package/dist/dialogHelpers-zU6zpMIA.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-Jf0RbSks.js → documentManager-BDz6tovy.js} +2 -2
- package/dist/{documentManager-CTqRftU8.mjs → documentManager-yjRBab4v.mjs} +3 -3
- package/dist/embed-iframe.cjs.js +37 -17
- package/dist/embed-iframe.esm.js +188 -143
- package/dist/emojis.cjs.js +13 -10
- package/dist/emojis.esm.js +288 -76
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +9 -7
- package/dist/escapeHtml-D2Zh82pD.js +1 -0
- package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +48 -41
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +67 -60
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +2 -1
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +40 -36
- package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
- package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
- package/dist/index-Bm1eqYHh.mjs +194 -0
- package/dist/index-CoflqYuK.js +30 -0
- package/dist/index-CxhJLMPS.js +221 -0
- package/dist/{index-D3CycEFU.mjs → index-Di1ZqIDs.mjs} +6420 -6232
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-DQ78mYYo.mjs → index.es-B7pVaNEV.mjs} +1558 -1542
- package/dist/{index.es-CE_A4QSm.js → index.es-I9N4o4Iq.js} +5 -5
- package/dist/index.esm.js +17 -15
- package/dist/{jspdf.es.min-BoS80556.js → jspdf.es.min-B5Idu0Wl.js} +2 -2
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-BCzHIwvz.mjs} +3 -2
- package/dist/link.cjs.js +17 -13
- package/dist/link.esm.js +138 -69
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +66 -33
- package/dist/math.cjs.js +22 -22
- package/dist/math.esm.js +221 -126
- package/dist/media-manager.cjs.js +12 -12
- package/dist/media-manager.esm.js +55 -50
- package/dist/mentions.cjs.js +2 -2
- package/dist/mentions.esm.js +17 -12
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +43 -42
- package/dist/plugins.css +1 -1
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +30 -27
- package/dist/{purify.es-T2a3nLiC.js → purify.es-DWpzYfqy.js} +1 -1
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-Dewe88eZ.mjs} +2 -2
- package/dist/slash-commands.cjs.js +13 -7
- package/dist/slash-commands.esm.js +90 -79
- package/dist/smart-paste.cjs.js +5 -5
- package/dist/smart-paste.esm.js +85 -81
- package/dist/special-characters.cjs.js +6 -3
- package/dist/special-characters.esm.js +72 -25
- package/dist/spell-check.cjs.js +8 -8
- package/dist/spell-check.esm.js +10189 -295
- package/dist/table.cjs.js +166 -13
- package/dist/table.esm.js +543 -266
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +290 -264
- package/dist/text-color.cjs.js +1 -1
- package/dist/text-color.esm.js +1 -1
- package/dist/translation-workflow.cjs.js +4 -4
- package/dist/translation-workflow.esm.js +33 -31
- package/dist/version-diff.cjs.js +6 -6
- package/dist/version-diff.esm.js +40 -40
- package/package.json +10 -4
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/index-BFsKNTTj.mjs +0 -145
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-tqLTHcO6.js +0 -1
package/dist/citations.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const S = ".rte-content, .editora-content",
|
|
1
|
+
const S = ".rte-content, .editora-content", ht = "rte-citations-styles", b = "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,41 +19,41 @@ const S = ".rte-content, .editora-content", pt = "rte-citations-styles", b = "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 xt(t, e) {
|
|
31
|
-
const n = e(t);
|
|
32
|
-
if (!n) return "";
|
|
33
|
-
const i = n.match(/\d{4}/);
|
|
34
|
-
return i ? i[0] : n;
|
|
35
|
-
}
|
|
36
30
|
function yt(t, e) {
|
|
37
|
-
const
|
|
38
|
-
|
|
31
|
+
const o = e(t);
|
|
32
|
+
if (!o) return "";
|
|
33
|
+
const i = o.match(/\d{4}/);
|
|
34
|
+
return i ? i[0] : o;
|
|
39
35
|
}
|
|
40
|
-
function
|
|
36
|
+
function Ct(t, e) {
|
|
37
|
+
const o = e(t);
|
|
38
|
+
return o ? /^https?:\/\//i.test(o) ? o : `https://${o}` : "";
|
|
39
|
+
}
|
|
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, e) {
|
|
44
44
|
return {
|
|
45
|
-
id:
|
|
45
|
+
id: _(e.normalizeText(t.id || "")),
|
|
46
46
|
author: e.normalizeText(t.author || ""),
|
|
47
|
-
year:
|
|
47
|
+
year: yt(t.year || "", e.normalizeText) || void 0,
|
|
48
48
|
title: e.normalizeText(t.title || ""),
|
|
49
49
|
source: e.normalizeText(t.source || "") || void 0,
|
|
50
|
-
url:
|
|
50
|
+
url: Ct(t.url || "", e.normalizeText) || void 0,
|
|
51
51
|
note: e.normalizeText(t.note || "") || void 0
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
const e = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa",
|
|
56
|
-
...
|
|
54
|
+
function Q(t = {}) {
|
|
55
|
+
const e = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", o = {
|
|
56
|
+
...Pt,
|
|
57
57
|
...t.labels || {}
|
|
58
58
|
};
|
|
59
59
|
return {
|
|
@@ -61,133 +61,125 @@ function Z(t = {}) {
|
|
|
61
61
|
enableFootnoteSync: t.enableFootnoteSync !== !1,
|
|
62
62
|
debounceMs: Math.max(80, Number(t.debounceMs ?? 220)),
|
|
63
63
|
maxRecentCitations: Math.max(3, Math.min(30, Number(t.maxRecentCitations ?? 8))),
|
|
64
|
-
labels:
|
|
65
|
-
normalizeText: t.normalizeText ||
|
|
64
|
+
labels: o,
|
|
65
|
+
normalizeText: t.normalizeText || Ht,
|
|
66
66
|
generateCitationId: typeof t.generateCitationId == "function" ? t.generateCitationId : void 0
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function vt(t) {
|
|
70
70
|
return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function ut(t) {
|
|
73
73
|
return t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || t;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function J(t) {
|
|
76
76
|
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;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
const e =
|
|
80
|
-
if (
|
|
81
|
-
const
|
|
82
|
-
return
|
|
78
|
+
function Ft(t) {
|
|
79
|
+
const e = ut(t);
|
|
80
|
+
if (J(e)) return !0;
|
|
81
|
+
const o = e.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
82
|
+
return J(o) ? !0 : J(document.documentElement) || J(document.body);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
t.classList.remove("rte-citations-theme-dark"),
|
|
84
|
+
function et(t, e) {
|
|
85
|
+
t.classList.remove("rte-citations-theme-dark"), Ft(e) && t.classList.add("rte-citations-theme-dark");
|
|
86
86
|
}
|
|
87
87
|
function h(t, e = !0) {
|
|
88
88
|
if (t?.contentElement instanceof HTMLElement) return t.contentElement;
|
|
89
89
|
if (t?.editorElement instanceof HTMLElement) {
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
const r =
|
|
90
|
+
const n = t.editorElement;
|
|
91
|
+
if (n.matches(S)) return n;
|
|
92
|
+
const r = n.querySelector(S);
|
|
93
93
|
if (r instanceof HTMLElement) return r;
|
|
94
94
|
}
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
const
|
|
95
|
+
const o = window.getSelection();
|
|
96
|
+
if (o && o.rangeCount > 0) {
|
|
97
|
+
const n = o.getRangeAt(0).startContainer, a = vt(n)?.closest(S);
|
|
98
98
|
if (a) return a;
|
|
99
99
|
}
|
|
100
100
|
const i = document.activeElement;
|
|
101
101
|
if (i) {
|
|
102
102
|
if (i.matches(S)) return i;
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
103
|
+
const n = i.closest(S);
|
|
104
|
+
if (n) return n;
|
|
105
105
|
}
|
|
106
106
|
return p && p.isConnected ? p : (p && !p.isConnected && (p = null), e ? document.querySelector(S) : null);
|
|
107
107
|
}
|
|
108
108
|
function $(t) {
|
|
109
109
|
return t.getAttribute("contenteditable") === "false" || t.getAttribute("data-readonly") === "true";
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
const e =
|
|
113
|
-
return e ? !!(e.closest(
|
|
111
|
+
function j(t) {
|
|
112
|
+
const e = vt(t);
|
|
113
|
+
return e ? !!(e.closest(G) || e.closest(V)) : !1;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
115
|
+
function _t(t, e) {
|
|
116
|
+
if (st += 1, e.generateCitationId) {
|
|
117
|
+
const o = e.generateCitationId({ editor: t, index: st }), i = _(e.normalizeText(o || ""));
|
|
118
118
|
if (i) return i;
|
|
119
119
|
}
|
|
120
|
-
return `cite-${Date.now().toString(36)}-${
|
|
120
|
+
return `cite-${Date.now().toString(36)}-${st.toString(36)}`;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function ct(t) {
|
|
123
123
|
return t.map((e) => (e || "").trim()).filter(Boolean).join(" ").trim();
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
const
|
|
127
|
-
return e === "mla" ? `(${
|
|
128
|
-
}
|
|
129
|
-
function
|
|
130
|
-
const
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
function qt(t, e) {
|
|
126
|
+
const o = t.author || "Unknown", i = t.year || "n.d.";
|
|
127
|
+
return e === "mla" ? `(${o} ${i})` : e === "chicago" ? `(${o} ${i})` : `(${o}, ${i})`;
|
|
128
|
+
}
|
|
129
|
+
function N(t) {
|
|
130
|
+
const e = t.trim();
|
|
131
|
+
return !e || /[.!?]$/.test(e) ? e : `${e}.`;
|
|
132
|
+
}
|
|
133
|
+
function dt(t, e) {
|
|
134
|
+
const o = N(t.author || "Unknown"), i = t.year || "n.d.", n = t.title || "Untitled", r = (t.source || "").trim(), a = t.url || "";
|
|
135
|
+
return ct(e === "mla" ? [
|
|
136
|
+
o,
|
|
137
|
+
`"${N(n)}"`,
|
|
138
|
+
r ? `${r.replace(/[.,]$/, "")},` : "",
|
|
135
139
|
`${i}.`,
|
|
136
140
|
a
|
|
137
|
-
] : e === "chicago" ? [
|
|
138
|
-
`${n}.`,
|
|
139
|
-
`${o}.`,
|
|
140
|
-
r ? `${r}.` : "",
|
|
141
|
-
`(${i}).`,
|
|
142
|
-
a
|
|
143
|
-
] : [
|
|
144
|
-
`${n}.`,
|
|
145
|
-
`(${i}).`,
|
|
146
|
-
`${o}.`,
|
|
147
|
-
r ? `${r}.` : "",
|
|
148
|
-
a
|
|
149
|
-
]);
|
|
141
|
+
] : e === "chicago" ? [o, N(n), N(r), `(${i}).`, a] : [o, `(${i}).`, N(n), N(r), a]);
|
|
150
142
|
}
|
|
151
143
|
function R(t) {
|
|
152
|
-
return Array.from(t.querySelectorAll(
|
|
153
|
-
(e) => !e.closest(
|
|
144
|
+
return Array.from(t.querySelectorAll(it)).filter(
|
|
145
|
+
(e) => !e.closest(G) && !e.closest(V)
|
|
154
146
|
);
|
|
155
147
|
}
|
|
156
|
-
function
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
159
|
-
const i = e.normalizeText(t.getAttribute("data-citation-author") || ""),
|
|
148
|
+
function Et(t, e) {
|
|
149
|
+
const o = _(e.normalizeText(t.getAttribute("data-citation-id") || ""));
|
|
150
|
+
if (!o) return null;
|
|
151
|
+
const i = e.normalizeText(t.getAttribute("data-citation-author") || ""), n = e.normalizeText(t.getAttribute("data-citation-title") || "");
|
|
160
152
|
return {
|
|
161
|
-
id:
|
|
153
|
+
id: o,
|
|
162
154
|
author: i || "Unknown",
|
|
163
|
-
year:
|
|
164
|
-
title:
|
|
155
|
+
year: yt(t.getAttribute("data-citation-year") || "", e.normalizeText) || void 0,
|
|
156
|
+
title: n || "Untitled",
|
|
165
157
|
source: e.normalizeText(t.getAttribute("data-citation-source") || "") || void 0,
|
|
166
|
-
url:
|
|
158
|
+
url: Ct(t.getAttribute("data-citation-url") || "", e.normalizeText) || void 0,
|
|
167
159
|
note: e.normalizeText(t.getAttribute("data-citation-note") || "") || void 0
|
|
168
160
|
};
|
|
169
161
|
}
|
|
170
|
-
function
|
|
171
|
-
t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", e.id), t.setAttribute("data-citation-author", e.author || ""), t.setAttribute("data-citation-year", e.year || ""), t.setAttribute("data-citation-title", e.title || ""), t.setAttribute("data-citation-source", e.source || ""), t.setAttribute("data-citation-url", e.url || ""), t.setAttribute("data-citation-note", e.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style",
|
|
162
|
+
function St(t, e, o) {
|
|
163
|
+
t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", e.id), t.setAttribute("data-citation-author", e.author || ""), t.setAttribute("data-citation-year", e.year || ""), t.setAttribute("data-citation-title", e.title || ""), t.setAttribute("data-citation-source", e.source || ""), t.setAttribute("data-citation-url", e.url || ""), t.setAttribute("data-citation-note", e.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", o), t.textContent = qt(e, o);
|
|
172
164
|
}
|
|
173
|
-
function
|
|
174
|
-
const i =
|
|
165
|
+
function rt(t, e, o) {
|
|
166
|
+
const i = ut(t);
|
|
175
167
|
Array.from(
|
|
176
168
|
i.querySelectorAll(
|
|
177
169
|
`.rte-toolbar-button[data-command="${e}"], .editora-toolbar-button[data-command="${e}"]`
|
|
178
170
|
)
|
|
179
171
|
).forEach((r) => {
|
|
180
|
-
r.classList.toggle("active",
|
|
172
|
+
r.classList.toggle("active", o), r.setAttribute("data-active", o ? "true" : "false"), r.setAttribute("aria-pressed", o ? "true" : "false");
|
|
181
173
|
});
|
|
182
174
|
}
|
|
183
|
-
function
|
|
184
|
-
const
|
|
185
|
-
return
|
|
175
|
+
function z(t, e) {
|
|
176
|
+
const o = T.get(t);
|
|
177
|
+
return o && L.includes(o) ? o : e?.defaultStyle || "apa";
|
|
186
178
|
}
|
|
187
|
-
function
|
|
188
|
-
const
|
|
189
|
-
return
|
|
190
|
-
const r =
|
|
179
|
+
function U(t, e) {
|
|
180
|
+
const o = R(t), i = /* @__PURE__ */ new Map();
|
|
181
|
+
return o.forEach((n) => {
|
|
182
|
+
const r = Et(n, e);
|
|
191
183
|
if (!r) return;
|
|
192
184
|
if (!i.has(r.id)) {
|
|
193
185
|
i.set(r.id, r);
|
|
@@ -205,76 +197,76 @@ function j(t, e) {
|
|
|
205
197
|
});
|
|
206
198
|
}), Array.from(i.values());
|
|
207
199
|
}
|
|
208
|
-
function
|
|
209
|
-
const i =
|
|
200
|
+
function Kt(t, e, o) {
|
|
201
|
+
const i = wt(e, o);
|
|
210
202
|
if (!i.id || !i.author || !i.title) return;
|
|
211
|
-
const r = (
|
|
212
|
-
|
|
203
|
+
const r = (H.get(t) || []).filter((a) => a.id !== i.id);
|
|
204
|
+
H.set(t, [i, ...r].slice(0, o.maxRecentCitations));
|
|
213
205
|
}
|
|
214
|
-
function
|
|
215
|
-
const i =
|
|
216
|
-
e.slice(Math.max(0, e.length -
|
|
217
|
-
a.id &&
|
|
206
|
+
function at(t, e, o) {
|
|
207
|
+
const i = H.get(t) || [], n = /* @__PURE__ */ new Map();
|
|
208
|
+
e.slice(Math.max(0, e.length - o.maxRecentCitations)).reverse().forEach((a) => {
|
|
209
|
+
a.id && n.set(a.id, a);
|
|
218
210
|
}), i.forEach((a) => {
|
|
219
|
-
!a.id ||
|
|
211
|
+
!a.id || n.has(a.id) || n.set(a.id, a);
|
|
220
212
|
});
|
|
221
|
-
const r = Array.from(
|
|
222
|
-
return
|
|
213
|
+
const r = Array.from(n.values()).slice(0, o.maxRecentCitations);
|
|
214
|
+
return H.set(t, r), r;
|
|
223
215
|
}
|
|
224
|
-
function
|
|
225
|
-
const
|
|
226
|
-
return
|
|
216
|
+
function $t(t, e, o, i) {
|
|
217
|
+
const n = _(i.normalizeText(e || ""));
|
|
218
|
+
return n && at(t, o, i).find((a) => a.id === n) || null;
|
|
227
219
|
}
|
|
228
|
-
function
|
|
229
|
-
const i =
|
|
220
|
+
function jt(t, e, o) {
|
|
221
|
+
const i = _(o.normalizeText(e || ""));
|
|
230
222
|
if (!i) return !1;
|
|
231
|
-
const
|
|
232
|
-
return r.length ===
|
|
223
|
+
const n = H.get(t) || [], r = n.filter((a) => a.id !== i);
|
|
224
|
+
return r.length === n.length ? !1 : (H.set(t, r), !0);
|
|
233
225
|
}
|
|
234
|
-
function
|
|
226
|
+
function At(t, e, o) {
|
|
235
227
|
const i = document.createElement("section");
|
|
236
|
-
i.className = t, i.setAttribute("data-type", e), i.setAttribute("contenteditable", "false"), i.setAttribute("aria-label",
|
|
237
|
-
const
|
|
238
|
-
|
|
228
|
+
i.className = t, i.setAttribute("data-type", e), i.setAttribute("contenteditable", "false"), i.setAttribute("aria-label", o), e === "citation-bibliography" ? i.setAttribute("role", "doc-bibliography") : e === "citation-footnotes" && i.setAttribute("role", "doc-endnotes");
|
|
229
|
+
const n = document.createElement("h3");
|
|
230
|
+
n.className = "rte-citation-section-title", n.textContent = o;
|
|
239
231
|
const r = document.createElement("ol");
|
|
240
|
-
return r.className = "rte-citation-list", r.setAttribute("role", "list"), i.appendChild(
|
|
241
|
-
}
|
|
242
|
-
function jt(t, e) {
|
|
243
|
-
let n = t.querySelector(W);
|
|
244
|
-
n || (n = $t("rte-citation-bibliography", "citation-bibliography", e.labels.bibliographyTitle), t.appendChild(n));
|
|
245
|
-
const i = n.querySelector(".rte-citation-section-title");
|
|
246
|
-
return i && (i.textContent = e.labels.bibliographyTitle), n.setAttribute("aria-label", e.labels.bibliographyTitle), n;
|
|
232
|
+
return r.className = "rte-citation-list", r.setAttribute("role", "list"), i.appendChild(n), i.appendChild(r), i;
|
|
247
233
|
}
|
|
248
234
|
function Ut(t, e) {
|
|
249
|
-
let
|
|
250
|
-
|
|
251
|
-
const i =
|
|
252
|
-
return i && (i.textContent = e.labels.
|
|
253
|
-
}
|
|
254
|
-
function
|
|
235
|
+
let o = t.querySelector(G);
|
|
236
|
+
o || (o = At("rte-citation-bibliography", "citation-bibliography", e.labels.bibliographyTitle), t.appendChild(o));
|
|
237
|
+
const i = o.querySelector(".rte-citation-section-title");
|
|
238
|
+
return i && (i.textContent = e.labels.bibliographyTitle), o.setAttribute("aria-label", e.labels.bibliographyTitle), o;
|
|
239
|
+
}
|
|
240
|
+
function Wt(t, e) {
|
|
241
|
+
let o = t.querySelector(V);
|
|
242
|
+
o || (o = At("rte-citation-footnotes", "citation-footnotes", e.labels.footnotesTitle), t.appendChild(o));
|
|
243
|
+
const i = o.querySelector(".rte-citation-section-title");
|
|
244
|
+
return i && (i.textContent = e.labels.footnotesTitle), o.setAttribute("aria-label", e.labels.footnotesTitle), o;
|
|
245
|
+
}
|
|
246
|
+
function kt(t, e) {
|
|
255
247
|
t.querySelector(e)?.remove();
|
|
256
248
|
}
|
|
257
|
-
function
|
|
249
|
+
function Gt(t, e, o, i) {
|
|
258
250
|
if (e.length === 0) {
|
|
259
|
-
|
|
251
|
+
kt(t, G);
|
|
260
252
|
return;
|
|
261
253
|
}
|
|
262
|
-
const r =
|
|
254
|
+
const r = Ut(t, o).querySelector(".rte-citation-list");
|
|
263
255
|
if (!r) return;
|
|
264
256
|
const a = document.createDocumentFragment();
|
|
265
257
|
e.forEach((s, u) => {
|
|
266
258
|
const c = document.createElement("li");
|
|
267
|
-
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(u + 1)), c.textContent =
|
|
259
|
+
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(u + 1)), c.textContent = dt(s, i), a.appendChild(c);
|
|
268
260
|
}), r.innerHTML = "", r.appendChild(a);
|
|
269
261
|
}
|
|
270
|
-
function
|
|
271
|
-
if (!
|
|
272
|
-
|
|
262
|
+
function Vt(t, e, o, i) {
|
|
263
|
+
if (!o.enableFootnoteSync || e.length === 0) {
|
|
264
|
+
kt(t, V), R(t).forEach((l) => {
|
|
273
265
|
l.removeAttribute("data-footnote-number"), l.removeAttribute("data-footnote-target");
|
|
274
266
|
});
|
|
275
267
|
return;
|
|
276
268
|
}
|
|
277
|
-
const r =
|
|
269
|
+
const r = Wt(t, o).querySelector(".rte-citation-list");
|
|
278
270
|
if (!r) return;
|
|
279
271
|
const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
280
272
|
e.forEach((l, d) => {
|
|
@@ -299,40 +291,40 @@ function Gt(t, e, n, i) {
|
|
|
299
291
|
w.className = "rte-citation-footnote-number", w.textContent = `${d + 1}. `;
|
|
300
292
|
const A = document.createElement("span");
|
|
301
293
|
A.className = "rte-citation-footnote-text";
|
|
302
|
-
const
|
|
303
|
-
A.textContent = `${
|
|
304
|
-
const
|
|
305
|
-
if (
|
|
306
|
-
const
|
|
307
|
-
|
|
294
|
+
const Ot = l.note ? `${l.note}. ` : "";
|
|
295
|
+
A.textContent = `${Ot}${dt(l, i)}`, m.appendChild(w), m.appendChild(A);
|
|
296
|
+
const pt = a.get(l.id);
|
|
297
|
+
if (pt) {
|
|
298
|
+
const q = document.createElement("a");
|
|
299
|
+
q.className = "rte-citation-backref", q.href = `#${pt}`, q.setAttribute("aria-label", `Back to citation ${d + 1}`), q.textContent = "Back", m.appendChild(q);
|
|
308
300
|
}
|
|
309
301
|
c.appendChild(m);
|
|
310
302
|
}), r.innerHTML = "", r.appendChild(c);
|
|
311
303
|
}
|
|
312
|
-
function
|
|
313
|
-
const
|
|
314
|
-
t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${
|
|
304
|
+
function Yt(t, e, o, i) {
|
|
305
|
+
const n = dt(e, o);
|
|
306
|
+
t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${n}`);
|
|
315
307
|
}
|
|
316
|
-
function
|
|
308
|
+
function Xt(t, e, o) {
|
|
317
309
|
const i = R(t);
|
|
318
|
-
let
|
|
310
|
+
let n = `${e}:${o ? "1" : "0"}:${i.length}`;
|
|
319
311
|
return i.forEach((r) => {
|
|
320
|
-
|
|
321
|
-
}),
|
|
312
|
+
n += `|${r.getAttribute("data-citation-id") || ""}`, n += `|${r.getAttribute("data-citation-author") || ""}`, n += `|${r.getAttribute("data-citation-year") || ""}`, n += `|${r.getAttribute("data-citation-title") || ""}`, n += `|${r.getAttribute("data-citation-source") || ""}`, n += `|${r.getAttribute("data-citation-url") || ""}`, n += `|${r.getAttribute("data-citation-note") || ""}`;
|
|
313
|
+
}), n;
|
|
322
314
|
}
|
|
323
|
-
function
|
|
315
|
+
function F(t) {
|
|
324
316
|
const e = v.get(t);
|
|
325
317
|
if (!e) return;
|
|
326
|
-
const
|
|
327
|
-
if (!
|
|
328
|
-
const i =
|
|
318
|
+
const o = f.get(t) || M;
|
|
319
|
+
if (!o) return;
|
|
320
|
+
const i = z(t, o), n = U(t, o), r = at(t, n, o), a = e.querySelector(".rte-citations-status"), s = e.querySelector('[data-action="cycle-style"]'), u = e.querySelector(".rte-citations-recent-list");
|
|
329
321
|
if (a) {
|
|
330
|
-
const c =
|
|
331
|
-
a.textContent = `${
|
|
322
|
+
const c = n.length;
|
|
323
|
+
a.textContent = `${o.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${o.enableFootnoteSync ? "On" : "Off"}`;
|
|
332
324
|
}
|
|
333
|
-
if (s && (s.textContent = `${
|
|
325
|
+
if (s && (s.textContent = `${o.labels.styleButtonPrefix}: ${i.toUpperCase()}`, s.setAttribute("aria-label", `${o.labels.styleButtonPrefix}: ${i.toUpperCase()}`)), u) {
|
|
334
326
|
if (r.length === 0) {
|
|
335
|
-
u.innerHTML = `<li class="rte-citations-empty">${g(
|
|
327
|
+
u.innerHTML = `<li class="rte-citations-empty">${g(o.labels.noCitationsText)}</li>`;
|
|
336
328
|
return;
|
|
337
329
|
}
|
|
338
330
|
u.innerHTML = r.map(
|
|
@@ -355,34 +347,34 @@ function H(t) {
|
|
|
355
347
|
data-action="delete-by-id"
|
|
356
348
|
data-citation-id="${g(c.id)}"
|
|
357
349
|
aria-label="Delete citation: ${g(c.title)}"
|
|
358
|
-
>${g(
|
|
350
|
+
>${g(o.labels.deleteRecentText)}</button>
|
|
359
351
|
</div>
|
|
360
352
|
</li>
|
|
361
353
|
`
|
|
362
354
|
).join("");
|
|
363
355
|
}
|
|
364
356
|
}
|
|
365
|
-
function y(t, e,
|
|
366
|
-
const i =
|
|
367
|
-
if (!
|
|
368
|
-
return
|
|
357
|
+
function y(t, e, o = !1) {
|
|
358
|
+
const i = z(t, e), n = Xt(t, i, e.enableFootnoteSync);
|
|
359
|
+
if (!o && xt.get(t) === n)
|
|
360
|
+
return U(t, e);
|
|
369
361
|
const r = R(t), a = /* @__PURE__ */ new Map();
|
|
370
362
|
r.forEach((c) => {
|
|
371
|
-
const l =
|
|
363
|
+
const l = Et(c, e);
|
|
372
364
|
l && (a.has(l.id) || a.set(l.id, l));
|
|
373
365
|
});
|
|
374
366
|
const s = Array.from(a.values());
|
|
375
|
-
|
|
367
|
+
at(t, s, e);
|
|
376
368
|
const u = /* @__PURE__ */ new Map();
|
|
377
369
|
return s.forEach((c, l) => {
|
|
378
370
|
u.set(c.id, l + 1);
|
|
379
371
|
}), r.forEach((c) => {
|
|
380
372
|
const l = c.getAttribute("data-citation-id") || "", d = a.get(l);
|
|
381
373
|
if (!d) return;
|
|
382
|
-
|
|
374
|
+
St(c, d, i);
|
|
383
375
|
const m = u.get(d.id) || 1;
|
|
384
|
-
|
|
385
|
-
}),
|
|
376
|
+
Yt(c, d, i, Math.max(1, m));
|
|
377
|
+
}), Gt(t, s, e, i), Vt(t, s, e, i), xt.set(t, n), F(t), t.dispatchEvent(
|
|
386
378
|
new CustomEvent("editora:citations-refreshed", {
|
|
387
379
|
bubbles: !0,
|
|
388
380
|
detail: {
|
|
@@ -393,157 +385,157 @@ function y(t, e, n = !1) {
|
|
|
393
385
|
})
|
|
394
386
|
), s;
|
|
395
387
|
}
|
|
396
|
-
function kt(t) {
|
|
397
|
-
const e = Q.get(t);
|
|
398
|
-
typeof e == "number" && (window.clearTimeout(e), q.delete(e), Q.delete(t));
|
|
399
|
-
}
|
|
400
388
|
function Tt(t) {
|
|
389
|
+
const e = tt.get(t);
|
|
390
|
+
typeof e == "number" && (window.clearTimeout(e), K.delete(e), tt.delete(t));
|
|
391
|
+
}
|
|
392
|
+
function Mt(t) {
|
|
401
393
|
const e = f.get(t) || M;
|
|
402
394
|
if (!e) return;
|
|
403
|
-
|
|
404
|
-
const
|
|
405
|
-
|
|
395
|
+
Tt(t);
|
|
396
|
+
const o = window.setTimeout(() => {
|
|
397
|
+
K.delete(o), tt.delete(t), y(t, e, !1);
|
|
406
398
|
}, e.debounceMs);
|
|
407
|
-
|
|
399
|
+
K.add(o), tt.set(t, o);
|
|
408
400
|
}
|
|
409
|
-
function
|
|
401
|
+
function Jt(t) {
|
|
410
402
|
const e = window.getSelection();
|
|
411
403
|
if (!e) throw new Error("Selection unavailable");
|
|
412
404
|
if (e.rangeCount > 0) {
|
|
413
405
|
const a = e.getRangeAt(0);
|
|
414
|
-
if (t.contains(a.commonAncestorContainer) && !
|
|
406
|
+
if (t.contains(a.commonAncestorContainer) && !j(a.commonAncestorContainer))
|
|
415
407
|
return a.cloneRange();
|
|
416
408
|
}
|
|
417
|
-
const
|
|
418
|
-
return r ? (
|
|
409
|
+
const o = document.createRange(), i = t.querySelector(G), n = t.querySelector(V), r = i || n;
|
|
410
|
+
return r ? (o.setStartBefore(r), o.collapse(!0), o) : (o.selectNodeContents(t), o.collapse(!1), o);
|
|
419
411
|
}
|
|
420
|
-
function
|
|
412
|
+
function ft(t) {
|
|
421
413
|
t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
422
414
|
}
|
|
423
|
-
function
|
|
415
|
+
function bt(t, e) {
|
|
424
416
|
if (e === t.innerHTML) return;
|
|
425
|
-
const
|
|
426
|
-
if (typeof
|
|
417
|
+
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
418
|
+
if (typeof o == "function")
|
|
427
419
|
try {
|
|
428
|
-
|
|
420
|
+
o("recordDomTransaction", t, e, t.innerHTML);
|
|
429
421
|
} catch {
|
|
430
422
|
}
|
|
431
423
|
}
|
|
432
|
-
function
|
|
433
|
-
const
|
|
434
|
-
if (!
|
|
424
|
+
function Lt(t, e) {
|
|
425
|
+
const o = window.getSelection();
|
|
426
|
+
if (!o) return;
|
|
435
427
|
const i = document.createRange();
|
|
436
428
|
if (t.nodeType === Node.TEXT_NODE) {
|
|
437
|
-
const
|
|
438
|
-
i.setStart(
|
|
429
|
+
const n = t, r = Math.max(0, Math.min(e, n.length));
|
|
430
|
+
i.setStart(n, r);
|
|
439
431
|
} else {
|
|
440
|
-
const
|
|
432
|
+
const n = t.childNodes.length, r = Math.max(0, Math.min(e, n));
|
|
441
433
|
i.setStart(t, r);
|
|
442
434
|
}
|
|
443
|
-
i.collapse(!0),
|
|
435
|
+
i.collapse(!0), o.removeAllRanges(), o.addRange(i);
|
|
444
436
|
}
|
|
445
|
-
function
|
|
437
|
+
function Rt(t) {
|
|
446
438
|
if (t.collapsed || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1 || !(t.startContainer instanceof Element || t.startContainer instanceof DocumentFragment))
|
|
447
439
|
return null;
|
|
448
440
|
const e = t.startContainer.childNodes[t.startOffset];
|
|
449
|
-
return !(e instanceof HTMLElement) || !e.matches(
|
|
441
|
+
return !(e instanceof HTMLElement) || !e.matches(it) ? null : e;
|
|
450
442
|
}
|
|
451
|
-
function
|
|
452
|
-
const { startContainer: i, startOffset:
|
|
443
|
+
function Z(t, e, o) {
|
|
444
|
+
const { startContainer: i, startOffset: n } = t;
|
|
453
445
|
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
454
446
|
const a = i;
|
|
455
|
-
if (
|
|
456
|
-
if (
|
|
457
|
-
} else if (
|
|
458
|
-
return a.childNodes[
|
|
447
|
+
if (o === "previous") {
|
|
448
|
+
if (n > 0) return a.childNodes[n - 1] || null;
|
|
449
|
+
} else if (n < a.childNodes.length)
|
|
450
|
+
return a.childNodes[n] || null;
|
|
459
451
|
}
|
|
460
|
-
if (i.nodeType === Node.TEXT_NODE && (
|
|
452
|
+
if (i.nodeType === Node.TEXT_NODE && (o === "previous" && n < i.data.length || o === "next" && n > 0))
|
|
461
453
|
return null;
|
|
462
454
|
let r = i;
|
|
463
455
|
for (; r && r !== e; ) {
|
|
464
|
-
const a =
|
|
456
|
+
const a = o === "previous" ? r.previousSibling : r.nextSibling;
|
|
465
457
|
if (a) return a;
|
|
466
458
|
r = r.parentNode;
|
|
467
459
|
}
|
|
468
460
|
return null;
|
|
469
461
|
}
|
|
470
|
-
function
|
|
462
|
+
function zt(t, e, o) {
|
|
471
463
|
if (!t.collapsed) return null;
|
|
472
|
-
const i = (a) => a instanceof HTMLElement && a.matches(
|
|
473
|
-
if (
|
|
474
|
-
const a =
|
|
475
|
-
return
|
|
464
|
+
const i = (a) => a instanceof HTMLElement && a.matches(it) ? a : null, { startContainer: n, startOffset: r } = t;
|
|
465
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
466
|
+
const a = n;
|
|
467
|
+
return o === "Backspace" && r > 0 ? i(a.childNodes[r - 1] || null) : o === "Delete" ? i(a.childNodes[r] || null) : null;
|
|
476
468
|
}
|
|
477
|
-
if (
|
|
478
|
-
const a =
|
|
479
|
-
if (
|
|
469
|
+
if (n.nodeType === Node.TEXT_NODE) {
|
|
470
|
+
const a = n;
|
|
471
|
+
if (o === "Backspace" && r === 0) {
|
|
480
472
|
const s = i(a.previousSibling);
|
|
481
|
-
return s || i(
|
|
473
|
+
return s || i(Z(t, e, "previous"));
|
|
482
474
|
}
|
|
483
|
-
if (
|
|
475
|
+
if (o === "Delete" && r === a.data.length) {
|
|
484
476
|
const s = i(a.nextSibling);
|
|
485
|
-
return s || i(
|
|
477
|
+
return s || i(Z(t, e, "next"));
|
|
486
478
|
}
|
|
487
479
|
}
|
|
488
|
-
return i(
|
|
480
|
+
return i(o === "Backspace" ? Z(t, e, "previous") : Z(t, e, "next"));
|
|
489
481
|
}
|
|
490
|
-
function
|
|
482
|
+
function D(t, e, o) {
|
|
491
483
|
const i = t.closest(S);
|
|
492
|
-
if (!i ||
|
|
493
|
-
const
|
|
494
|
-
if (!
|
|
495
|
-
const r = i.innerHTML, a = Array.from(
|
|
484
|
+
if (!i || j(t)) return !1;
|
|
485
|
+
const n = t.parentNode;
|
|
486
|
+
if (!n) return !1;
|
|
487
|
+
const r = i.innerHTML, a = Array.from(n.childNodes).indexOf(t);
|
|
496
488
|
if (a < 0) return !1;
|
|
497
489
|
const s = t.nextSibling;
|
|
498
|
-
return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(),
|
|
490
|
+
return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Lt(n, a), y(i, o, !0), bt(i, r), ft(i), e === "Delete" && i.focus({ preventScroll: !0 }), !0;
|
|
499
491
|
}
|
|
500
|
-
function
|
|
492
|
+
function Zt(t, e, o) {
|
|
501
493
|
if (t.key !== "Backspace" && t.key !== "Delete") return !1;
|
|
502
|
-
const i = t.key,
|
|
503
|
-
if (
|
|
504
|
-
return t.preventDefault(), t.stopPropagation(),
|
|
494
|
+
const i = t.key, n = t.target;
|
|
495
|
+
if (n?.matches(it) && e.contains(n) && !j(n))
|
|
496
|
+
return t.preventDefault(), t.stopPropagation(), D(n, i, o);
|
|
505
497
|
const r = window.getSelection();
|
|
506
498
|
if (!r || r.rangeCount === 0) return !1;
|
|
507
499
|
const a = r.getRangeAt(0);
|
|
508
|
-
if (!e.contains(a.commonAncestorContainer) ||
|
|
509
|
-
const s =
|
|
500
|
+
if (!e.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer)) return !1;
|
|
501
|
+
const s = Rt(a);
|
|
510
502
|
if (s)
|
|
511
|
-
return t.preventDefault(), t.stopPropagation(),
|
|
512
|
-
const u =
|
|
513
|
-
return u ? (t.preventDefault(), t.stopPropagation(),
|
|
503
|
+
return t.preventDefault(), t.stopPropagation(), D(s, i, o);
|
|
504
|
+
const u = zt(a, e, i);
|
|
505
|
+
return u ? (t.preventDefault(), t.stopPropagation(), D(u, i, o)) : !1;
|
|
514
506
|
}
|
|
515
|
-
function Nt(t, e,
|
|
516
|
-
const i =
|
|
507
|
+
function Nt(t, e, o) {
|
|
508
|
+
const i = _(o.normalizeText(e || ""));
|
|
517
509
|
if (!i) return !1;
|
|
518
|
-
const
|
|
519
|
-
if (
|
|
520
|
-
if (
|
|
521
|
-
return
|
|
510
|
+
const n = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
|
|
511
|
+
if (n.length === 0) return !1;
|
|
512
|
+
if (n.length === 1)
|
|
513
|
+
return D(n[0], "Delete", o);
|
|
522
514
|
const r = t.innerHTML;
|
|
523
|
-
return
|
|
515
|
+
return n.forEach((a) => {
|
|
524
516
|
const s = a.nextSibling;
|
|
525
517
|
s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), a.remove();
|
|
526
|
-
}),
|
|
527
|
-
}
|
|
528
|
-
function
|
|
529
|
-
const
|
|
530
|
-
if (!
|
|
531
|
-
const i =
|
|
532
|
-
if (!t.contains(i.commonAncestorContainer) ||
|
|
533
|
-
const
|
|
534
|
-
if (
|
|
535
|
-
return
|
|
536
|
-
const r =
|
|
537
|
-
return r ?
|
|
538
|
-
}
|
|
539
|
-
function
|
|
540
|
-
const i =
|
|
518
|
+
}), Lt(t, t.childNodes.length), y(t, o, !0), bt(t, r), ft(t), t.focus({ preventScroll: !0 }), !0;
|
|
519
|
+
}
|
|
520
|
+
function Qt(t, e) {
|
|
521
|
+
const o = window.getSelection();
|
|
522
|
+
if (!o || o.rangeCount === 0) return !1;
|
|
523
|
+
const i = o.getRangeAt(0);
|
|
524
|
+
if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer)) return !1;
|
|
525
|
+
const n = Rt(i);
|
|
526
|
+
if (n)
|
|
527
|
+
return D(n, "Delete", e);
|
|
528
|
+
const r = zt(i, t, "Backspace");
|
|
529
|
+
return r ? D(r, "Backspace", e) : !1;
|
|
530
|
+
}
|
|
531
|
+
function nt(t, e, o) {
|
|
532
|
+
const i = wt(e, o);
|
|
541
533
|
if (!i.author || !i.title) return !1;
|
|
542
|
-
i.id || (i.id =
|
|
543
|
-
const
|
|
534
|
+
i.id || (i.id = _t(t, o));
|
|
535
|
+
const n = t.innerHTML;
|
|
544
536
|
let r;
|
|
545
537
|
try {
|
|
546
|
-
r =
|
|
538
|
+
r = Jt(t);
|
|
547
539
|
} catch {
|
|
548
540
|
return !1;
|
|
549
541
|
}
|
|
@@ -551,7 +543,7 @@ function et(t, e, n) {
|
|
|
551
543
|
if (!a) return !1;
|
|
552
544
|
r.collapsed || r.deleteContents();
|
|
553
545
|
const s = document.createElement("span");
|
|
554
|
-
|
|
546
|
+
St(s, i, z(t, o));
|
|
555
547
|
try {
|
|
556
548
|
r.insertNode(s);
|
|
557
549
|
} catch {
|
|
@@ -565,80 +557,82 @@ function et(t, e, n) {
|
|
|
565
557
|
c.setStart(u.parentNode, Math.max(0, l));
|
|
566
558
|
} else
|
|
567
559
|
c.setStartAfter(s);
|
|
568
|
-
return c.collapse(!0), a.removeAllRanges(), a.addRange(c),
|
|
560
|
+
return c.collapse(!0), a.removeAllRanges(), a.addRange(c), Kt(t, i, o), y(t, o, !0), bt(t, n), ft(t), !0;
|
|
569
561
|
}
|
|
570
|
-
function
|
|
562
|
+
function te(t, e) {
|
|
571
563
|
if (!e) return !1;
|
|
572
|
-
const
|
|
573
|
-
if (!
|
|
574
|
-
|
|
564
|
+
const o = R(t).find((r) => r.getAttribute("data-citation-id") === e) || null;
|
|
565
|
+
if (!o) return !1;
|
|
566
|
+
o.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), o.focus({ preventScroll: !0 });
|
|
575
567
|
const i = window.getSelection();
|
|
576
568
|
if (!i) return !0;
|
|
577
|
-
const
|
|
578
|
-
return
|
|
569
|
+
const n = document.createRange();
|
|
570
|
+
return n.selectNode(o), i.removeAllRanges(), i.addRange(n), !0;
|
|
579
571
|
}
|
|
580
|
-
function
|
|
581
|
-
return
|
|
572
|
+
function ot(t) {
|
|
573
|
+
return Y.get(t) === !0;
|
|
582
574
|
}
|
|
583
|
-
function
|
|
584
|
-
const
|
|
585
|
-
|
|
575
|
+
function W(t, e = !1) {
|
|
576
|
+
const o = v.get(t);
|
|
577
|
+
o && (o.classList.remove("show"), Y.set(t, !1), rt(t, "toggleCitationsPanel", !1), e && t.focus({ preventScroll: !0 }));
|
|
586
578
|
}
|
|
587
|
-
function
|
|
588
|
-
v.forEach((e,
|
|
589
|
-
|
|
579
|
+
function ee(t) {
|
|
580
|
+
v.forEach((e, o) => {
|
|
581
|
+
o !== t && W(o, !1);
|
|
590
582
|
});
|
|
591
583
|
}
|
|
592
|
-
function
|
|
584
|
+
function lt(t, e) {
|
|
593
585
|
if (!e.classList.contains("show")) return;
|
|
594
|
-
const i =
|
|
595
|
-
e.style.width = `${
|
|
586
|
+
const i = ut(t).getBoundingClientRect(), n = Math.min(window.innerWidth - 20, 380), r = Math.max(10, window.innerWidth - n - 10), a = Math.min(Math.max(10, i.right - n), r), s = Math.max(10, Math.min(window.innerHeight - 10 - 260, i.top + 10));
|
|
587
|
+
e.style.width = `${n}px`, e.style.left = `${a}px`, e.style.top = `${s}px`, e.style.maxHeight = `${Math.max(260, window.innerHeight - 24)}px`;
|
|
596
588
|
}
|
|
597
589
|
function C(t, e) {
|
|
598
590
|
return t.querySelector(`[data-field="${e}"]`);
|
|
599
591
|
}
|
|
600
|
-
function
|
|
601
|
-
const e = C(t, "author")?.value || "",
|
|
592
|
+
function ne(t) {
|
|
593
|
+
const e = C(t, "author")?.value || "", o = C(t, "year")?.value || "", i = C(t, "title")?.value || "", n = C(t, "source")?.value || "", r = C(t, "url")?.value || "", a = C(t, "note")?.value || "";
|
|
602
594
|
return {
|
|
603
595
|
author: e,
|
|
604
|
-
year:
|
|
596
|
+
year: o,
|
|
605
597
|
title: i,
|
|
606
|
-
source:
|
|
598
|
+
source: n,
|
|
607
599
|
url: r,
|
|
608
600
|
note: a
|
|
609
601
|
};
|
|
610
602
|
}
|
|
611
|
-
function E(t, e) {
|
|
612
|
-
const
|
|
613
|
-
|
|
603
|
+
function E(t, e, o = !1) {
|
|
604
|
+
const i = t.querySelector(".rte-citations-live");
|
|
605
|
+
i && (i.textContent = e);
|
|
606
|
+
const n = t.querySelector(".rte-citations-status");
|
|
607
|
+
n && (n.textContent = e, n.classList.toggle("rte-citations-status-error", o));
|
|
614
608
|
}
|
|
615
|
-
function
|
|
609
|
+
function oe(t, e, o) {
|
|
616
610
|
const i = C(e, "style");
|
|
617
|
-
i && (i.value =
|
|
611
|
+
i && (i.value = z(t, o));
|
|
618
612
|
}
|
|
619
|
-
function
|
|
620
|
-
const i = L.includes(e) ? e :
|
|
621
|
-
return T.set(t, i), y(t,
|
|
613
|
+
function It(t, e, o) {
|
|
614
|
+
const i = L.includes(e) ? e : o.defaultStyle;
|
|
615
|
+
return T.set(t, i), y(t, o, !0), i;
|
|
622
616
|
}
|
|
623
|
-
function
|
|
624
|
-
const
|
|
625
|
-
return T.set(t,
|
|
617
|
+
function gt(t, e) {
|
|
618
|
+
const o = z(t, e), i = L.indexOf(o), n = L[(i + 1) % L.length];
|
|
619
|
+
return T.set(t, n), y(t, e, !0), n;
|
|
626
620
|
}
|
|
627
|
-
function
|
|
621
|
+
function ie(t) {
|
|
628
622
|
const e = v.get(t);
|
|
629
623
|
if (e) return e;
|
|
630
|
-
const
|
|
631
|
-
|
|
624
|
+
const o = f.get(t) || M || Q(), i = `rte-citations-panel-${Dt++}`, n = document.createElement("section");
|
|
625
|
+
n.className = b, n.id = i, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "false"), n.setAttribute("aria-label", o.labels.panelAriaLabel), n.setAttribute("tabindex", "-1"), n.innerHTML = `
|
|
632
626
|
<header class="rte-citations-header">
|
|
633
|
-
<h2 class="rte-citations-title">${g(
|
|
634
|
-
<button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(
|
|
627
|
+
<h2 class="rte-citations-title">${g(o.labels.panelTitle)}</h2>
|
|
628
|
+
<button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(o.labels.closeText)}">✕</button>
|
|
635
629
|
</header>
|
|
636
630
|
<div class="rte-citations-body">
|
|
637
631
|
<p class="rte-citations-status" aria-live="polite"></p>
|
|
638
632
|
|
|
639
633
|
<div class="rte-citations-grid">
|
|
640
634
|
<label class="rte-citations-label">
|
|
641
|
-
${g(
|
|
635
|
+
${g(o.labels.styleLabel)}
|
|
642
636
|
<select data-field="style" class="rte-citations-field">
|
|
643
637
|
<option value="apa">APA</option>
|
|
644
638
|
<option value="mla">MLA</option>
|
|
@@ -646,105 +640,106 @@ function oe(t) {
|
|
|
646
640
|
</select>
|
|
647
641
|
</label>
|
|
648
642
|
<label class="rte-citations-label">
|
|
649
|
-
${g(
|
|
643
|
+
${g(o.labels.authorLabel)}
|
|
650
644
|
<input type="text" data-field="author" class="rte-citations-field" autocomplete="off" />
|
|
651
645
|
</label>
|
|
652
646
|
<label class="rte-citations-label">
|
|
653
|
-
${g(
|
|
647
|
+
${g(o.labels.yearLabel)}
|
|
654
648
|
<input type="text" data-field="year" class="rte-citations-field" inputmode="numeric" autocomplete="off" />
|
|
655
649
|
</label>
|
|
656
650
|
<label class="rte-citations-label">
|
|
657
|
-
${g(
|
|
651
|
+
${g(o.labels.titleLabel)}
|
|
658
652
|
<input type="text" data-field="title" class="rte-citations-field" autocomplete="off" />
|
|
659
653
|
</label>
|
|
660
654
|
<label class="rte-citations-label">
|
|
661
|
-
${g(
|
|
655
|
+
${g(o.labels.sourceLabel)}
|
|
662
656
|
<input type="text" data-field="source" class="rte-citations-field" autocomplete="off" />
|
|
663
657
|
</label>
|
|
664
658
|
<label class="rte-citations-label">
|
|
665
|
-
${g(
|
|
659
|
+
${g(o.labels.urlLabel)}
|
|
666
660
|
<input type="url" data-field="url" class="rte-citations-field" autocomplete="off" />
|
|
667
661
|
</label>
|
|
668
662
|
<label class="rte-citations-label rte-citations-label-note">
|
|
669
|
-
${g(
|
|
663
|
+
${g(o.labels.noteLabel)}
|
|
670
664
|
<textarea data-field="note" class="rte-citations-field" rows="2"></textarea>
|
|
671
665
|
</label>
|
|
672
666
|
</div>
|
|
673
667
|
|
|
674
668
|
<div class="rte-citations-controls" role="toolbar" aria-label="Citation actions">
|
|
675
|
-
<button type="button" class="rte-citations-btn rte-citations-btn-primary" data-action="insert">${g(
|
|
676
|
-
<button type="button" class="rte-citations-btn" data-action="refresh">${g(
|
|
669
|
+
<button type="button" class="rte-citations-btn rte-citations-btn-primary" data-action="insert">${g(o.labels.insertText)}</button>
|
|
670
|
+
<button type="button" class="rte-citations-btn" data-action="refresh">${g(o.labels.refreshText)}</button>
|
|
677
671
|
<button type="button" class="rte-citations-btn" data-action="cycle-style"></button>
|
|
678
672
|
</div>
|
|
679
673
|
|
|
680
|
-
<section class="rte-citations-recent" aria-label="${g(
|
|
681
|
-
<h3 class="rte-citations-recent-heading">${g(
|
|
674
|
+
<section class="rte-citations-recent" aria-label="${g(o.labels.recentHeading)}">
|
|
675
|
+
<h3 class="rte-citations-recent-heading">${g(o.labels.recentHeading)}</h3>
|
|
682
676
|
<ul class="rte-citations-recent-list" role="list"></ul>
|
|
683
677
|
</section>
|
|
684
678
|
|
|
679
|
+
<p class="rte-citations-status" aria-hidden="true"></p>
|
|
685
680
|
<p class="rte-citations-shortcut">Shortcut: Ctrl/Cmd + Alt + Shift + C</p>
|
|
686
681
|
<span class="rte-citations-live" aria-live="polite"></span>
|
|
687
682
|
</div>
|
|
688
|
-
`,
|
|
683
|
+
`, n.addEventListener("click", (a) => {
|
|
689
684
|
const s = a.target;
|
|
690
685
|
if (!s) return;
|
|
691
686
|
const u = s.closest("[data-action]");
|
|
692
687
|
if (!u) return;
|
|
693
|
-
const c = u.getAttribute("data-action") || "", l = f.get(t) || M ||
|
|
688
|
+
const c = u.getAttribute("data-action") || "", l = f.get(t) || M || o;
|
|
694
689
|
if (f.set(t, l), c === "close") {
|
|
695
|
-
|
|
690
|
+
W(t, !0);
|
|
696
691
|
return;
|
|
697
692
|
}
|
|
698
693
|
if (c === "insert") {
|
|
699
694
|
if ($(t)) return;
|
|
700
|
-
const d =
|
|
695
|
+
const d = ne(n);
|
|
701
696
|
if (!l.normalizeText(d.author) || !l.normalizeText(d.title)) {
|
|
702
|
-
E(
|
|
697
|
+
E(n, l.labels.invalidMessage, !0);
|
|
703
698
|
return;
|
|
704
699
|
}
|
|
705
|
-
if (!
|
|
706
|
-
E(
|
|
700
|
+
if (!nt(t, d, l)) {
|
|
701
|
+
E(n, l.labels.invalidMessage, !0);
|
|
707
702
|
return;
|
|
708
703
|
}
|
|
709
|
-
E(
|
|
710
|
-
const w = C(
|
|
704
|
+
E(n, "Citation inserted.");
|
|
705
|
+
const w = C(n, "title"), A = C(n, "note");
|
|
711
706
|
w && (w.value = ""), A && (A.value = "");
|
|
712
707
|
return;
|
|
713
708
|
}
|
|
714
709
|
if (c === "refresh") {
|
|
715
710
|
const d = y(t, l, !0);
|
|
716
|
-
E(
|
|
711
|
+
E(n, `Refreshed ${d.length} citation${d.length === 1 ? "" : "s"}.`);
|
|
717
712
|
return;
|
|
718
713
|
}
|
|
719
714
|
if (c === "cycle-style") {
|
|
720
|
-
const d =
|
|
721
|
-
|
|
715
|
+
const d = gt(t, l);
|
|
716
|
+
oe(t, n, l), E(n, `Style changed to ${d.toUpperCase()}.`);
|
|
722
717
|
return;
|
|
723
718
|
}
|
|
724
719
|
if (c === "insert-from-recent") {
|
|
725
720
|
if ($(t)) return;
|
|
726
|
-
const d = u.getAttribute("data-citation-id") || "", m =
|
|
721
|
+
const d = u.getAttribute("data-citation-id") || "", m = $t(t, d, U(t, l), l);
|
|
727
722
|
if (!m) return;
|
|
728
|
-
|
|
723
|
+
nt(t, m, l), E(n, `Inserted citation: ${m.title}.`);
|
|
729
724
|
return;
|
|
730
725
|
}
|
|
731
726
|
if (c === "delete-by-id") {
|
|
732
727
|
if ($(t)) return;
|
|
733
728
|
const d = u.getAttribute("data-citation-id") || "";
|
|
734
729
|
if (Nt(t, d, l)) {
|
|
735
|
-
E(
|
|
730
|
+
E(n, "Citation deleted.");
|
|
736
731
|
return;
|
|
737
732
|
}
|
|
738
|
-
|
|
733
|
+
jt(t, d, l) && (F(t), E(n, "Removed from recent citations."));
|
|
739
734
|
}
|
|
740
|
-
}),
|
|
735
|
+
}), n.addEventListener("keydown", (a) => {
|
|
741
736
|
if (a.key === "Escape") {
|
|
742
|
-
a.preventDefault(),
|
|
737
|
+
a.preventDefault(), W(t, !0);
|
|
743
738
|
return;
|
|
744
739
|
}
|
|
745
740
|
const s = a.target;
|
|
746
741
|
if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp") return;
|
|
747
|
-
const u = Array.from(
|
|
742
|
+
const u = Array.from(n.querySelectorAll(".rte-citations-recent-btn"));
|
|
748
743
|
if (u.length === 0) return;
|
|
749
744
|
const c = u.indexOf(s);
|
|
750
745
|
if (c < 0) return;
|
|
@@ -752,82 +747,82 @@ function oe(t) {
|
|
|
752
747
|
const l = a.key === "ArrowDown" ? 1 : -1, d = (c + l + u.length) % u.length;
|
|
753
748
|
u[d].focus();
|
|
754
749
|
});
|
|
755
|
-
const r = C(
|
|
750
|
+
const r = C(n, "style");
|
|
756
751
|
return r?.addEventListener("change", () => {
|
|
757
|
-
const a = f.get(t) || M ||
|
|
758
|
-
|
|
759
|
-
}),
|
|
752
|
+
const a = f.get(t) || M || o, s = r.value;
|
|
753
|
+
It(t, s, a), E(n, `Style changed to ${s.toUpperCase()}.`);
|
|
754
|
+
}), et(n, t), document.body.appendChild(n), v.set(t, n), Y.set(t, !1), F(t), n;
|
|
760
755
|
}
|
|
761
|
-
function
|
|
762
|
-
const e =
|
|
763
|
-
|
|
756
|
+
function I(t) {
|
|
757
|
+
const e = ie(t);
|
|
758
|
+
ee(t), e.classList.add("show"), Y.set(t, !0), rt(t, "toggleCitationsPanel", !0), et(e, t), lt(t, e), F(t), C(e, "author")?.focus();
|
|
764
759
|
}
|
|
765
|
-
function
|
|
766
|
-
const
|
|
767
|
-
return (typeof e == "boolean" ? e : !
|
|
760
|
+
function Bt(t, e) {
|
|
761
|
+
const o = ot(t);
|
|
762
|
+
return (typeof e == "boolean" ? e : !o) ? I(t) : W(t, !1), !0;
|
|
768
763
|
}
|
|
769
|
-
function
|
|
764
|
+
function mt(t) {
|
|
770
765
|
return typeof t.key == "string" ? t.key.toLowerCase() : "";
|
|
771
766
|
}
|
|
772
|
-
function
|
|
773
|
-
const e =
|
|
767
|
+
function re(t) {
|
|
768
|
+
const e = mt(t);
|
|
774
769
|
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "c";
|
|
775
770
|
}
|
|
776
|
-
function
|
|
777
|
-
const e =
|
|
771
|
+
function ae(t) {
|
|
772
|
+
const e = mt(t);
|
|
778
773
|
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "b";
|
|
779
774
|
}
|
|
780
|
-
function
|
|
781
|
-
const e =
|
|
775
|
+
function se(t) {
|
|
776
|
+
const e = mt(t);
|
|
782
777
|
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "j";
|
|
783
778
|
}
|
|
784
|
-
function
|
|
785
|
-
M = t,
|
|
779
|
+
function ce(t) {
|
|
780
|
+
M = t, B || (B = (e) => {
|
|
786
781
|
const i = e.target?.closest(S);
|
|
787
782
|
if (!i) return;
|
|
788
783
|
p = i, f.has(i) || f.set(i, t), T.has(i) || T.set(i, t.defaultStyle);
|
|
789
|
-
const
|
|
790
|
-
|
|
791
|
-
}, document.addEventListener("focusin",
|
|
784
|
+
const n = v.get(i);
|
|
785
|
+
n && (et(n, i), lt(i, n)), rt(i, "toggleCitationsPanel", ot(i));
|
|
786
|
+
}, document.addEventListener("focusin", B, !0)), O || (O = (e) => {
|
|
792
787
|
const i = e.target?.closest(S);
|
|
793
|
-
i && (p = i,
|
|
794
|
-
}, document.addEventListener("input",
|
|
788
|
+
i && (p = i, Mt(i));
|
|
789
|
+
}, document.addEventListener("input", O, !0)), P || (P = (e) => {
|
|
795
790
|
if (e.defaultPrevented) return;
|
|
796
|
-
const i = !!e.target?.closest(`.${b} input, .${b} textarea, .${b} select`),
|
|
797
|
-
if (!
|
|
798
|
-
const r = f.get(
|
|
799
|
-
if (f.set(
|
|
800
|
-
e.preventDefault(),
|
|
791
|
+
const i = !!e.target?.closest(`.${b} input, .${b} textarea, .${b} select`), n = h(void 0, !1);
|
|
792
|
+
if (!n || $(n)) return;
|
|
793
|
+
const r = f.get(n) || M || t;
|
|
794
|
+
if (f.set(n, r), p = n, e.key === "Escape" && ot(n)) {
|
|
795
|
+
e.preventDefault(), W(n, !0);
|
|
801
796
|
return;
|
|
802
797
|
}
|
|
803
|
-
if (!i && !
|
|
804
|
-
if (
|
|
805
|
-
e.preventDefault(), e.stopPropagation(),
|
|
798
|
+
if (!i && !Zt(e, n, r)) {
|
|
799
|
+
if (re(e)) {
|
|
800
|
+
e.preventDefault(), e.stopPropagation(), Bt(n);
|
|
806
801
|
return;
|
|
807
802
|
}
|
|
808
|
-
if (
|
|
809
|
-
e.preventDefault(), e.stopPropagation(), y(
|
|
803
|
+
if (ae(e)) {
|
|
804
|
+
e.preventDefault(), e.stopPropagation(), y(n, r, !0), I(n);
|
|
810
805
|
return;
|
|
811
806
|
}
|
|
812
|
-
|
|
807
|
+
se(e) && (e.preventDefault(), e.stopPropagation(), gt(n, r));
|
|
813
808
|
}
|
|
814
|
-
}, document.addEventListener("keydown",
|
|
815
|
-
v.forEach((e,
|
|
816
|
-
if (!
|
|
817
|
-
|
|
809
|
+
}, document.addEventListener("keydown", P, !0)), k || (k = () => {
|
|
810
|
+
v.forEach((e, o) => {
|
|
811
|
+
if (!o.isConnected || !e.isConnected) {
|
|
812
|
+
Tt(o), e.remove(), v.delete(o), Y.delete(o);
|
|
818
813
|
return;
|
|
819
814
|
}
|
|
820
|
-
|
|
815
|
+
et(e, o), lt(o, e);
|
|
821
816
|
});
|
|
822
817
|
}, window.addEventListener("scroll", k, !0), window.addEventListener("resize", k));
|
|
823
818
|
}
|
|
824
|
-
function ce() {
|
|
825
|
-
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;
|
|
826
|
-
}
|
|
827
819
|
function le() {
|
|
828
|
-
|
|
820
|
+
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;
|
|
821
|
+
}
|
|
822
|
+
function ue() {
|
|
823
|
+
if (typeof document > "u" || document.getElementById(ht)) return;
|
|
829
824
|
const t = document.createElement("style");
|
|
830
|
-
t.id =
|
|
825
|
+
t.id = ht, t.textContent = `
|
|
831
826
|
.rte-toolbar-group-items.citations,
|
|
832
827
|
.editora-toolbar-group-items.citations {
|
|
833
828
|
display: flex;
|
|
@@ -1193,6 +1188,30 @@ function le() {
|
|
|
1193
1188
|
color: #94a3b8;
|
|
1194
1189
|
}
|
|
1195
1190
|
|
|
1191
|
+
.rte-citations-status {
|
|
1192
|
+
margin: 0;
|
|
1193
|
+
min-height: 16px;
|
|
1194
|
+
font-size: 12px;
|
|
1195
|
+
font-weight: 600;
|
|
1196
|
+
color: #166534;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
.rte-citations-status:empty {
|
|
1200
|
+
display: none;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
.rte-citations-status.rte-citations-status-error {
|
|
1204
|
+
color: #b91c1c;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
.${b}.rte-citations-theme-dark .rte-citations-status {
|
|
1208
|
+
color: #86efac;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
.${b}.rte-citations-theme-dark .rte-citations-status.rte-citations-status-error {
|
|
1212
|
+
color: #fca5a5;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1196
1215
|
.rte-citations-live {
|
|
1197
1216
|
position: absolute;
|
|
1198
1217
|
width: 1px;
|
|
@@ -1297,9 +1316,9 @@ function le() {
|
|
|
1297
1316
|
}
|
|
1298
1317
|
`, document.head.appendChild(t);
|
|
1299
1318
|
}
|
|
1300
|
-
const
|
|
1301
|
-
const e =
|
|
1302
|
-
return
|
|
1319
|
+
const de = (t = {}) => {
|
|
1320
|
+
const e = Q(t);
|
|
1321
|
+
return ue(), {
|
|
1303
1322
|
name: "citations",
|
|
1304
1323
|
toolbar: [
|
|
1305
1324
|
{
|
|
@@ -1333,101 +1352,101 @@ const ue = (t = {}) => {
|
|
|
1333
1352
|
}
|
|
1334
1353
|
],
|
|
1335
1354
|
commands: {
|
|
1336
|
-
citations: (
|
|
1337
|
-
const
|
|
1338
|
-
if (!
|
|
1339
|
-
const r = f.get(
|
|
1340
|
-
return f.set(
|
|
1355
|
+
citations: (o, i) => {
|
|
1356
|
+
const n = h(i);
|
|
1357
|
+
if (!n || $(n)) return !1;
|
|
1358
|
+
const r = f.get(n) || e;
|
|
1359
|
+
return f.set(n, r), T.set(n, z(n, r)), p = n, I(n), y(n, r, !1), !0;
|
|
1341
1360
|
},
|
|
1342
|
-
toggleCitationsPanel: (
|
|
1343
|
-
const
|
|
1344
|
-
if (!
|
|
1345
|
-
const r = f.get(
|
|
1346
|
-
f.set(
|
|
1347
|
-
const a =
|
|
1348
|
-
return
|
|
1361
|
+
toggleCitationsPanel: (o, i) => {
|
|
1362
|
+
const n = h(i);
|
|
1363
|
+
if (!n || $(n)) return !1;
|
|
1364
|
+
const r = f.get(n) || e;
|
|
1365
|
+
f.set(n, r), p = n;
|
|
1366
|
+
const a = Bt(n, typeof o == "boolean" ? o : void 0);
|
|
1367
|
+
return ot(n) && y(n, r, !1), a;
|
|
1349
1368
|
},
|
|
1350
|
-
insertCitation: (
|
|
1351
|
-
const
|
|
1352
|
-
if (!
|
|
1353
|
-
const r = f.get(
|
|
1354
|
-
f.set(
|
|
1355
|
-
const a =
|
|
1356
|
-
return a &&
|
|
1369
|
+
insertCitation: (o, i) => {
|
|
1370
|
+
const n = h(i);
|
|
1371
|
+
if (!n || $(n) || !o || typeof o != "object") return !1;
|
|
1372
|
+
const r = f.get(n) || e;
|
|
1373
|
+
f.set(n, r), p = n;
|
|
1374
|
+
const a = nt(n, o, r);
|
|
1375
|
+
return a && I(n), a;
|
|
1357
1376
|
},
|
|
1358
|
-
refreshCitations: (
|
|
1359
|
-
const
|
|
1360
|
-
if (!
|
|
1361
|
-
const r = f.get(
|
|
1362
|
-
return f.set(
|
|
1377
|
+
refreshCitations: (o, i) => {
|
|
1378
|
+
const n = h(i);
|
|
1379
|
+
if (!n) return !1;
|
|
1380
|
+
const r = f.get(n) || e;
|
|
1381
|
+
return f.set(n, r), p = n, y(n, r, !0), I(n), !0;
|
|
1363
1382
|
},
|
|
1364
|
-
setCitationStyle: (
|
|
1365
|
-
const
|
|
1366
|
-
if (!
|
|
1367
|
-
const r = f.get(
|
|
1368
|
-
return f.set(
|
|
1383
|
+
setCitationStyle: (o, i) => {
|
|
1384
|
+
const n = h(i);
|
|
1385
|
+
if (!n || !o) return !1;
|
|
1386
|
+
const r = f.get(n) || e;
|
|
1387
|
+
return f.set(n, r), p = n, It(n, o, r), !0;
|
|
1369
1388
|
},
|
|
1370
|
-
cycleCitationStyle: (
|
|
1371
|
-
const
|
|
1372
|
-
if (!
|
|
1373
|
-
const r = f.get(
|
|
1374
|
-
return f.set(
|
|
1389
|
+
cycleCitationStyle: (o, i) => {
|
|
1390
|
+
const n = h(i);
|
|
1391
|
+
if (!n) return !1;
|
|
1392
|
+
const r = f.get(n) || e;
|
|
1393
|
+
return f.set(n, r), p = n, gt(n, r), F(n), !0;
|
|
1375
1394
|
},
|
|
1376
|
-
getCitationRecords: (
|
|
1377
|
-
const
|
|
1378
|
-
if (!
|
|
1379
|
-
const r = f.get(
|
|
1380
|
-
if (typeof
|
|
1395
|
+
getCitationRecords: (o, i) => {
|
|
1396
|
+
const n = h(i);
|
|
1397
|
+
if (!n) return !1;
|
|
1398
|
+
const r = f.get(n) || e, a = U(n, r);
|
|
1399
|
+
if (typeof o == "function")
|
|
1381
1400
|
try {
|
|
1382
|
-
|
|
1401
|
+
o(a);
|
|
1383
1402
|
} catch {
|
|
1384
1403
|
}
|
|
1385
|
-
return
|
|
1404
|
+
return n.__citationRecords = a, n.dispatchEvent(
|
|
1386
1405
|
new CustomEvent("editora:citations-data", {
|
|
1387
1406
|
bubbles: !0,
|
|
1388
1407
|
detail: {
|
|
1389
1408
|
records: a,
|
|
1390
|
-
style:
|
|
1409
|
+
style: z(n, r)
|
|
1391
1410
|
}
|
|
1392
1411
|
})
|
|
1393
1412
|
), !0;
|
|
1394
1413
|
},
|
|
1395
|
-
setCitationsOptions: (
|
|
1396
|
-
const
|
|
1397
|
-
if (!
|
|
1398
|
-
const r = f.get(
|
|
1414
|
+
setCitationsOptions: (o, i) => {
|
|
1415
|
+
const n = h(i);
|
|
1416
|
+
if (!n || !o || typeof o != "object") return !1;
|
|
1417
|
+
const r = f.get(n) || e, a = Q({
|
|
1399
1418
|
...r,
|
|
1400
|
-
...
|
|
1419
|
+
...o,
|
|
1401
1420
|
labels: {
|
|
1402
1421
|
...r.labels,
|
|
1403
|
-
...
|
|
1422
|
+
...o.labels || {}
|
|
1404
1423
|
},
|
|
1405
|
-
normalizeText:
|
|
1406
|
-
generateCitationId:
|
|
1424
|
+
normalizeText: o.normalizeText || r.normalizeText,
|
|
1425
|
+
generateCitationId: o.generateCitationId || r.generateCitationId
|
|
1407
1426
|
});
|
|
1408
|
-
return f.set(
|
|
1427
|
+
return f.set(n, a), o.defaultStyle && L.includes(o.defaultStyle) && T.set(n, o.defaultStyle), y(n, a, !0), F(n), !0;
|
|
1409
1428
|
},
|
|
1410
|
-
locateCitation: (
|
|
1411
|
-
const
|
|
1412
|
-
return !
|
|
1429
|
+
locateCitation: (o, i) => {
|
|
1430
|
+
const n = h(i);
|
|
1431
|
+
return !n || typeof o != "string" ? !1 : te(n, o);
|
|
1413
1432
|
},
|
|
1414
|
-
deleteCitation: (
|
|
1415
|
-
const
|
|
1416
|
-
if (!
|
|
1417
|
-
const r = f.get(
|
|
1418
|
-
return f.set(
|
|
1433
|
+
deleteCitation: (o, i) => {
|
|
1434
|
+
const n = h(i);
|
|
1435
|
+
if (!n || $(n)) return !1;
|
|
1436
|
+
const r = f.get(n) || e;
|
|
1437
|
+
return f.set(n, r), typeof o == "string" && o.trim() ? Nt(n, o, r) : Qt(n, r);
|
|
1419
1438
|
},
|
|
1420
|
-
insertRecentCitation: (
|
|
1421
|
-
const
|
|
1422
|
-
if (!
|
|
1423
|
-
const r = f.get(
|
|
1424
|
-
f.set(
|
|
1425
|
-
const a =
|
|
1439
|
+
insertRecentCitation: (o, i) => {
|
|
1440
|
+
const n = h(i);
|
|
1441
|
+
if (!n || $(n)) return !1;
|
|
1442
|
+
const r = f.get(n) || e;
|
|
1443
|
+
f.set(n, r);
|
|
1444
|
+
const a = U(n, r), s = at(n, a, r);
|
|
1426
1445
|
if (s.length === 0) return !1;
|
|
1427
|
-
const u = typeof
|
|
1446
|
+
const u = typeof o == "string" && o.trim() ? $t(n, o, a, r) : s[0];
|
|
1428
1447
|
if (!u) return !1;
|
|
1429
|
-
const c =
|
|
1430
|
-
return c &&
|
|
1448
|
+
const c = nt(n, u, r);
|
|
1449
|
+
return c && I(n), c;
|
|
1431
1450
|
}
|
|
1432
1451
|
},
|
|
1433
1452
|
keymap: {
|
|
@@ -1439,22 +1458,22 @@ const ue = (t = {}) => {
|
|
|
1439
1458
|
"Mod-Alt-Shift-J": "cycleCitationStyle"
|
|
1440
1459
|
},
|
|
1441
1460
|
init: function(i) {
|
|
1442
|
-
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1461
|
+
X += 1;
|
|
1462
|
+
const n = this && typeof this.__pluginConfig == "object" ? Q({ ...e, ...this.__pluginConfig }) : e;
|
|
1463
|
+
ce(n);
|
|
1445
1464
|
const r = h(
|
|
1446
1465
|
i && i.editorElement ? { editorElement: i.editorElement } : void 0,
|
|
1447
1466
|
!1
|
|
1448
1467
|
);
|
|
1449
|
-
r && (p = r, f.set(r,
|
|
1468
|
+
r && (p = r, f.set(r, n), T.set(r, n.defaultStyle), rt(r, "toggleCitationsPanel", !1), Mt(r));
|
|
1450
1469
|
},
|
|
1451
1470
|
destroy: () => {
|
|
1452
|
-
|
|
1453
|
-
window.clearTimeout(
|
|
1454
|
-
}),
|
|
1471
|
+
X = Math.max(0, X - 1), !(X > 0) && (K.forEach((o) => {
|
|
1472
|
+
window.clearTimeout(o);
|
|
1473
|
+
}), K.clear(), le());
|
|
1455
1474
|
}
|
|
1456
1475
|
};
|
|
1457
1476
|
};
|
|
1458
1477
|
export {
|
|
1459
|
-
|
|
1478
|
+
de as CitationsPlugin
|
|
1460
1479
|
};
|