@editora/plugins 1.0.9 → 1.0.10
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/README.md +5 -0
- package/dist/_commonjsHelpers-6763f629.js +1 -0
- package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +98 -80
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +128 -115
- package/dist/anchoredPopover-33f1358d.mjs +109 -0
- package/dist/anchoredPopover-8151d535.js +1 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +249 -208
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +68 -55
- package/dist/blockquote.esm.js +2 -1
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +245 -178
- package/dist/capitalization.esm.js +2 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +82 -58
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +512 -439
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +33 -27
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +93 -82
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +653 -594
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +158 -116
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +432 -371
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +159 -105
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +368 -328
- package/dist/direction.esm.js +18 -9
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +308 -240
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +5 -4
- package/dist/documentManager-25b6203c.mjs +9122 -0
- package/dist/documentManager-b69e7054.js +17 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +81 -73
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +77 -65
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +56 -54
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +47 -39
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +53 -37
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +117 -76
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +92 -70
- package/dist/html2canvas.esm-09133e29.js +22 -0
- package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +24 -12
- package/dist/index-656d224b.js +231 -0
- package/dist/index-6a8c48bb.js +1 -0
- package/dist/index-d027b7e2.mjs +16859 -0
- package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-730f2d98.mjs +5775 -0
- package/dist/index.es-dd40173b.js +18 -0
- package/dist/index.esm.js +128 -125
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +9 -8
- package/dist/jspdf.es.min-90db2c97.js +243 -0
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +24 -11
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +30 -24
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +25 -20
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +61 -59
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +146 -139
- package/dist/media-manager.cjs.js +38 -38
- package/dist/media-manager.esm.js +325 -308
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +286 -238
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +216 -177
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +49 -33
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +463 -393
- package/dist/preview.esm.js +10 -5
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +20 -17
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
- package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
- package/dist/slash-commands.cjs.js +3 -3
- package/dist/slash-commands.esm.js +212 -176
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +336 -280
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +69 -61
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +123 -97
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +19 -14
- package/dist/style.css +1 -0
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +225 -191
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +153 -124
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +27 -21
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +87 -70
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +162 -100
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +678 -602
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +157 -128
- package/package.json +13 -7
- package/LICENSE +0 -21
- package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
- package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/documentManager-CTqRftU8.mjs +0 -8369
- package/dist/documentManager-Jf0RbSks.js +0 -17
- package/dist/html2canvas.esm-B5qzocYs.js +0 -5
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-D3CycEFU.mjs +0 -16543
- package/dist/index-tqLTHcO6.js +0 -1
- package/dist/index.es-CE_A4QSm.js +0 -5
- package/dist/index.es-DQ78mYYo.mjs +0 -6665
- package/dist/jspdf.es.min-BoS80556.js +0 -77
- package/dist/plugins.css +0 -1
- /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
package/dist/citations.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const $ = ".rte-content, .editora-content", gt = "rte-citations-styles", m = "rte-citations-panel", ot = ".rte-citation-ref[data-citation-id]", W = '.rte-citation-bibliography[data-type="citation-bibliography"]', G = '.rte-citation-footnotes[data-type="citation-footnotes"]', x = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', L = ["apa", "mla", "chicago"], Bt = {
|
|
2
2
|
panelTitle: "Citations",
|
|
3
3
|
panelAriaLabel: "Citations panel",
|
|
4
4
|
styleLabel: "Citation style",
|
|
@@ -27,41 +27,42 @@ function g(t) {
|
|
|
27
27
|
function Pt(t) {
|
|
28
28
|
return t.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
29
29
|
}
|
|
30
|
-
function ht(t,
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
function ht(t, n) {
|
|
31
|
+
const e = n(t);
|
|
32
|
+
if (!e)
|
|
33
|
+
return "";
|
|
34
|
+
const i = e.match(/\d{4}/);
|
|
35
|
+
return i ? i[0] : e;
|
|
35
36
|
}
|
|
36
|
-
function xt(t,
|
|
37
|
-
const
|
|
38
|
-
return
|
|
37
|
+
function xt(t, n) {
|
|
38
|
+
const e = n(t);
|
|
39
|
+
return e ? /^https?:\/\//i.test(e) ? e : `https://${e}` : "";
|
|
39
40
|
}
|
|
40
41
|
function F(t) {
|
|
41
42
|
return t.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
|
|
42
43
|
}
|
|
43
|
-
function yt(t,
|
|
44
|
+
function yt(t, n) {
|
|
44
45
|
return {
|
|
45
|
-
id: F(
|
|
46
|
-
author:
|
|
47
|
-
year: ht(t.year || "",
|
|
48
|
-
title:
|
|
49
|
-
source:
|
|
50
|
-
url: xt(t.url || "",
|
|
51
|
-
note:
|
|
46
|
+
id: F(n.normalizeText(t.id || "")),
|
|
47
|
+
author: n.normalizeText(t.author || ""),
|
|
48
|
+
year: ht(t.year || "", n.normalizeText) || void 0,
|
|
49
|
+
title: n.normalizeText(t.title || ""),
|
|
50
|
+
source: n.normalizeText(t.source || "") || void 0,
|
|
51
|
+
url: xt(t.url || "", n.normalizeText) || void 0,
|
|
52
|
+
note: n.normalizeText(t.note || "") || void 0
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
function Z(t = {}) {
|
|
55
|
-
const
|
|
56
|
+
const n = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", e = {
|
|
56
57
|
...Bt,
|
|
57
58
|
...t.labels || {}
|
|
58
59
|
};
|
|
59
60
|
return {
|
|
60
|
-
defaultStyle:
|
|
61
|
+
defaultStyle: n,
|
|
61
62
|
enableFootnoteSync: t.enableFootnoteSync !== !1,
|
|
62
63
|
debounceMs: Math.max(80, Number(t.debounceMs ?? 220)),
|
|
63
64
|
maxRecentCitations: Math.max(3, Math.min(30, Number(t.maxRecentCitations ?? 8))),
|
|
64
|
-
labels:
|
|
65
|
+
labels: e,
|
|
65
66
|
normalizeText: t.normalizeText || Pt,
|
|
66
67
|
generateCitationId: typeof t.generateCitationId == "function" ? t.generateCitationId : void 0
|
|
67
68
|
};
|
|
@@ -76,72 +77,80 @@ function X(t) {
|
|
|
76
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;
|
|
77
78
|
}
|
|
78
79
|
function Dt(t) {
|
|
79
|
-
const
|
|
80
|
-
if (X(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (t
|
|
80
|
+
const n = lt(t);
|
|
81
|
+
if (X(n))
|
|
82
|
+
return !0;
|
|
83
|
+
const e = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
84
|
+
return X(e) ? !0 : X(document.documentElement) || X(document.body);
|
|
85
|
+
}
|
|
86
|
+
function tt(t, n) {
|
|
87
|
+
t.classList.remove("rte-citations-theme-dark"), Dt(n) && t.classList.add("rte-citations-theme-dark");
|
|
88
|
+
}
|
|
89
|
+
function h(t, n = !0) {
|
|
90
|
+
if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement)
|
|
91
|
+
return t.contentElement;
|
|
92
|
+
if ((t == null ? void 0 : t.editorElement) instanceof HTMLElement) {
|
|
90
93
|
const o = t.editorElement;
|
|
91
|
-
if (o.matches(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
if (o.matches($))
|
|
95
|
+
return o;
|
|
96
|
+
const r = o.querySelector($);
|
|
97
|
+
if (r instanceof HTMLElement)
|
|
98
|
+
return r;
|
|
94
99
|
}
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
const o =
|
|
98
|
-
if (a)
|
|
100
|
+
const e = window.getSelection();
|
|
101
|
+
if (e && e.rangeCount > 0) {
|
|
102
|
+
const o = e.getRangeAt(0).startContainer, r = Ct(o), a = r == null ? void 0 : r.closest($);
|
|
103
|
+
if (a)
|
|
104
|
+
return a;
|
|
99
105
|
}
|
|
100
106
|
const i = document.activeElement;
|
|
101
107
|
if (i) {
|
|
102
|
-
if (i.matches(
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
if (i.matches($))
|
|
109
|
+
return i;
|
|
110
|
+
const o = i.closest($);
|
|
111
|
+
if (o)
|
|
112
|
+
return o;
|
|
105
113
|
}
|
|
106
|
-
return p && p.isConnected ? p : (p && !p.isConnected && (p = null),
|
|
114
|
+
return p && p.isConnected ? p : (p && !p.isConnected && (p = null), n ? document.querySelector($) : null);
|
|
107
115
|
}
|
|
108
|
-
function
|
|
116
|
+
function S(t) {
|
|
109
117
|
return t.getAttribute("contenteditable") === "false" || t.getAttribute("data-readonly") === "true";
|
|
110
118
|
}
|
|
111
119
|
function j(t) {
|
|
112
|
-
const
|
|
113
|
-
return
|
|
114
|
-
}
|
|
115
|
-
function Ht(t,
|
|
116
|
-
if (at += 1,
|
|
117
|
-
const
|
|
118
|
-
if (i)
|
|
120
|
+
const n = Ct(t);
|
|
121
|
+
return n ? !!(n.closest(W) || n.closest(G)) : !1;
|
|
122
|
+
}
|
|
123
|
+
function Ht(t, n) {
|
|
124
|
+
if (at += 1, n.generateCitationId) {
|
|
125
|
+
const e = n.generateCitationId({ editor: t, index: at }), i = F(n.normalizeText(e || ""));
|
|
126
|
+
if (i)
|
|
127
|
+
return i;
|
|
119
128
|
}
|
|
120
129
|
return `cite-${Date.now().toString(36)}-${at.toString(36)}`;
|
|
121
130
|
}
|
|
122
131
|
function st(t) {
|
|
123
|
-
return t.map((
|
|
132
|
+
return t.map((n) => (n || "").trim()).filter(Boolean).join(" ").trim();
|
|
124
133
|
}
|
|
125
|
-
function Ft(t,
|
|
126
|
-
const
|
|
127
|
-
return
|
|
134
|
+
function Ft(t, n) {
|
|
135
|
+
const e = t.author || "Unknown", i = t.year || "n.d.";
|
|
136
|
+
return n === "mla" ? `(${e} ${i})` : n === "chicago" ? `(${e} ${i})` : `(${e}, ${i})`;
|
|
128
137
|
}
|
|
129
|
-
function ut(t,
|
|
130
|
-
const
|
|
131
|
-
return st(
|
|
132
|
-
`${
|
|
138
|
+
function ut(t, n) {
|
|
139
|
+
const e = t.author || "Unknown", i = t.year || "n.d.", o = t.title || "Untitled", r = t.source || "", a = t.url || "";
|
|
140
|
+
return st(n === "mla" ? [
|
|
141
|
+
`${e}.`,
|
|
133
142
|
`"${o}."`,
|
|
134
143
|
r ? `${r},` : "",
|
|
135
144
|
`${i}.`,
|
|
136
145
|
a
|
|
137
|
-
] :
|
|
138
|
-
`${
|
|
146
|
+
] : n === "chicago" ? [
|
|
147
|
+
`${e}.`,
|
|
139
148
|
`${o}.`,
|
|
140
149
|
r ? `${r}.` : "",
|
|
141
150
|
`(${i}).`,
|
|
142
151
|
a
|
|
143
152
|
] : [
|
|
144
|
-
`${
|
|
153
|
+
`${e}.`,
|
|
145
154
|
`(${i}).`,
|
|
146
155
|
`${o}.`,
|
|
147
156
|
r ? `${r}.` : "",
|
|
@@ -150,45 +159,47 @@ function ut(t, e) {
|
|
|
150
159
|
}
|
|
151
160
|
function R(t) {
|
|
152
161
|
return Array.from(t.querySelectorAll(ot)).filter(
|
|
153
|
-
(
|
|
162
|
+
(n) => !n.closest(W) && !n.closest(G)
|
|
154
163
|
);
|
|
155
164
|
}
|
|
156
|
-
function wt(t,
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
159
|
-
|
|
165
|
+
function wt(t, n) {
|
|
166
|
+
const e = F(n.normalizeText(t.getAttribute("data-citation-id") || ""));
|
|
167
|
+
if (!e)
|
|
168
|
+
return null;
|
|
169
|
+
const i = n.normalizeText(t.getAttribute("data-citation-author") || ""), o = n.normalizeText(t.getAttribute("data-citation-title") || "");
|
|
160
170
|
return {
|
|
161
|
-
id:
|
|
171
|
+
id: e,
|
|
162
172
|
author: i || "Unknown",
|
|
163
|
-
year: ht(t.getAttribute("data-citation-year") || "",
|
|
173
|
+
year: ht(t.getAttribute("data-citation-year") || "", n.normalizeText) || void 0,
|
|
164
174
|
title: o || "Untitled",
|
|
165
|
-
source:
|
|
166
|
-
url: xt(t.getAttribute("data-citation-url") || "",
|
|
167
|
-
note:
|
|
175
|
+
source: n.normalizeText(t.getAttribute("data-citation-source") || "") || void 0,
|
|
176
|
+
url: xt(t.getAttribute("data-citation-url") || "", n.normalizeText) || void 0,
|
|
177
|
+
note: n.normalizeText(t.getAttribute("data-citation-note") || "") || void 0
|
|
168
178
|
};
|
|
169
179
|
}
|
|
170
|
-
function vt(t,
|
|
171
|
-
t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id",
|
|
180
|
+
function vt(t, n, e) {
|
|
181
|
+
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 = Ft(n, e);
|
|
172
182
|
}
|
|
173
|
-
function it(t,
|
|
183
|
+
function it(t, n, e) {
|
|
174
184
|
const i = lt(t);
|
|
175
185
|
Array.from(
|
|
176
186
|
i.querySelectorAll(
|
|
177
|
-
`.rte-toolbar-button[data-command="${
|
|
187
|
+
`.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`
|
|
178
188
|
)
|
|
179
189
|
).forEach((r) => {
|
|
180
|
-
r.classList.toggle("active",
|
|
190
|
+
r.classList.toggle("active", e), r.setAttribute("data-active", e ? "true" : "false"), r.setAttribute("aria-pressed", e ? "true" : "false");
|
|
181
191
|
});
|
|
182
192
|
}
|
|
183
|
-
function N(t,
|
|
184
|
-
const
|
|
185
|
-
return
|
|
193
|
+
function N(t, n) {
|
|
194
|
+
const e = T.get(t);
|
|
195
|
+
return e && L.includes(e) ? e : (n == null ? void 0 : n.defaultStyle) || "apa";
|
|
186
196
|
}
|
|
187
|
-
function K(t,
|
|
188
|
-
const
|
|
189
|
-
return
|
|
190
|
-
const r = wt(o,
|
|
191
|
-
if (!r)
|
|
197
|
+
function K(t, n) {
|
|
198
|
+
const e = R(t), i = /* @__PURE__ */ new Map();
|
|
199
|
+
return e.forEach((o) => {
|
|
200
|
+
const r = wt(o, n);
|
|
201
|
+
if (!r)
|
|
202
|
+
return;
|
|
192
203
|
if (!i.has(r.id)) {
|
|
193
204
|
i.set(r.id, r);
|
|
194
205
|
return;
|
|
@@ -205,137 +216,145 @@ function K(t, e) {
|
|
|
205
216
|
});
|
|
206
217
|
}), Array.from(i.values());
|
|
207
218
|
}
|
|
208
|
-
function _t(t,
|
|
209
|
-
const i = yt(
|
|
210
|
-
if (!i.id || !i.author || !i.title)
|
|
219
|
+
function _t(t, n, e) {
|
|
220
|
+
const i = yt(n, e);
|
|
221
|
+
if (!i.id || !i.author || !i.title)
|
|
222
|
+
return;
|
|
211
223
|
const r = (D.get(t) || []).filter((a) => a.id !== i.id);
|
|
212
|
-
D.set(t, [i, ...r].slice(0,
|
|
224
|
+
D.set(t, [i, ...r].slice(0, e.maxRecentCitations));
|
|
213
225
|
}
|
|
214
|
-
function rt(t,
|
|
226
|
+
function rt(t, n, e) {
|
|
215
227
|
const i = D.get(t) || [], o = /* @__PURE__ */ new Map();
|
|
216
|
-
|
|
228
|
+
n.slice(Math.max(0, n.length - e.maxRecentCitations)).reverse().forEach((a) => {
|
|
217
229
|
a.id && o.set(a.id, a);
|
|
218
230
|
}), i.forEach((a) => {
|
|
219
231
|
!a.id || o.has(a.id) || o.set(a.id, a);
|
|
220
232
|
});
|
|
221
|
-
const r = Array.from(o.values()).slice(0,
|
|
233
|
+
const r = Array.from(o.values()).slice(0, e.maxRecentCitations);
|
|
222
234
|
return D.set(t, r), r;
|
|
223
235
|
}
|
|
224
|
-
function Et(t,
|
|
225
|
-
const o = F(i.normalizeText(
|
|
226
|
-
return o && rt(t,
|
|
236
|
+
function Et(t, n, e, i) {
|
|
237
|
+
const o = F(i.normalizeText(n || ""));
|
|
238
|
+
return o && rt(t, e, i).find((a) => a.id === o) || null;
|
|
227
239
|
}
|
|
228
|
-
function qt(t,
|
|
229
|
-
const i = F(
|
|
230
|
-
if (!i)
|
|
240
|
+
function qt(t, n, e) {
|
|
241
|
+
const i = F(e.normalizeText(n || ""));
|
|
242
|
+
if (!i)
|
|
243
|
+
return !1;
|
|
231
244
|
const o = D.get(t) || [], r = o.filter((a) => a.id !== i);
|
|
232
245
|
return r.length === o.length ? !1 : (D.set(t, r), !0);
|
|
233
246
|
}
|
|
234
|
-
function
|
|
247
|
+
function $t(t, n, e) {
|
|
235
248
|
const i = document.createElement("section");
|
|
236
|
-
i.className = t, i.setAttribute("data-type",
|
|
249
|
+
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");
|
|
237
250
|
const o = document.createElement("h3");
|
|
238
|
-
o.className = "rte-citation-section-title", o.textContent =
|
|
251
|
+
o.className = "rte-citation-section-title", o.textContent = e;
|
|
239
252
|
const r = document.createElement("ol");
|
|
240
253
|
return r.className = "rte-citation-list", r.setAttribute("role", "list"), i.appendChild(o), i.appendChild(r), i;
|
|
241
254
|
}
|
|
242
|
-
function jt(t,
|
|
243
|
-
let
|
|
244
|
-
|
|
245
|
-
const i =
|
|
246
|
-
return i && (i.textContent =
|
|
247
|
-
}
|
|
248
|
-
function Kt(t,
|
|
249
|
-
let
|
|
250
|
-
|
|
251
|
-
const i =
|
|
252
|
-
return i && (i.textContent =
|
|
253
|
-
}
|
|
254
|
-
function
|
|
255
|
-
t.querySelector(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
255
|
+
function jt(t, n) {
|
|
256
|
+
let e = t.querySelector(W);
|
|
257
|
+
e || (e = $t("rte-citation-bibliography", "citation-bibliography", n.labels.bibliographyTitle), t.appendChild(e));
|
|
258
|
+
const i = e.querySelector(".rte-citation-section-title");
|
|
259
|
+
return i && (i.textContent = n.labels.bibliographyTitle), e.setAttribute("aria-label", n.labels.bibliographyTitle), e;
|
|
260
|
+
}
|
|
261
|
+
function Kt(t, n) {
|
|
262
|
+
let e = t.querySelector(G);
|
|
263
|
+
e || (e = $t("rte-citation-footnotes", "citation-footnotes", n.labels.footnotesTitle), t.appendChild(e));
|
|
264
|
+
const i = e.querySelector(".rte-citation-section-title");
|
|
265
|
+
return i && (i.textContent = n.labels.footnotesTitle), e.setAttribute("aria-label", n.labels.footnotesTitle), e;
|
|
266
|
+
}
|
|
267
|
+
function St(t, n) {
|
|
268
|
+
const e = t.querySelector(n);
|
|
269
|
+
e == null || e.remove();
|
|
270
|
+
}
|
|
271
|
+
function Ut(t, n, e, i) {
|
|
272
|
+
if (n.length === 0) {
|
|
273
|
+
St(t, W);
|
|
260
274
|
return;
|
|
261
275
|
}
|
|
262
|
-
const r = jt(t,
|
|
263
|
-
if (!r)
|
|
276
|
+
const r = jt(t, e).querySelector(".rte-citation-list");
|
|
277
|
+
if (!r)
|
|
278
|
+
return;
|
|
264
279
|
const a = document.createDocumentFragment();
|
|
265
|
-
|
|
280
|
+
n.forEach((s, d) => {
|
|
266
281
|
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(
|
|
282
|
+
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 = ut(s, i), a.appendChild(c);
|
|
268
283
|
}), r.innerHTML = "", r.appendChild(a);
|
|
269
284
|
}
|
|
270
|
-
function Wt(t,
|
|
271
|
-
if (!
|
|
272
|
-
|
|
285
|
+
function Wt(t, n, e, i) {
|
|
286
|
+
if (!e.enableFootnoteSync || n.length === 0) {
|
|
287
|
+
St(t, G), R(t).forEach((l) => {
|
|
273
288
|
l.removeAttribute("data-footnote-number"), l.removeAttribute("data-footnote-target");
|
|
274
289
|
});
|
|
275
290
|
return;
|
|
276
291
|
}
|
|
277
|
-
const r = Kt(t,
|
|
278
|
-
if (!r)
|
|
292
|
+
const r = Kt(t, e).querySelector(".rte-citation-list");
|
|
293
|
+
if (!r)
|
|
294
|
+
return;
|
|
279
295
|
const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
280
|
-
|
|
281
|
-
s.set(l.id,
|
|
296
|
+
n.forEach((l, u) => {
|
|
297
|
+
s.set(l.id, u + 1);
|
|
282
298
|
});
|
|
283
|
-
const
|
|
299
|
+
const d = /* @__PURE__ */ new Map();
|
|
284
300
|
R(t).forEach((l) => {
|
|
285
|
-
const
|
|
286
|
-
if (!
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
301
|
+
const u = l.getAttribute("data-citation-id") || "";
|
|
302
|
+
if (!u || !s.has(u))
|
|
303
|
+
return;
|
|
304
|
+
const b = (d.get(u) || 0) + 1;
|
|
305
|
+
d.set(u, b);
|
|
306
|
+
const w = `rte-citation-ref-${u}-${b}`;
|
|
290
307
|
l.id = w;
|
|
291
|
-
const A = s.get(
|
|
292
|
-
l.setAttribute("data-footnote-number", String(A)), l.setAttribute("data-footnote-target", `rte-citation-note-${
|
|
308
|
+
const A = s.get(u);
|
|
309
|
+
l.setAttribute("data-footnote-number", String(A)), l.setAttribute("data-footnote-target", `rte-citation-note-${u}`), a.has(u) || a.set(u, w);
|
|
293
310
|
});
|
|
294
311
|
const c = document.createDocumentFragment();
|
|
295
|
-
|
|
296
|
-
const
|
|
297
|
-
|
|
312
|
+
n.forEach((l, u) => {
|
|
313
|
+
const b = document.createElement("li");
|
|
314
|
+
b.className = "rte-citation-item rte-citation-footnote-item", b.id = `rte-citation-note-${l.id}`, b.setAttribute("data-citation-id", l.id);
|
|
298
315
|
const w = document.createElement("span");
|
|
299
|
-
w.className = "rte-citation-footnote-number", w.textContent = `${
|
|
316
|
+
w.className = "rte-citation-footnote-number", w.textContent = `${u + 1}. `;
|
|
300
317
|
const A = document.createElement("span");
|
|
301
318
|
A.className = "rte-citation-footnote-text";
|
|
302
319
|
const It = l.note ? `${l.note}. ` : "";
|
|
303
|
-
A.textContent = `${It}${ut(l, i)}`,
|
|
304
|
-
const
|
|
305
|
-
if (
|
|
320
|
+
A.textContent = `${It}${ut(l, i)}`, b.appendChild(w), b.appendChild(A);
|
|
321
|
+
const mt = a.get(l.id);
|
|
322
|
+
if (mt) {
|
|
306
323
|
const _ = document.createElement("a");
|
|
307
|
-
_.className = "rte-citation-backref", _.href = `#${
|
|
324
|
+
_.className = "rte-citation-backref", _.href = `#${mt}`, _.setAttribute("aria-label", `Back to citation ${u + 1}`), _.textContent = "Back", b.appendChild(_);
|
|
308
325
|
}
|
|
309
|
-
c.appendChild(
|
|
326
|
+
c.appendChild(b);
|
|
310
327
|
}), r.innerHTML = "", r.appendChild(c);
|
|
311
328
|
}
|
|
312
|
-
function Gt(t,
|
|
313
|
-
const o = ut(
|
|
329
|
+
function Gt(t, n, e, i) {
|
|
330
|
+
const o = ut(n, e);
|
|
314
331
|
t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${o}`);
|
|
315
332
|
}
|
|
316
|
-
function Vt(t,
|
|
333
|
+
function Vt(t, n, e) {
|
|
317
334
|
const i = R(t);
|
|
318
|
-
let o = `${
|
|
335
|
+
let o = `${n}:${e ? "1" : "0"}:${i.length}`;
|
|
319
336
|
return i.forEach((r) => {
|
|
320
337
|
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") || ""}`;
|
|
321
338
|
}), o;
|
|
322
339
|
}
|
|
323
340
|
function H(t) {
|
|
324
|
-
const
|
|
325
|
-
if (!
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
341
|
+
const n = v.get(t);
|
|
342
|
+
if (!n)
|
|
343
|
+
return;
|
|
344
|
+
const e = f.get(t) || M;
|
|
345
|
+
if (!e)
|
|
346
|
+
return;
|
|
347
|
+
const i = N(t, e), o = K(t, e), r = rt(t, o, e), a = n.querySelector(".rte-citations-status"), s = n.querySelector('[data-action="cycle-style"]'), d = n.querySelector(".rte-citations-recent-list");
|
|
329
348
|
if (a) {
|
|
330
349
|
const c = o.length;
|
|
331
|
-
a.textContent = `${
|
|
350
|
+
a.textContent = `${e.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${e.enableFootnoteSync ? "On" : "Off"}`;
|
|
332
351
|
}
|
|
333
|
-
if (s && (s.textContent = `${
|
|
352
|
+
if (s && (s.textContent = `${e.labels.styleButtonPrefix}: ${i.toUpperCase()}`, s.setAttribute("aria-label", `${e.labels.styleButtonPrefix}: ${i.toUpperCase()}`)), d) {
|
|
334
353
|
if (r.length === 0) {
|
|
335
|
-
|
|
354
|
+
d.innerHTML = `<li class="rte-citations-empty">${g(e.labels.noCitationsText)}</li>`;
|
|
336
355
|
return;
|
|
337
356
|
}
|
|
338
|
-
|
|
357
|
+
d.innerHTML = r.map(
|
|
339
358
|
(c) => `
|
|
340
359
|
<li class="rte-citations-recent-item">
|
|
341
360
|
<div class="rte-citations-recent-row">
|
|
@@ -355,191 +374,211 @@ function H(t) {
|
|
|
355
374
|
data-action="delete-by-id"
|
|
356
375
|
data-citation-id="${g(c.id)}"
|
|
357
376
|
aria-label="Delete citation: ${g(c.title)}"
|
|
358
|
-
>${g(
|
|
377
|
+
>${g(e.labels.deleteRecentText)}</button>
|
|
359
378
|
</div>
|
|
360
379
|
</li>
|
|
361
380
|
`
|
|
362
381
|
).join("");
|
|
363
382
|
}
|
|
364
383
|
}
|
|
365
|
-
function y(t,
|
|
366
|
-
const i = N(t,
|
|
367
|
-
if (!
|
|
368
|
-
return K(t,
|
|
384
|
+
function y(t, n, e = !1) {
|
|
385
|
+
const i = N(t, n), o = Vt(t, i, n.enableFootnoteSync);
|
|
386
|
+
if (!e && pt.get(t) === o)
|
|
387
|
+
return K(t, n);
|
|
369
388
|
const r = R(t), a = /* @__PURE__ */ new Map();
|
|
370
389
|
r.forEach((c) => {
|
|
371
|
-
const l = wt(c,
|
|
390
|
+
const l = wt(c, n);
|
|
372
391
|
l && (a.has(l.id) || a.set(l.id, l));
|
|
373
392
|
});
|
|
374
393
|
const s = Array.from(a.values());
|
|
375
|
-
rt(t, s,
|
|
376
|
-
const
|
|
394
|
+
rt(t, s, n);
|
|
395
|
+
const d = /* @__PURE__ */ new Map();
|
|
377
396
|
return s.forEach((c, l) => {
|
|
378
|
-
|
|
397
|
+
d.set(c.id, l + 1);
|
|
379
398
|
}), r.forEach((c) => {
|
|
380
|
-
const l = c.getAttribute("data-citation-id") || "",
|
|
381
|
-
if (!
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
399
|
+
const l = c.getAttribute("data-citation-id") || "", u = a.get(l);
|
|
400
|
+
if (!u)
|
|
401
|
+
return;
|
|
402
|
+
vt(c, u, i);
|
|
403
|
+
const b = d.get(u.id) || 1;
|
|
404
|
+
Gt(c, u, i, Math.max(1, b));
|
|
405
|
+
}), Ut(t, s, n, i), Wt(t, s, n, i), pt.set(t, o), H(t), t.dispatchEvent(
|
|
386
406
|
new CustomEvent("editora:citations-refreshed", {
|
|
387
407
|
bubbles: !0,
|
|
388
408
|
detail: {
|
|
389
409
|
citations: s,
|
|
390
410
|
style: i,
|
|
391
|
-
footnoteSync:
|
|
411
|
+
footnoteSync: n.enableFootnoteSync
|
|
392
412
|
}
|
|
393
413
|
})
|
|
394
414
|
), s;
|
|
395
415
|
}
|
|
396
416
|
function At(t) {
|
|
397
|
-
const
|
|
398
|
-
typeof
|
|
417
|
+
const n = Q.get(t);
|
|
418
|
+
typeof n == "number" && (window.clearTimeout(n), q.delete(n), Q.delete(t));
|
|
399
419
|
}
|
|
400
420
|
function kt(t) {
|
|
401
|
-
const
|
|
402
|
-
if (!
|
|
421
|
+
const n = f.get(t) || M;
|
|
422
|
+
if (!n)
|
|
423
|
+
return;
|
|
403
424
|
At(t);
|
|
404
|
-
const
|
|
405
|
-
q.delete(
|
|
406
|
-
},
|
|
407
|
-
q.add(
|
|
425
|
+
const e = window.setTimeout(() => {
|
|
426
|
+
q.delete(e), Q.delete(t), y(t, n, !1);
|
|
427
|
+
}, n.debounceMs);
|
|
428
|
+
q.add(e), Q.set(t, e);
|
|
408
429
|
}
|
|
409
430
|
function Yt(t) {
|
|
410
|
-
const
|
|
411
|
-
if (!
|
|
412
|
-
|
|
413
|
-
|
|
431
|
+
const n = window.getSelection();
|
|
432
|
+
if (!n)
|
|
433
|
+
throw new Error("Selection unavailable");
|
|
434
|
+
if (n.rangeCount > 0) {
|
|
435
|
+
const a = n.getRangeAt(0);
|
|
414
436
|
if (t.contains(a.commonAncestorContainer) && !j(a.commonAncestorContainer))
|
|
415
437
|
return a.cloneRange();
|
|
416
438
|
}
|
|
417
|
-
const
|
|
418
|
-
return r ? (
|
|
439
|
+
const e = document.createRange(), i = t.querySelector(W), o = t.querySelector(G), r = i || o;
|
|
440
|
+
return r ? (e.setStartBefore(r), e.collapse(!0), e) : (e.selectNodeContents(t), e.collapse(!1), e);
|
|
419
441
|
}
|
|
420
442
|
function dt(t) {
|
|
421
443
|
t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
422
444
|
}
|
|
423
|
-
function ft(t,
|
|
424
|
-
if (
|
|
425
|
-
|
|
426
|
-
|
|
445
|
+
function ft(t, n) {
|
|
446
|
+
if (n === t.innerHTML)
|
|
447
|
+
return;
|
|
448
|
+
const e = window.execEditorCommand || window.executeEditorCommand;
|
|
449
|
+
if (typeof e == "function")
|
|
427
450
|
try {
|
|
428
|
-
|
|
451
|
+
e("recordDomTransaction", t, n, t.innerHTML);
|
|
429
452
|
} catch {
|
|
430
453
|
}
|
|
431
454
|
}
|
|
432
|
-
function Tt(t,
|
|
433
|
-
const
|
|
434
|
-
if (!
|
|
455
|
+
function Tt(t, n) {
|
|
456
|
+
const e = window.getSelection();
|
|
457
|
+
if (!e)
|
|
458
|
+
return;
|
|
435
459
|
const i = document.createRange();
|
|
436
460
|
if (t.nodeType === Node.TEXT_NODE) {
|
|
437
|
-
const o = t, r = Math.max(0, Math.min(
|
|
461
|
+
const o = t, r = Math.max(0, Math.min(n, o.length));
|
|
438
462
|
i.setStart(o, r);
|
|
439
463
|
} else {
|
|
440
|
-
const o = t.childNodes.length, r = Math.max(0, Math.min(
|
|
464
|
+
const o = t.childNodes.length, r = Math.max(0, Math.min(n, o));
|
|
441
465
|
i.setStart(t, r);
|
|
442
466
|
}
|
|
443
|
-
i.collapse(!0),
|
|
467
|
+
i.collapse(!0), e.removeAllRanges(), e.addRange(i);
|
|
444
468
|
}
|
|
445
469
|
function Mt(t) {
|
|
446
470
|
if (t.collapsed || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1 || !(t.startContainer instanceof Element || t.startContainer instanceof DocumentFragment))
|
|
447
471
|
return null;
|
|
448
|
-
const
|
|
449
|
-
return !(
|
|
472
|
+
const n = t.startContainer.childNodes[t.startOffset];
|
|
473
|
+
return !(n instanceof HTMLElement) || !n.matches(ot) ? null : n;
|
|
450
474
|
}
|
|
451
|
-
function J(t,
|
|
475
|
+
function J(t, n, e) {
|
|
452
476
|
const { startContainer: i, startOffset: o } = t;
|
|
453
477
|
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
454
478
|
const a = i;
|
|
455
|
-
if (
|
|
456
|
-
if (o > 0)
|
|
479
|
+
if (e === "previous") {
|
|
480
|
+
if (o > 0)
|
|
481
|
+
return a.childNodes[o - 1] || null;
|
|
457
482
|
} else if (o < a.childNodes.length)
|
|
458
483
|
return a.childNodes[o] || null;
|
|
459
484
|
}
|
|
460
|
-
if (i.nodeType === Node.TEXT_NODE && (
|
|
485
|
+
if (i.nodeType === Node.TEXT_NODE && (e === "previous" && o < i.data.length || e === "next" && o > 0))
|
|
461
486
|
return null;
|
|
462
487
|
let r = i;
|
|
463
|
-
for (; r && r !==
|
|
464
|
-
const a =
|
|
465
|
-
if (a)
|
|
488
|
+
for (; r && r !== n; ) {
|
|
489
|
+
const a = e === "previous" ? r.previousSibling : r.nextSibling;
|
|
490
|
+
if (a)
|
|
491
|
+
return a;
|
|
466
492
|
r = r.parentNode;
|
|
467
493
|
}
|
|
468
494
|
return null;
|
|
469
495
|
}
|
|
470
|
-
function Lt(t,
|
|
471
|
-
if (!t.collapsed)
|
|
496
|
+
function Lt(t, n, e) {
|
|
497
|
+
if (!t.collapsed)
|
|
498
|
+
return null;
|
|
472
499
|
const i = (a) => a instanceof HTMLElement && a.matches(ot) ? a : null, { startContainer: o, startOffset: r } = t;
|
|
473
500
|
if (o.nodeType === Node.ELEMENT_NODE) {
|
|
474
501
|
const a = o;
|
|
475
|
-
return
|
|
502
|
+
return e === "Backspace" && r > 0 ? i(a.childNodes[r - 1] || null) : e === "Delete" ? i(a.childNodes[r] || null) : null;
|
|
476
503
|
}
|
|
477
504
|
if (o.nodeType === Node.TEXT_NODE) {
|
|
478
505
|
const a = o;
|
|
479
|
-
if (
|
|
506
|
+
if (e === "Backspace" && r === 0) {
|
|
480
507
|
const s = i(a.previousSibling);
|
|
481
|
-
return s || i(J(t,
|
|
508
|
+
return s || i(J(t, n, "previous"));
|
|
482
509
|
}
|
|
483
|
-
if (
|
|
510
|
+
if (e === "Delete" && r === a.data.length) {
|
|
484
511
|
const s = i(a.nextSibling);
|
|
485
|
-
return s || i(J(t,
|
|
512
|
+
return s || i(J(t, n, "next"));
|
|
486
513
|
}
|
|
487
514
|
}
|
|
488
|
-
return i(
|
|
515
|
+
return i(e === "Backspace" ? J(t, n, "previous") : J(t, n, "next"));
|
|
489
516
|
}
|
|
490
|
-
function P(t,
|
|
491
|
-
const i = t.closest(
|
|
492
|
-
if (!i || j(t))
|
|
517
|
+
function P(t, n, e) {
|
|
518
|
+
const i = t.closest($);
|
|
519
|
+
if (!i || j(t))
|
|
520
|
+
return !1;
|
|
493
521
|
const o = t.parentNode;
|
|
494
|
-
if (!o)
|
|
522
|
+
if (!o)
|
|
523
|
+
return !1;
|
|
495
524
|
const r = i.innerHTML, a = Array.from(o.childNodes).indexOf(t);
|
|
496
|
-
if (a < 0)
|
|
525
|
+
if (a < 0)
|
|
526
|
+
return !1;
|
|
497
527
|
const s = t.nextSibling;
|
|
498
|
-
return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Tt(o, a), y(i,
|
|
528
|
+
return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Tt(o, a), y(i, e, !0), ft(i, r), dt(i), n === "Delete" && i.focus({ preventScroll: !0 }), !0;
|
|
499
529
|
}
|
|
500
|
-
function Xt(t,
|
|
501
|
-
if (t.key !== "Backspace" && t.key !== "Delete")
|
|
530
|
+
function Xt(t, n, e) {
|
|
531
|
+
if (t.key !== "Backspace" && t.key !== "Delete")
|
|
532
|
+
return !1;
|
|
502
533
|
const i = t.key, o = t.target;
|
|
503
|
-
if (o
|
|
504
|
-
return t.preventDefault(), t.stopPropagation(), P(o, i,
|
|
534
|
+
if (o != null && o.matches(ot) && n.contains(o) && !j(o))
|
|
535
|
+
return t.preventDefault(), t.stopPropagation(), P(o, i, e);
|
|
505
536
|
const r = window.getSelection();
|
|
506
|
-
if (!r || r.rangeCount === 0)
|
|
537
|
+
if (!r || r.rangeCount === 0)
|
|
538
|
+
return !1;
|
|
507
539
|
const a = r.getRangeAt(0);
|
|
508
|
-
if (!
|
|
540
|
+
if (!n.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer))
|
|
541
|
+
return !1;
|
|
509
542
|
const s = Mt(a);
|
|
510
543
|
if (s)
|
|
511
|
-
return t.preventDefault(), t.stopPropagation(), P(s, i,
|
|
512
|
-
const
|
|
513
|
-
return
|
|
544
|
+
return t.preventDefault(), t.stopPropagation(), P(s, i, e);
|
|
545
|
+
const d = Lt(a, n, i);
|
|
546
|
+
return d ? (t.preventDefault(), t.stopPropagation(), P(d, i, e)) : !1;
|
|
514
547
|
}
|
|
515
|
-
function Rt(t,
|
|
516
|
-
const i = F(
|
|
517
|
-
if (!i)
|
|
548
|
+
function Rt(t, n, e) {
|
|
549
|
+
const i = F(e.normalizeText(n || ""));
|
|
550
|
+
if (!i)
|
|
551
|
+
return !1;
|
|
518
552
|
const o = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
|
|
519
|
-
if (o.length === 0)
|
|
553
|
+
if (o.length === 0)
|
|
554
|
+
return !1;
|
|
520
555
|
if (o.length === 1)
|
|
521
|
-
return P(o[0], "Delete",
|
|
556
|
+
return P(o[0], "Delete", e);
|
|
522
557
|
const r = t.innerHTML;
|
|
523
558
|
return o.forEach((a) => {
|
|
524
559
|
const s = a.nextSibling;
|
|
525
560
|
s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), a.remove();
|
|
526
|
-
}), Tt(t, t.childNodes.length), y(t,
|
|
561
|
+
}), Tt(t, t.childNodes.length), y(t, e, !0), ft(t, r), dt(t), t.focus({ preventScroll: !0 }), !0;
|
|
527
562
|
}
|
|
528
|
-
function Jt(t,
|
|
529
|
-
const
|
|
530
|
-
if (!
|
|
531
|
-
|
|
532
|
-
|
|
563
|
+
function Jt(t, n) {
|
|
564
|
+
const e = window.getSelection();
|
|
565
|
+
if (!e || e.rangeCount === 0)
|
|
566
|
+
return !1;
|
|
567
|
+
const i = e.getRangeAt(0);
|
|
568
|
+
if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer))
|
|
569
|
+
return !1;
|
|
533
570
|
const o = Mt(i);
|
|
534
571
|
if (o)
|
|
535
|
-
return P(o, "Delete",
|
|
572
|
+
return P(o, "Delete", n);
|
|
536
573
|
const r = Lt(i, t, "Backspace");
|
|
537
|
-
return r ? P(r, "Backspace",
|
|
574
|
+
return r ? P(r, "Backspace", n) : !1;
|
|
538
575
|
}
|
|
539
|
-
function et(t,
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
i.
|
|
576
|
+
function et(t, n, e) {
|
|
577
|
+
var l, u;
|
|
578
|
+
const i = yt(n, e);
|
|
579
|
+
if (!i.author || !i.title)
|
|
580
|
+
return !1;
|
|
581
|
+
i.id || (i.id = Ht(t, e));
|
|
543
582
|
const o = t.innerHTML;
|
|
544
583
|
let r;
|
|
545
584
|
try {
|
|
@@ -548,97 +587,104 @@ function et(t, e, n) {
|
|
|
548
587
|
return !1;
|
|
549
588
|
}
|
|
550
589
|
const a = window.getSelection();
|
|
551
|
-
if (!a)
|
|
590
|
+
if (!a)
|
|
591
|
+
return !1;
|
|
552
592
|
r.collapsed || r.deleteContents();
|
|
553
593
|
const s = document.createElement("span");
|
|
554
|
-
vt(s, i, N(t,
|
|
594
|
+
vt(s, i, N(t, e));
|
|
555
595
|
try {
|
|
556
596
|
r.insertNode(s);
|
|
557
597
|
} catch {
|
|
558
598
|
return !1;
|
|
559
599
|
}
|
|
560
|
-
const
|
|
561
|
-
s.nextSibling ? s.parentNode
|
|
600
|
+
const d = document.createTextNode(" ");
|
|
601
|
+
s.nextSibling ? (l = s.parentNode) == null || l.insertBefore(d, s.nextSibling) : (u = s.parentNode) == null || u.appendChild(d);
|
|
562
602
|
const c = document.createRange();
|
|
563
|
-
if (
|
|
564
|
-
const
|
|
565
|
-
c.setStart(
|
|
603
|
+
if (d.parentNode) {
|
|
604
|
+
const b = Array.from(d.parentNode.childNodes).indexOf(d) + 1;
|
|
605
|
+
c.setStart(d.parentNode, Math.max(0, b));
|
|
566
606
|
} else
|
|
567
607
|
c.setStartAfter(s);
|
|
568
|
-
return c.collapse(!0), a.removeAllRanges(), a.addRange(c), _t(t, i,
|
|
608
|
+
return c.collapse(!0), a.removeAllRanges(), a.addRange(c), _t(t, i, e), y(t, e, !0), ft(t, o), dt(t), !0;
|
|
569
609
|
}
|
|
570
|
-
function Zt(t,
|
|
571
|
-
if (!
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
610
|
+
function Zt(t, n) {
|
|
611
|
+
if (!n)
|
|
612
|
+
return !1;
|
|
613
|
+
const e = R(t).find((r) => r.getAttribute("data-citation-id") === n) || null;
|
|
614
|
+
if (!e)
|
|
615
|
+
return !1;
|
|
616
|
+
e.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 });
|
|
575
617
|
const i = window.getSelection();
|
|
576
|
-
if (!i)
|
|
618
|
+
if (!i)
|
|
619
|
+
return !0;
|
|
577
620
|
const o = document.createRange();
|
|
578
|
-
return o.selectNode(
|
|
621
|
+
return o.selectNode(e), i.removeAllRanges(), i.addRange(o), !0;
|
|
579
622
|
}
|
|
580
623
|
function nt(t) {
|
|
581
624
|
return V.get(t) === !0;
|
|
582
625
|
}
|
|
583
|
-
function U(t,
|
|
584
|
-
const
|
|
585
|
-
|
|
626
|
+
function U(t, n = !1) {
|
|
627
|
+
const e = v.get(t);
|
|
628
|
+
e && (e.classList.remove("show"), V.set(t, !1), it(t, "toggleCitationsPanel", !1), n && t.focus({ preventScroll: !0 }));
|
|
586
629
|
}
|
|
587
630
|
function Qt(t) {
|
|
588
|
-
v.forEach((
|
|
589
|
-
|
|
631
|
+
v.forEach((n, e) => {
|
|
632
|
+
e !== t && U(e, !1);
|
|
590
633
|
});
|
|
591
634
|
}
|
|
592
|
-
function ct(t,
|
|
593
|
-
if (!
|
|
635
|
+
function ct(t, n) {
|
|
636
|
+
if (!n.classList.contains("show"))
|
|
637
|
+
return;
|
|
594
638
|
const i = lt(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));
|
|
595
|
-
|
|
639
|
+
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`;
|
|
596
640
|
}
|
|
597
|
-
function C(t,
|
|
598
|
-
return t.querySelector(`[data-field="${
|
|
641
|
+
function C(t, n) {
|
|
642
|
+
return t.querySelector(`[data-field="${n}"]`);
|
|
599
643
|
}
|
|
600
644
|
function te(t) {
|
|
601
|
-
|
|
645
|
+
var s, d, c, l, u, b;
|
|
646
|
+
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) || "";
|
|
602
647
|
return {
|
|
603
|
-
author:
|
|
604
|
-
year:
|
|
648
|
+
author: n,
|
|
649
|
+
year: e,
|
|
605
650
|
title: i,
|
|
606
651
|
source: o,
|
|
607
652
|
url: r,
|
|
608
653
|
note: a
|
|
609
654
|
};
|
|
610
655
|
}
|
|
611
|
-
function E(t,
|
|
612
|
-
const
|
|
613
|
-
|
|
656
|
+
function E(t, n) {
|
|
657
|
+
const e = t.querySelector(".rte-citations-live");
|
|
658
|
+
e && (e.textContent = n);
|
|
614
659
|
}
|
|
615
|
-
function ee(t,
|
|
616
|
-
const i = C(
|
|
617
|
-
i && (i.value = N(t,
|
|
660
|
+
function ee(t, n, e) {
|
|
661
|
+
const i = C(n, "style");
|
|
662
|
+
i && (i.value = N(t, e));
|
|
618
663
|
}
|
|
619
|
-
function Nt(t,
|
|
620
|
-
const i = L.includes(
|
|
621
|
-
return T.set(t, i), y(t,
|
|
664
|
+
function Nt(t, n, e) {
|
|
665
|
+
const i = L.includes(n) ? n : e.defaultStyle;
|
|
666
|
+
return T.set(t, i), y(t, e, !0), i;
|
|
622
667
|
}
|
|
623
|
-
function bt(t,
|
|
624
|
-
const
|
|
625
|
-
return T.set(t, o), y(t,
|
|
668
|
+
function bt(t, n) {
|
|
669
|
+
const e = N(t, n), i = L.indexOf(e), o = L[(i + 1) % L.length];
|
|
670
|
+
return T.set(t, o), y(t, n, !0), o;
|
|
626
671
|
}
|
|
627
672
|
function ne(t) {
|
|
628
|
-
const
|
|
629
|
-
if (
|
|
630
|
-
|
|
631
|
-
|
|
673
|
+
const n = v.get(t);
|
|
674
|
+
if (n)
|
|
675
|
+
return n;
|
|
676
|
+
const e = f.get(t) || M || Z(), i = `rte-citations-panel-${Ot++}`, o = document.createElement("section");
|
|
677
|
+
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 = `
|
|
632
678
|
<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(
|
|
679
|
+
<h2 class="rte-citations-title">${g(e.labels.panelTitle)}</h2>
|
|
680
|
+
<button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(e.labels.closeText)}">✕</button>
|
|
635
681
|
</header>
|
|
636
682
|
<div class="rte-citations-body">
|
|
637
683
|
<p class="rte-citations-status" aria-live="polite"></p>
|
|
638
684
|
|
|
639
685
|
<div class="rte-citations-grid">
|
|
640
686
|
<label class="rte-citations-label">
|
|
641
|
-
${g(
|
|
687
|
+
${g(e.labels.styleLabel)}
|
|
642
688
|
<select data-field="style" class="rte-citations-field">
|
|
643
689
|
<option value="apa">APA</option>
|
|
644
690
|
<option value="mla">MLA</option>
|
|
@@ -646,39 +692,39 @@ function ne(t) {
|
|
|
646
692
|
</select>
|
|
647
693
|
</label>
|
|
648
694
|
<label class="rte-citations-label">
|
|
649
|
-
${g(
|
|
695
|
+
${g(e.labels.authorLabel)}
|
|
650
696
|
<input type="text" data-field="author" class="rte-citations-field" autocomplete="off" />
|
|
651
697
|
</label>
|
|
652
698
|
<label class="rte-citations-label">
|
|
653
|
-
${g(
|
|
699
|
+
${g(e.labels.yearLabel)}
|
|
654
700
|
<input type="text" data-field="year" class="rte-citations-field" inputmode="numeric" autocomplete="off" />
|
|
655
701
|
</label>
|
|
656
702
|
<label class="rte-citations-label">
|
|
657
|
-
${g(
|
|
703
|
+
${g(e.labels.titleLabel)}
|
|
658
704
|
<input type="text" data-field="title" class="rte-citations-field" autocomplete="off" />
|
|
659
705
|
</label>
|
|
660
706
|
<label class="rte-citations-label">
|
|
661
|
-
${g(
|
|
707
|
+
${g(e.labels.sourceLabel)}
|
|
662
708
|
<input type="text" data-field="source" class="rte-citations-field" autocomplete="off" />
|
|
663
709
|
</label>
|
|
664
710
|
<label class="rte-citations-label">
|
|
665
|
-
${g(
|
|
711
|
+
${g(e.labels.urlLabel)}
|
|
666
712
|
<input type="url" data-field="url" class="rte-citations-field" autocomplete="off" />
|
|
667
713
|
</label>
|
|
668
714
|
<label class="rte-citations-label rte-citations-label-note">
|
|
669
|
-
${g(
|
|
715
|
+
${g(e.labels.noteLabel)}
|
|
670
716
|
<textarea data-field="note" class="rte-citations-field" rows="2"></textarea>
|
|
671
717
|
</label>
|
|
672
718
|
</div>
|
|
673
719
|
|
|
674
720
|
<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(
|
|
721
|
+
<button type="button" class="rte-citations-btn rte-citations-btn-primary" data-action="insert">${g(e.labels.insertText)}</button>
|
|
722
|
+
<button type="button" class="rte-citations-btn" data-action="refresh">${g(e.labels.refreshText)}</button>
|
|
677
723
|
<button type="button" class="rte-citations-btn" data-action="cycle-style"></button>
|
|
678
724
|
</div>
|
|
679
725
|
|
|
680
|
-
<section class="rte-citations-recent" aria-label="${g(
|
|
681
|
-
<h3 class="rte-citations-recent-heading">${g(
|
|
726
|
+
<section class="rte-citations-recent" aria-label="${g(e.labels.recentHeading)}">
|
|
727
|
+
<h3 class="rte-citations-recent-heading">${g(e.labels.recentHeading)}</h3>
|
|
682
728
|
<ul class="rte-citations-recent-list" role="list"></ul>
|
|
683
729
|
</section>
|
|
684
730
|
|
|
@@ -687,22 +733,25 @@ function ne(t) {
|
|
|
687
733
|
</div>
|
|
688
734
|
`, o.addEventListener("click", (a) => {
|
|
689
735
|
const s = a.target;
|
|
690
|
-
if (!s)
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
736
|
+
if (!s)
|
|
737
|
+
return;
|
|
738
|
+
const d = s.closest("[data-action]");
|
|
739
|
+
if (!d)
|
|
740
|
+
return;
|
|
741
|
+
const c = d.getAttribute("data-action") || "", l = f.get(t) || M || e;
|
|
694
742
|
if (f.set(t, l), c === "close") {
|
|
695
743
|
U(t, !0);
|
|
696
744
|
return;
|
|
697
745
|
}
|
|
698
746
|
if (c === "insert") {
|
|
699
|
-
if (
|
|
700
|
-
|
|
701
|
-
|
|
747
|
+
if (S(t))
|
|
748
|
+
return;
|
|
749
|
+
const u = te(o);
|
|
750
|
+
if (!l.normalizeText(u.author) || !l.normalizeText(u.title)) {
|
|
702
751
|
E(o, l.labels.invalidMessage);
|
|
703
752
|
return;
|
|
704
753
|
}
|
|
705
|
-
if (!et(t,
|
|
754
|
+
if (!et(t, u, l)) {
|
|
706
755
|
E(o, l.labels.invalidMessage);
|
|
707
756
|
return;
|
|
708
757
|
}
|
|
@@ -712,30 +761,33 @@ function ne(t) {
|
|
|
712
761
|
return;
|
|
713
762
|
}
|
|
714
763
|
if (c === "refresh") {
|
|
715
|
-
const
|
|
716
|
-
E(o, `Refreshed ${
|
|
764
|
+
const u = y(t, l, !0);
|
|
765
|
+
E(o, `Refreshed ${u.length} citation${u.length === 1 ? "" : "s"}.`);
|
|
717
766
|
return;
|
|
718
767
|
}
|
|
719
768
|
if (c === "cycle-style") {
|
|
720
|
-
const
|
|
721
|
-
ee(t, o, l), E(o, `Style changed to ${
|
|
769
|
+
const u = bt(t, l);
|
|
770
|
+
ee(t, o, l), E(o, `Style changed to ${u.toUpperCase()}.`);
|
|
722
771
|
return;
|
|
723
772
|
}
|
|
724
773
|
if (c === "insert-from-recent") {
|
|
725
|
-
if (
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
774
|
+
if (S(t))
|
|
775
|
+
return;
|
|
776
|
+
const u = d.getAttribute("data-citation-id") || "", b = Et(t, u, K(t, l), l);
|
|
777
|
+
if (!b)
|
|
778
|
+
return;
|
|
779
|
+
et(t, b, l), E(o, `Inserted citation: ${b.title}.`);
|
|
729
780
|
return;
|
|
730
781
|
}
|
|
731
782
|
if (c === "delete-by-id") {
|
|
732
|
-
if (
|
|
733
|
-
|
|
734
|
-
|
|
783
|
+
if (S(t))
|
|
784
|
+
return;
|
|
785
|
+
const u = d.getAttribute("data-citation-id") || "";
|
|
786
|
+
if (Rt(t, u, l)) {
|
|
735
787
|
E(o, "Citation deleted.");
|
|
736
788
|
return;
|
|
737
789
|
}
|
|
738
|
-
qt(t,
|
|
790
|
+
qt(t, u, l) && (H(t), E(o, "Removed from recent citations."));
|
|
739
791
|
}
|
|
740
792
|
}), o.addEventListener("keydown", (a) => {
|
|
741
793
|
if (a.key === "Escape") {
|
|
@@ -743,78 +795,86 @@ function ne(t) {
|
|
|
743
795
|
return;
|
|
744
796
|
}
|
|
745
797
|
const s = a.target;
|
|
746
|
-
if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp")
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
798
|
+
if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp")
|
|
799
|
+
return;
|
|
800
|
+
const d = Array.from(o.querySelectorAll(".rte-citations-recent-btn"));
|
|
801
|
+
if (d.length === 0)
|
|
802
|
+
return;
|
|
803
|
+
const c = d.indexOf(s);
|
|
804
|
+
if (c < 0)
|
|
805
|
+
return;
|
|
751
806
|
a.preventDefault();
|
|
752
|
-
const l = a.key === "ArrowDown" ? 1 : -1,
|
|
753
|
-
u
|
|
807
|
+
const l = a.key === "ArrowDown" ? 1 : -1, u = (c + l + d.length) % d.length;
|
|
808
|
+
d[u].focus();
|
|
754
809
|
});
|
|
755
810
|
const r = C(o, "style");
|
|
756
|
-
return r
|
|
757
|
-
const a = f.get(t) || M ||
|
|
811
|
+
return r == null || r.addEventListener("change", () => {
|
|
812
|
+
const a = f.get(t) || M || e, s = r.value;
|
|
758
813
|
Nt(t, s, a), E(o, `Style changed to ${s.toUpperCase()}.`);
|
|
759
814
|
}), tt(o, t), document.body.appendChild(o), v.set(t, o), V.set(t, !1), H(t), o;
|
|
760
815
|
}
|
|
761
816
|
function z(t) {
|
|
762
|
-
const
|
|
763
|
-
Qt(t),
|
|
817
|
+
const n = ne(t);
|
|
818
|
+
Qt(t), n.classList.add("show"), V.set(t, !0), it(t, "toggleCitationsPanel", !0), tt(n, t), ct(t, n), H(t);
|
|
819
|
+
const e = C(n, "author");
|
|
820
|
+
e == null || e.focus();
|
|
764
821
|
}
|
|
765
|
-
function zt(t,
|
|
766
|
-
const
|
|
767
|
-
return (typeof
|
|
822
|
+
function zt(t, n) {
|
|
823
|
+
const e = nt(t);
|
|
824
|
+
return (typeof n == "boolean" ? n : !e) ? z(t) : U(t, !1), !0;
|
|
768
825
|
}
|
|
769
826
|
function oe(t) {
|
|
770
|
-
const
|
|
771
|
-
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey &&
|
|
827
|
+
const n = t.key.toLowerCase();
|
|
828
|
+
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "c";
|
|
772
829
|
}
|
|
773
830
|
function ie(t) {
|
|
774
|
-
const
|
|
775
|
-
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey &&
|
|
831
|
+
const n = t.key.toLowerCase();
|
|
832
|
+
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "b";
|
|
776
833
|
}
|
|
777
834
|
function re(t) {
|
|
778
|
-
const
|
|
779
|
-
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey &&
|
|
835
|
+
const n = t.key.toLowerCase();
|
|
836
|
+
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "j";
|
|
780
837
|
}
|
|
781
838
|
function ae(t) {
|
|
782
|
-
M = t, I || (I = (
|
|
783
|
-
const i = e.
|
|
784
|
-
if (!i)
|
|
839
|
+
M = t, I || (I = (n) => {
|
|
840
|
+
const e = n.target, i = e == null ? void 0 : e.closest($);
|
|
841
|
+
if (!i)
|
|
842
|
+
return;
|
|
785
843
|
p = i, f.has(i) || f.set(i, t), T.has(i) || T.set(i, t.defaultStyle);
|
|
786
844
|
const o = v.get(i);
|
|
787
845
|
o && (tt(o, i), ct(i, o)), it(i, "toggleCitationsPanel", nt(i));
|
|
788
|
-
}, document.addEventListener("focusin", I, !0)), B || (B = (
|
|
789
|
-
const i = e.
|
|
846
|
+
}, document.addEventListener("focusin", I, !0)), B || (B = (n) => {
|
|
847
|
+
const e = n.target, i = e == null ? void 0 : e.closest($);
|
|
790
848
|
i && (p = i, kt(i));
|
|
791
|
-
}, document.addEventListener("input", B, !0)), O || (O = (
|
|
792
|
-
if (
|
|
793
|
-
|
|
794
|
-
|
|
849
|
+
}, document.addEventListener("input", B, !0)), O || (O = (n) => {
|
|
850
|
+
if (n.defaultPrevented)
|
|
851
|
+
return;
|
|
852
|
+
const e = n.target, i = !!(e != null && e.closest(`.${m} input, .${m} textarea, .${m} select`)), o = h(void 0, !1);
|
|
853
|
+
if (!o || S(o))
|
|
854
|
+
return;
|
|
795
855
|
const r = f.get(o) || M || t;
|
|
796
|
-
if (f.set(o, r), p = o,
|
|
797
|
-
|
|
856
|
+
if (f.set(o, r), p = o, n.key === "Escape" && nt(o)) {
|
|
857
|
+
n.preventDefault(), U(o, !0);
|
|
798
858
|
return;
|
|
799
859
|
}
|
|
800
|
-
if (!i && !Xt(
|
|
801
|
-
if (oe(
|
|
802
|
-
|
|
860
|
+
if (!i && !Xt(n, o, r)) {
|
|
861
|
+
if (oe(n)) {
|
|
862
|
+
n.preventDefault(), n.stopPropagation(), zt(o);
|
|
803
863
|
return;
|
|
804
864
|
}
|
|
805
|
-
if (ie(
|
|
806
|
-
|
|
865
|
+
if (ie(n)) {
|
|
866
|
+
n.preventDefault(), n.stopPropagation(), y(o, r, !0), z(o);
|
|
807
867
|
return;
|
|
808
868
|
}
|
|
809
|
-
re(
|
|
869
|
+
re(n) && (n.preventDefault(), n.stopPropagation(), bt(o, r));
|
|
810
870
|
}
|
|
811
871
|
}, document.addEventListener("keydown", O, !0)), k || (k = () => {
|
|
812
|
-
v.forEach((
|
|
813
|
-
if (!
|
|
814
|
-
At(
|
|
872
|
+
v.forEach((n, e) => {
|
|
873
|
+
if (!e.isConnected || !n.isConnected) {
|
|
874
|
+
At(e), n.remove(), v.delete(e), V.delete(e);
|
|
815
875
|
return;
|
|
816
876
|
}
|
|
817
|
-
tt(
|
|
877
|
+
tt(n, e), ct(e, n);
|
|
818
878
|
});
|
|
819
879
|
}, window.addEventListener("scroll", k, !0), window.addEventListener("resize", k));
|
|
820
880
|
}
|
|
@@ -822,9 +882,10 @@ function se() {
|
|
|
822
882
|
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;
|
|
823
883
|
}
|
|
824
884
|
function ce() {
|
|
825
|
-
if (typeof document > "u" || document.getElementById(
|
|
885
|
+
if (typeof document > "u" || document.getElementById(gt))
|
|
886
|
+
return;
|
|
826
887
|
const t = document.createElement("style");
|
|
827
|
-
t.id =
|
|
888
|
+
t.id = gt, t.textContent = `
|
|
828
889
|
.rte-toolbar-group-items.citations,
|
|
829
890
|
.editora-toolbar-group-items.citations {
|
|
830
891
|
display: flex;
|
|
@@ -852,7 +913,7 @@ function ce() {
|
|
|
852
913
|
|
|
853
914
|
${x} .rte-toolbar-group-items.citations,
|
|
854
915
|
${x} .editora-toolbar-group-items.citations,
|
|
855
|
-
.${
|
|
916
|
+
.${m}.rte-citations-theme-dark {
|
|
856
917
|
border-color: #566275;
|
|
857
918
|
}
|
|
858
919
|
|
|
@@ -870,7 +931,7 @@ function ce() {
|
|
|
870
931
|
${x} .editora-toolbar-button[data-command="toggleCitationsPanel"].active {
|
|
871
932
|
background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
|
|
872
933
|
}
|
|
873
|
-
.${
|
|
934
|
+
.${m} {
|
|
874
935
|
position: fixed;
|
|
875
936
|
z-index: 1500;
|
|
876
937
|
right: 16px;
|
|
@@ -887,11 +948,11 @@ function ce() {
|
|
|
887
948
|
overflow: hidden;
|
|
888
949
|
}
|
|
889
950
|
|
|
890
|
-
.${
|
|
951
|
+
.${m}.show {
|
|
891
952
|
display: flex;
|
|
892
953
|
}
|
|
893
954
|
|
|
894
|
-
.${
|
|
955
|
+
.${m}.rte-citations-theme-dark {
|
|
895
956
|
background: #0f172a;
|
|
896
957
|
color: #e2e8f0;
|
|
897
958
|
border-color: #334155;
|
|
@@ -907,7 +968,7 @@ function ce() {
|
|
|
907
968
|
background: #f8fafc;
|
|
908
969
|
}
|
|
909
970
|
|
|
910
|
-
.${
|
|
971
|
+
.${m}.rte-citations-theme-dark .rte-citations-header {
|
|
911
972
|
border-bottom-color: #334155;
|
|
912
973
|
background: #111827;
|
|
913
974
|
}
|
|
@@ -944,14 +1005,14 @@ function ce() {
|
|
|
944
1005
|
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
945
1006
|
}
|
|
946
1007
|
|
|
947
|
-
.${
|
|
1008
|
+
.${m}.rte-citations-theme-dark .rte-citations-icon-btn {
|
|
948
1009
|
background: #0f172a;
|
|
949
1010
|
border-color: #475569;
|
|
950
1011
|
color: #e2e8f0;
|
|
951
1012
|
}
|
|
952
1013
|
|
|
953
|
-
.${
|
|
954
|
-
.${
|
|
1014
|
+
.${m}.rte-citations-theme-dark .rte-citations-icon-btn:hover,
|
|
1015
|
+
.${m}.rte-citations-theme-dark .rte-citations-icon-btn:focus-visible {
|
|
955
1016
|
border-color: #60a5fa;
|
|
956
1017
|
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
957
1018
|
}
|
|
@@ -970,7 +1031,7 @@ function ce() {
|
|
|
970
1031
|
color: #475569;
|
|
971
1032
|
}
|
|
972
1033
|
|
|
973
|
-
.${
|
|
1034
|
+
.${m}.rte-citations-theme-dark .rte-citations-status {
|
|
974
1035
|
color: #94a3b8;
|
|
975
1036
|
}
|
|
976
1037
|
|
|
@@ -1011,7 +1072,7 @@ function ce() {
|
|
|
1011
1072
|
box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
|
|
1012
1073
|
}
|
|
1013
1074
|
|
|
1014
|
-
.${
|
|
1075
|
+
.${m}.rte-citations-theme-dark .rte-citations-field {
|
|
1015
1076
|
border-color: #334155;
|
|
1016
1077
|
background: #0b1220;
|
|
1017
1078
|
color: #e2e8f0;
|
|
@@ -1053,13 +1114,13 @@ function ce() {
|
|
|
1053
1114
|
border-color: #1e40af;
|
|
1054
1115
|
}
|
|
1055
1116
|
|
|
1056
|
-
.${
|
|
1117
|
+
.${m}.rte-citations-theme-dark .rte-citations-btn {
|
|
1057
1118
|
border-color: #334155;
|
|
1058
1119
|
background: #0b1220;
|
|
1059
1120
|
color: #e2e8f0;
|
|
1060
1121
|
}
|
|
1061
1122
|
|
|
1062
|
-
.${
|
|
1123
|
+
.${m}.rte-citations-theme-dark .rte-citations-btn-primary {
|
|
1063
1124
|
border-color: #2563eb;
|
|
1064
1125
|
background: #2563eb;
|
|
1065
1126
|
color: #ffffff;
|
|
@@ -1071,7 +1132,7 @@ function ce() {
|
|
|
1071
1132
|
padding: 8px;
|
|
1072
1133
|
}
|
|
1073
1134
|
|
|
1074
|
-
.${
|
|
1135
|
+
.${m}.rte-citations-theme-dark .rte-citations-recent {
|
|
1075
1136
|
border-color: #334155;
|
|
1076
1137
|
}
|
|
1077
1138
|
|
|
@@ -1139,13 +1200,13 @@ function ce() {
|
|
|
1139
1200
|
box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.18);
|
|
1140
1201
|
}
|
|
1141
1202
|
|
|
1142
|
-
.${
|
|
1203
|
+
.${m}.rte-citations-theme-dark .rte-citations-recent-btn {
|
|
1143
1204
|
border-color: #334155;
|
|
1144
1205
|
background: #0b1220;
|
|
1145
1206
|
color: #e2e8f0;
|
|
1146
1207
|
}
|
|
1147
1208
|
|
|
1148
|
-
.${
|
|
1209
|
+
.${m}.rte-citations-theme-dark .rte-citations-recent-delete {
|
|
1149
1210
|
border-color: #7f1d1d;
|
|
1150
1211
|
background: #2b1218;
|
|
1151
1212
|
color: #fca5a5;
|
|
@@ -1163,7 +1224,7 @@ function ce() {
|
|
|
1163
1224
|
line-height: 1.3;
|
|
1164
1225
|
}
|
|
1165
1226
|
|
|
1166
|
-
.${
|
|
1227
|
+
.${m}.rte-citations-theme-dark .rte-citations-recent-meta {
|
|
1167
1228
|
color: #94a3b8;
|
|
1168
1229
|
}
|
|
1169
1230
|
|
|
@@ -1175,7 +1236,7 @@ function ce() {
|
|
|
1175
1236
|
color: #64748b;
|
|
1176
1237
|
}
|
|
1177
1238
|
|
|
1178
|
-
.${
|
|
1239
|
+
.${m}.rte-citations-theme-dark .rte-citations-empty {
|
|
1179
1240
|
border-color: #334155;
|
|
1180
1241
|
color: #94a3b8;
|
|
1181
1242
|
}
|
|
@@ -1186,7 +1247,7 @@ function ce() {
|
|
|
1186
1247
|
color: #64748b;
|
|
1187
1248
|
}
|
|
1188
1249
|
|
|
1189
|
-
.${
|
|
1250
|
+
.${m}.rte-citations-theme-dark .rte-citations-shortcut {
|
|
1190
1251
|
color: #94a3b8;
|
|
1191
1252
|
}
|
|
1192
1253
|
|
|
@@ -1276,7 +1337,7 @@ function ce() {
|
|
|
1276
1337
|
}
|
|
1277
1338
|
|
|
1278
1339
|
@media (max-width: 768px) {
|
|
1279
|
-
.${
|
|
1340
|
+
.${m} {
|
|
1280
1341
|
left: 10px !important;
|
|
1281
1342
|
right: 10px;
|
|
1282
1343
|
top: 10px !important;
|
|
@@ -1295,7 +1356,7 @@ function ce() {
|
|
|
1295
1356
|
`, document.head.appendChild(t);
|
|
1296
1357
|
}
|
|
1297
1358
|
const le = (t = {}) => {
|
|
1298
|
-
const
|
|
1359
|
+
const n = Z(t);
|
|
1299
1360
|
return ce(), {
|
|
1300
1361
|
name: "citations",
|
|
1301
1362
|
toolbar: [
|
|
@@ -1330,53 +1391,60 @@ const le = (t = {}) => {
|
|
|
1330
1391
|
}
|
|
1331
1392
|
],
|
|
1332
1393
|
commands: {
|
|
1333
|
-
citations: (
|
|
1394
|
+
citations: (e, i) => {
|
|
1334
1395
|
const o = h(i);
|
|
1335
|
-
if (!o ||
|
|
1336
|
-
|
|
1396
|
+
if (!o || S(o))
|
|
1397
|
+
return !1;
|
|
1398
|
+
const r = f.get(o) || n;
|
|
1337
1399
|
return f.set(o, r), T.set(o, N(o, r)), p = o, z(o), y(o, r, !1), !0;
|
|
1338
1400
|
},
|
|
1339
|
-
toggleCitationsPanel: (
|
|
1401
|
+
toggleCitationsPanel: (e, i) => {
|
|
1340
1402
|
const o = h(i);
|
|
1341
|
-
if (!o ||
|
|
1342
|
-
|
|
1403
|
+
if (!o || S(o))
|
|
1404
|
+
return !1;
|
|
1405
|
+
const r = f.get(o) || n;
|
|
1343
1406
|
f.set(o, r), p = o;
|
|
1344
|
-
const a = zt(o, typeof
|
|
1407
|
+
const a = zt(o, typeof e == "boolean" ? e : void 0);
|
|
1345
1408
|
return nt(o) && y(o, r, !1), a;
|
|
1346
1409
|
},
|
|
1347
|
-
insertCitation: (
|
|
1410
|
+
insertCitation: (e, i) => {
|
|
1348
1411
|
const o = h(i);
|
|
1349
|
-
if (!o ||
|
|
1350
|
-
|
|
1412
|
+
if (!o || S(o) || !e || typeof e != "object")
|
|
1413
|
+
return !1;
|
|
1414
|
+
const r = f.get(o) || n;
|
|
1351
1415
|
f.set(o, r), p = o;
|
|
1352
|
-
const a = et(o,
|
|
1416
|
+
const a = et(o, e, r);
|
|
1353
1417
|
return a && z(o), a;
|
|
1354
1418
|
},
|
|
1355
|
-
refreshCitations: (
|
|
1419
|
+
refreshCitations: (e, i) => {
|
|
1356
1420
|
const o = h(i);
|
|
1357
|
-
if (!o)
|
|
1358
|
-
|
|
1421
|
+
if (!o)
|
|
1422
|
+
return !1;
|
|
1423
|
+
const r = f.get(o) || n;
|
|
1359
1424
|
return f.set(o, r), p = o, y(o, r, !0), z(o), !0;
|
|
1360
1425
|
},
|
|
1361
|
-
setCitationStyle: (
|
|
1426
|
+
setCitationStyle: (e, i) => {
|
|
1362
1427
|
const o = h(i);
|
|
1363
|
-
if (!o || !
|
|
1364
|
-
|
|
1365
|
-
|
|
1428
|
+
if (!o || !e)
|
|
1429
|
+
return !1;
|
|
1430
|
+
const r = f.get(o) || n;
|
|
1431
|
+
return f.set(o, r), p = o, Nt(o, e, r), !0;
|
|
1366
1432
|
},
|
|
1367
|
-
cycleCitationStyle: (
|
|
1433
|
+
cycleCitationStyle: (e, i) => {
|
|
1368
1434
|
const o = h(i);
|
|
1369
|
-
if (!o)
|
|
1370
|
-
|
|
1435
|
+
if (!o)
|
|
1436
|
+
return !1;
|
|
1437
|
+
const r = f.get(o) || n;
|
|
1371
1438
|
return f.set(o, r), p = o, bt(o, r), H(o), !0;
|
|
1372
1439
|
},
|
|
1373
|
-
getCitationRecords: (
|
|
1440
|
+
getCitationRecords: (e, i) => {
|
|
1374
1441
|
const o = h(i);
|
|
1375
|
-
if (!o)
|
|
1376
|
-
|
|
1377
|
-
|
|
1442
|
+
if (!o)
|
|
1443
|
+
return !1;
|
|
1444
|
+
const r = f.get(o) || n, a = K(o, r);
|
|
1445
|
+
if (typeof e == "function")
|
|
1378
1446
|
try {
|
|
1379
|
-
|
|
1447
|
+
e(a);
|
|
1380
1448
|
} catch {
|
|
1381
1449
|
}
|
|
1382
1450
|
return o.__citationRecords = a, o.dispatchEvent(
|
|
@@ -1389,41 +1457,46 @@ const le = (t = {}) => {
|
|
|
1389
1457
|
})
|
|
1390
1458
|
), !0;
|
|
1391
1459
|
},
|
|
1392
|
-
setCitationsOptions: (
|
|
1460
|
+
setCitationsOptions: (e, i) => {
|
|
1393
1461
|
const o = h(i);
|
|
1394
|
-
if (!o || !
|
|
1395
|
-
|
|
1462
|
+
if (!o || !e || typeof e != "object")
|
|
1463
|
+
return !1;
|
|
1464
|
+
const r = f.get(o) || n, a = Z({
|
|
1396
1465
|
...r,
|
|
1397
|
-
...
|
|
1466
|
+
...e,
|
|
1398
1467
|
labels: {
|
|
1399
1468
|
...r.labels,
|
|
1400
|
-
...
|
|
1469
|
+
...e.labels || {}
|
|
1401
1470
|
},
|
|
1402
|
-
normalizeText:
|
|
1403
|
-
generateCitationId:
|
|
1471
|
+
normalizeText: e.normalizeText || r.normalizeText,
|
|
1472
|
+
generateCitationId: e.generateCitationId || r.generateCitationId
|
|
1404
1473
|
});
|
|
1405
|
-
return f.set(o, a),
|
|
1474
|
+
return f.set(o, a), e.defaultStyle && L.includes(e.defaultStyle) && T.set(o, e.defaultStyle), y(o, a, !0), H(o), !0;
|
|
1406
1475
|
},
|
|
1407
|
-
locateCitation: (
|
|
1476
|
+
locateCitation: (e, i) => {
|
|
1408
1477
|
const o = h(i);
|
|
1409
|
-
return !o || typeof
|
|
1478
|
+
return !o || typeof e != "string" ? !1 : Zt(o, e);
|
|
1410
1479
|
},
|
|
1411
|
-
deleteCitation: (
|
|
1480
|
+
deleteCitation: (e, i) => {
|
|
1412
1481
|
const o = h(i);
|
|
1413
|
-
if (!o ||
|
|
1414
|
-
|
|
1415
|
-
|
|
1482
|
+
if (!o || S(o))
|
|
1483
|
+
return !1;
|
|
1484
|
+
const r = f.get(o) || n;
|
|
1485
|
+
return f.set(o, r), typeof e == "string" && e.trim() ? Rt(o, e, r) : Jt(o, r);
|
|
1416
1486
|
},
|
|
1417
|
-
insertRecentCitation: (
|
|
1487
|
+
insertRecentCitation: (e, i) => {
|
|
1418
1488
|
const o = h(i);
|
|
1419
|
-
if (!o ||
|
|
1420
|
-
|
|
1489
|
+
if (!o || S(o))
|
|
1490
|
+
return !1;
|
|
1491
|
+
const r = f.get(o) || n;
|
|
1421
1492
|
f.set(o, r);
|
|
1422
1493
|
const a = K(o, r), s = rt(o, a, r);
|
|
1423
|
-
if (s.length === 0)
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1494
|
+
if (s.length === 0)
|
|
1495
|
+
return !1;
|
|
1496
|
+
const d = typeof e == "string" && e.trim() ? Et(o, e, a, r) : s[0];
|
|
1497
|
+
if (!d)
|
|
1498
|
+
return !1;
|
|
1499
|
+
const c = et(o, d, r);
|
|
1427
1500
|
return c && z(o), c;
|
|
1428
1501
|
}
|
|
1429
1502
|
},
|
|
@@ -1437,7 +1510,7 @@ const le = (t = {}) => {
|
|
|
1437
1510
|
},
|
|
1438
1511
|
init: function(i) {
|
|
1439
1512
|
Y += 1;
|
|
1440
|
-
const o = this && typeof this.__pluginConfig == "object" ? Z({ ...
|
|
1513
|
+
const o = this && typeof this.__pluginConfig == "object" ? Z({ ...n, ...this.__pluginConfig }) : n;
|
|
1441
1514
|
ae(o);
|
|
1442
1515
|
const r = h(
|
|
1443
1516
|
i && i.editorElement ? { editorElement: i.editorElement } : void 0,
|
|
@@ -1446,8 +1519,8 @@ const le = (t = {}) => {
|
|
|
1446
1519
|
r && (p = r, f.set(r, o), T.set(r, o.defaultStyle), it(r, "toggleCitationsPanel", !1), kt(r));
|
|
1447
1520
|
},
|
|
1448
1521
|
destroy: () => {
|
|
1449
|
-
Y = Math.max(0, Y - 1), !(Y > 0) && (q.forEach((
|
|
1450
|
-
window.clearTimeout(
|
|
1522
|
+
Y = Math.max(0, Y - 1), !(Y > 0) && (q.forEach((e) => {
|
|
1523
|
+
window.clearTimeout(e);
|
|
1451
1524
|
}), q.clear(), se());
|
|
1452
1525
|
}
|
|
1453
1526
|
};
|