@instructure/platform-notebook 1.9.1 → 1.9.2
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/highlighter.d.ts.map +1 -1
- package/dist/index.js +269 -269
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
1
|
+
import { jsx as s, jsxs as v, Fragment as qe } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as Ke, useMemo as me, useContext as Xe, useReducer as Qe, useRef as B, useEffect as W, useState as U, useCallback as K } from "react";
|
|
3
|
-
import { createPortal as
|
|
3
|
+
import { createPortal as mt } from "react-dom";
|
|
4
4
|
import { z as f } from "zod";
|
|
5
|
-
import
|
|
6
|
-
import { useQueryClient as Re, useMutation as ke, useQuery as
|
|
7
|
-
import { CloseButton as
|
|
5
|
+
import gt from "diff-match-patch";
|
|
6
|
+
import { useQueryClient as Re, useMutation as ke, useQuery as ht } from "@tanstack/react-query";
|
|
7
|
+
import { CloseButton as pt, Button as ne, IconButton as ue } from "@instructure/ui-buttons";
|
|
8
8
|
import { Flex as x } from "@instructure/ui-flex";
|
|
9
9
|
import { Heading as Ne } from "@instructure/ui-heading";
|
|
10
|
-
import { Tray as
|
|
10
|
+
import { Tray as yt } from "@instructure/ui-tray";
|
|
11
11
|
import { View as Q } from "@instructure/ui-view";
|
|
12
|
-
import { IconQuestionLine as we, IconPinLine as Oe, IconWarningLine as
|
|
12
|
+
import { IconQuestionLine as we, IconPinLine as Oe, IconWarningLine as Nt, IconNoteLine as bt, IconEditLine as Ie, IconTrashLine as ye, IconArrowStartLine as Et } from "@instructure/ui-icons";
|
|
13
13
|
import { Menu as ce } from "@instructure/ui-menu";
|
|
14
14
|
import { TruncateText as Ce } from "@instructure/ui-truncate-text";
|
|
15
15
|
import { SimpleSelect as Be } from "@instructure/ui-simple-select";
|
|
16
16
|
import { Text as te } from "@instructure/ui-text";
|
|
17
|
-
import { ScreenReaderContent as
|
|
18
|
-
import { Dialog as
|
|
17
|
+
import { ScreenReaderContent as Te } from "@instructure/ui-a11y-content";
|
|
18
|
+
import { Dialog as Tt } from "@instructure/ui-dialog";
|
|
19
19
|
import { TextArea as Ye } from "@instructure/ui-text-area";
|
|
20
20
|
import { Pill as $e } from "@instructure/ui-pill";
|
|
21
21
|
import { Pagination as St } from "@instructure/ui-pagination";
|
|
22
|
-
import { Spinner as
|
|
23
|
-
const
|
|
22
|
+
import { Spinner as vt } from "@instructure/ui-spinner";
|
|
23
|
+
const It = f.object({
|
|
24
24
|
startContainer: f.string(),
|
|
25
25
|
endContainer: f.string(),
|
|
26
26
|
startOffset: f.number(),
|
|
27
27
|
endOffset: f.number()
|
|
28
|
-
}),
|
|
28
|
+
}), Ct = f.object({
|
|
29
29
|
start: f.number(),
|
|
30
30
|
end: f.number()
|
|
31
31
|
}), Le = f.object({
|
|
32
32
|
selectedText: f.string(),
|
|
33
33
|
hasNoHighlightAnymore: f.boolean().optional(),
|
|
34
|
-
textPosition:
|
|
35
|
-
range:
|
|
34
|
+
textPosition: Ct.nullable(),
|
|
35
|
+
range: It.nullable(),
|
|
36
36
|
pageLastModifiedAt: f.string()
|
|
37
37
|
});
|
|
38
38
|
var O = /* @__PURE__ */ ((t) => (t.IMPORTANT = "Important", t.CONFUSING = "Confusing", t))(O || {});
|
|
@@ -40,7 +40,7 @@ const Ae = f.enum([
|
|
|
40
40
|
"Important",
|
|
41
41
|
"Confusing"
|
|
42
42
|
/* CONFUSING */
|
|
43
|
-
]),
|
|
43
|
+
]), xt = f.object({
|
|
44
44
|
totalCount: f.number().nullish(),
|
|
45
45
|
totalNrOfPages: f.number().nullish()
|
|
46
46
|
}), be = f.object({
|
|
@@ -55,28 +55,28 @@ const Ae = f.enum([
|
|
|
55
55
|
highlightData: Le,
|
|
56
56
|
createdAt: f.string(),
|
|
57
57
|
updatedAt: f.string()
|
|
58
|
-
}),
|
|
58
|
+
}), Rt = f.object({
|
|
59
59
|
cursor: f.string(),
|
|
60
60
|
node: be
|
|
61
61
|
});
|
|
62
62
|
f.object({
|
|
63
63
|
notes: f.object({
|
|
64
|
-
edges: f.array(
|
|
64
|
+
edges: f.array(Rt),
|
|
65
65
|
nodes: f.array(be),
|
|
66
|
-
pageInfo:
|
|
66
|
+
pageInfo: xt
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
|
-
const
|
|
69
|
+
const kt = f.object({
|
|
70
70
|
type: f.string(),
|
|
71
71
|
id: f.string()
|
|
72
|
-
}),
|
|
72
|
+
}), wt = f.object({
|
|
73
73
|
courseId: f.string().optional(),
|
|
74
|
-
learningObject:
|
|
74
|
+
learningObject: kt.optional(),
|
|
75
75
|
reactions: f.array(f.string()).optional()
|
|
76
76
|
}).optional();
|
|
77
77
|
f.object({
|
|
78
78
|
courseId: f.string().optional(),
|
|
79
|
-
filter:
|
|
79
|
+
filter: wt,
|
|
80
80
|
offset: f.number().optional(),
|
|
81
81
|
pageSize: f.number().optional()
|
|
82
82
|
});
|
|
@@ -192,18 +192,18 @@ class X {
|
|
|
192
192
|
return new X(n, o);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
const
|
|
195
|
+
const Ot = (t) => {
|
|
196
196
|
const e = t.nodeName.toLowerCase();
|
|
197
197
|
return e === "#text" ? "text()" : e;
|
|
198
198
|
};
|
|
199
|
-
function
|
|
199
|
+
function Lt(t) {
|
|
200
200
|
let e = 0, n = t;
|
|
201
201
|
for (; n; )
|
|
202
202
|
n.nodeName === t.nodeName && (e += 1), n = n.previousSibling;
|
|
203
203
|
return e;
|
|
204
204
|
}
|
|
205
|
-
const
|
|
206
|
-
const e =
|
|
205
|
+
const At = (t) => {
|
|
206
|
+
const e = Ot(t), n = Lt(t);
|
|
207
207
|
return `${e}[${n}]`;
|
|
208
208
|
}, He = (t, e) => {
|
|
209
209
|
let n = "", o = t;
|
|
@@ -212,10 +212,10 @@ const Lt = (t) => {
|
|
|
212
212
|
console.error("Node is not a descendant of root");
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
|
-
n = `${
|
|
215
|
+
n = `${At(o)}/${n}`, o = o.parentNode;
|
|
216
216
|
}
|
|
217
217
|
return n = `/${n}`, n = n.replace(/\/$/, ""), n;
|
|
218
|
-
},
|
|
218
|
+
}, Dt = (t, e, n) => {
|
|
219
219
|
const o = e.toUpperCase();
|
|
220
220
|
let r = -1;
|
|
221
221
|
for (let i = 0; i < t.children.length; i++) {
|
|
@@ -224,7 +224,7 @@ const Lt = (t) => {
|
|
|
224
224
|
return l;
|
|
225
225
|
}
|
|
226
226
|
return null;
|
|
227
|
-
},
|
|
227
|
+
}, Pt = (t, e) => {
|
|
228
228
|
if (!(t.match(/^(\/[A-Za-z0-9-]+(\[[0-9]+])?)+$/) !== null))
|
|
229
229
|
return console.error("Expression is not a simple XPath"), null;
|
|
230
230
|
const o = t.split("/");
|
|
@@ -235,12 +235,12 @@ const Lt = (t) => {
|
|
|
235
235
|
const m = i.indexOf("[");
|
|
236
236
|
if (m !== -1) {
|
|
237
237
|
l = i.slice(0, m);
|
|
238
|
-
const
|
|
239
|
-
if (a = Number.parseInt(
|
|
238
|
+
const y = i.slice(m + 1, i.indexOf("]"));
|
|
239
|
+
if (a = Number.parseInt(y, 10) - 1, a < 0)
|
|
240
240
|
return null;
|
|
241
241
|
} else
|
|
242
242
|
l = i, a = 0;
|
|
243
|
-
const c =
|
|
243
|
+
const c = Dt(r, l, a);
|
|
244
244
|
if (!c)
|
|
245
245
|
return null;
|
|
246
246
|
r = c;
|
|
@@ -248,7 +248,7 @@ const Lt = (t) => {
|
|
|
248
248
|
return r;
|
|
249
249
|
}, Ge = (t, e = document.body) => {
|
|
250
250
|
try {
|
|
251
|
-
return
|
|
251
|
+
return Pt(t, e);
|
|
252
252
|
} catch {
|
|
253
253
|
return document.evaluate(`.${t}`, e, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
254
254
|
}
|
|
@@ -334,14 +334,14 @@ const Ze = (t) => {
|
|
|
334
334
|
for (; n !== void 0 && l && a === n; )
|
|
335
335
|
r.push({ node: l, offset: l.data.length }), n = e.shift();
|
|
336
336
|
return n !== void 0 && console.error("Offset exceeds text length"), r;
|
|
337
|
-
},
|
|
337
|
+
}, _t = (t, e, n, o) => {
|
|
338
338
|
const r = n - e;
|
|
339
339
|
return Math.abs(r - o) <= 5 ? ie.fromSelector(t, {
|
|
340
340
|
start: e,
|
|
341
341
|
end: n
|
|
342
342
|
}) : null;
|
|
343
|
-
},
|
|
344
|
-
const r = new
|
|
343
|
+
}, Ft = (t, e, n, o) => {
|
|
344
|
+
const r = new gt();
|
|
345
345
|
r.Match_Distance = 5e3;
|
|
346
346
|
const i = t.textContent;
|
|
347
347
|
if (!i)
|
|
@@ -349,12 +349,12 @@ const Ze = (t) => {
|
|
|
349
349
|
if (e.length > 32) {
|
|
350
350
|
const l = e.slice(0, 32), a = e.slice(-32), m = o - n;
|
|
351
351
|
let c = r.match_main(i, l, n);
|
|
352
|
-
const
|
|
353
|
-
if (c === -1 ||
|
|
352
|
+
const y = r.match_main(i, a, o), d = y + a.length;
|
|
353
|
+
if (c === -1 || y === -1)
|
|
354
354
|
return null;
|
|
355
355
|
const h = d - c, b = Math.abs(h - m);
|
|
356
356
|
if ((c > d || b > 5) && (r.Match_Distance = e.length + 100, c = r.match_main(i, l, d), c !== -1 && c < d))
|
|
357
|
-
return
|
|
357
|
+
return _t(t, c, d, m);
|
|
358
358
|
if (c < d && b <= 5)
|
|
359
359
|
return ie.fromSelector(t, {
|
|
360
360
|
start: c,
|
|
@@ -369,19 +369,19 @@ const Ze = (t) => {
|
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
371
|
return null;
|
|
372
|
-
},
|
|
372
|
+
}, Mt = (t, e) => {
|
|
373
373
|
if (!e) return null;
|
|
374
374
|
const { highlightData: n } = t, { textPosition: o, selectedText: r } = n;
|
|
375
|
-
return
|
|
375
|
+
return Ft(
|
|
376
376
|
e,
|
|
377
377
|
r,
|
|
378
378
|
(o == null ? void 0 : o.start) ?? 0,
|
|
379
379
|
(o == null ? void 0 : o.end) ?? 0
|
|
380
380
|
);
|
|
381
|
-
},
|
|
381
|
+
}, Bt = (t, e, n) => {
|
|
382
382
|
const o = [], r = [];
|
|
383
383
|
for (const i of e) {
|
|
384
|
-
const l =
|
|
384
|
+
const l = Mt(i, t);
|
|
385
385
|
if (l) {
|
|
386
386
|
const a = l.toRange(), m = a && le.fromRange(t, a), c = (a == null ? void 0 : a.toString().trim()) || i.highlightData.selectedText;
|
|
387
387
|
o.push({
|
|
@@ -415,7 +415,7 @@ const Ze = (t) => {
|
|
|
415
415
|
if (!e) return;
|
|
416
416
|
const { highlightData: n, id: o } = t, { range: r } = n ?? {};
|
|
417
417
|
r && ((l = le.fromSelector(e, r)) == null ? void 0 : l.toRange()) && Yt({ id: o });
|
|
418
|
-
},
|
|
418
|
+
}, $t = (t) => {
|
|
419
419
|
const n = document.querySelector(
|
|
420
420
|
`[data-highlight-id="${CSS.escape(t)}"].highlight-content`
|
|
421
421
|
) ?? document.getElementById(Ee(t));
|
|
@@ -423,28 +423,28 @@ const Ze = (t) => {
|
|
|
423
423
|
const o = n.getBoundingClientRect();
|
|
424
424
|
o.top >= 0 && o.bottom <= (window.innerHeight || document.documentElement.clientHeight) || n.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
425
425
|
}
|
|
426
|
-
}, ge = 90, he = 172,
|
|
426
|
+
}, ge = 90, he = 172, Ht = (t) => {
|
|
427
427
|
const e = t.getClientRects();
|
|
428
428
|
if (!e.length)
|
|
429
429
|
return null;
|
|
430
|
-
const n = e[0], o = e[e.length - 1], r = 4, i = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight, m = (
|
|
431
|
-
const E =
|
|
432
|
-
return
|
|
433
|
-
}, c = (
|
|
434
|
-
const E =
|
|
435
|
-
return
|
|
430
|
+
const n = e[0], o = e[e.length - 1], r = 4, i = 16, l = window.innerWidth || document.documentElement.clientWidth, a = window.innerHeight || document.documentElement.clientHeight, m = (p) => {
|
|
431
|
+
const E = p + he;
|
|
432
|
+
return p >= i && E <= l - i;
|
|
433
|
+
}, c = (p) => {
|
|
434
|
+
const E = p + ge;
|
|
435
|
+
return p >= i && E <= a - i;
|
|
436
436
|
};
|
|
437
|
-
let
|
|
437
|
+
let y;
|
|
438
438
|
const d = n.right - he;
|
|
439
439
|
if (m(d))
|
|
440
|
-
|
|
440
|
+
y = d;
|
|
441
441
|
else {
|
|
442
|
-
const
|
|
443
|
-
if (m(
|
|
444
|
-
|
|
442
|
+
const p = n.left;
|
|
443
|
+
if (m(p))
|
|
444
|
+
y = p;
|
|
445
445
|
else {
|
|
446
446
|
const g = (n.left + n.right) / 2 - he / 2;
|
|
447
|
-
m(g) ?
|
|
447
|
+
m(g) ? y = g : d < i ? y = i : y = l - he - i;
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
let h;
|
|
@@ -452,20 +452,20 @@ const Ze = (t) => {
|
|
|
452
452
|
if (c(b))
|
|
453
453
|
h = b;
|
|
454
454
|
else {
|
|
455
|
-
const
|
|
456
|
-
c(
|
|
455
|
+
const p = n.top - ge - r;
|
|
456
|
+
c(p) ? h = p : b + ge > a - i ? h = a - ge - i : h = i;
|
|
457
457
|
}
|
|
458
|
-
return { top: h, left:
|
|
459
|
-
},
|
|
458
|
+
return { top: h, left: y };
|
|
459
|
+
}, Gt = (t, e) => {
|
|
460
460
|
for (const n of e)
|
|
461
461
|
if (t.start < n.end && t.end > n.start)
|
|
462
462
|
return !0;
|
|
463
463
|
return !1;
|
|
464
|
-
}, De = (t) => `highlight-wrapper-${t}`, Ee = (t) => `${De(t)}-start`, et = (t) => `${De(t)}-end`, fe = (t) => `[data-highlight-id="${CSS.escape(t)}"]`,
|
|
464
|
+
}, De = (t) => `highlight-wrapper-${t}`, Ee = (t) => `${De(t)}-start`, et = (t) => `${De(t)}-end`, fe = (t) => `[data-highlight-id="${CSS.escape(t)}"]`, Ut = "2px", jt = "3px", Wt = "1px", tt = "3px", zt = "1px", nt = "Notebook note", Pe = (t, e) => {
|
|
465
465
|
const n = Number.parseInt(t.slice(1, 3), 16), o = Number.parseInt(t.slice(3, 5), 16), r = Number.parseInt(t.slice(5, 7), 16);
|
|
466
466
|
return `rgba(${n}, ${o}, ${r}, ${e})`;
|
|
467
|
-
},
|
|
468
|
-
t.style.backgroundColor = n, e ? (t.dataset.selected = "true", t.style.outline = `${
|
|
467
|
+
}, ot = (t, e, n, o, r) => {
|
|
468
|
+
t.style.backgroundColor = n, t.style.textDecorationColor = o, t.style.textDecorationStyle = r, e ? (t.dataset.selected = "true", t.style.outline = `${Wt} ${r} ${o}`, t.style.outlineOffset = zt, t.style.borderRadius = tt, t.style.fontWeight = "bold") : (t.removeAttribute("data-selected"), t.style.outline = "", t.style.outlineOffset = "", t.style.borderRadius = "", t.style.fontWeight = "");
|
|
469
469
|
}, qt = (t, e) => {
|
|
470
470
|
var n;
|
|
471
471
|
try {
|
|
@@ -503,38 +503,38 @@ const Ze = (t) => {
|
|
|
503
503
|
Qt(e, n);
|
|
504
504
|
return;
|
|
505
505
|
}
|
|
506
|
-
const l = e.type === O.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, m = a ? l : Pe(l, 0.5), c = e.type === O.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline,
|
|
506
|
+
const l = e.type === O.IMPORTANT ? n.colors.importantBackground : n.colors.confusingBackground, a = e.id === e.selectedNoteId, m = a ? l : Pe(l, 0.5), c = e.type === O.IMPORTANT ? n.colors.importantUnderline : n.colors.confusingUnderline, y = e.type === O.IMPORTANT ? "solid" : "dashed", d = document.createElement("span");
|
|
507
507
|
d.id = `${r}-start`, d.className = "highlight-marker-start", d.dataset.highlightId = o || "";
|
|
508
|
-
const h = e.labelPrefix ??
|
|
508
|
+
const h = e.labelPrefix ?? nt;
|
|
509
509
|
d.setAttribute("role", "button"), d.setAttribute("tabindex", "0"), d.setAttribute("aria-label", h), d.setAttribute("aria-haspopup", "dialog"), d.setAttribute("aria-expanded", String(a && !!e.isTrayOpen)), a && d.setAttribute("aria-current", "true"), e.popupId && d.setAttribute("aria-controls", e.popupId), d.style.position = "relative", d.style.fontSize = "0", d.style.lineHeight = "0", d.style.width = "0", d.style.height = "0", d.style.margin = "0", d.style.padding = "0", d.style.border = "0", d.style.outline = "none";
|
|
510
510
|
const b = document.createElement("span");
|
|
511
511
|
b.id = et(o), b.className = "highlight-marker-end", b.dataset.highlightId = o || "";
|
|
512
|
-
const
|
|
513
|
-
|
|
512
|
+
const p = t.cloneRange();
|
|
513
|
+
p.collapse(!1), p.insertNode(b);
|
|
514
514
|
const E = t.cloneRange();
|
|
515
515
|
E.collapse(!0), E.insertNode(d);
|
|
516
516
|
const g = document.createRange();
|
|
517
517
|
g.setStartAfter(d), g.setEndBefore(b);
|
|
518
518
|
const j = Kt(g).filter((N) => N.textContent && N.textContent.length > 0);
|
|
519
|
-
j.forEach((N,
|
|
519
|
+
j.forEach((N, I) => {
|
|
520
520
|
var F;
|
|
521
521
|
const P = N.parentElement;
|
|
522
522
|
if ((P == null ? void 0 : P.dataset.highlightId) === o) return;
|
|
523
|
-
const $ =
|
|
523
|
+
const $ = I === 0, _ = I === j.length - 1, T = j.length === 1;
|
|
524
524
|
let L;
|
|
525
|
-
|
|
526
|
-
const
|
|
527
|
-
|
|
525
|
+
T ? L = "single" : $ ? L = "first" : _ ? L = "last" : L = "middle";
|
|
526
|
+
const C = document.createElement("span");
|
|
527
|
+
C.className = "highlight-content", C.dataset.highlightId = o || "", C.dataset.position = L, C.style.textDecorationLine = "underline", C.style.textDecorationThickness = n.borderWidthSmall, C.style.textUnderlineOffset = n.underlineOffset, C.style.cursor = "pointer", ot(C, a, m, c, y), C.addEventListener("click", (Z) => {
|
|
528
528
|
var V;
|
|
529
529
|
Z.target.tagName !== "A" && ((V = e.onClick) == null || V.call(e));
|
|
530
|
-
}), (F = N.parentNode) == null || F.insertBefore(
|
|
530
|
+
}), (F = N.parentNode) == null || F.insertBefore(C, N), C.appendChild(N);
|
|
531
531
|
}), d.addEventListener("click", (N) => {
|
|
532
|
-
var
|
|
533
|
-
N.target.tagName !== "A" && ((
|
|
532
|
+
var I;
|
|
533
|
+
N.target.tagName !== "A" && ((I = e.onClick) == null || I.call(e));
|
|
534
534
|
}), d.addEventListener("keydown", (N) => {
|
|
535
|
-
var
|
|
535
|
+
var I;
|
|
536
536
|
if (N.key === "Enter" || N.key === " ")
|
|
537
|
-
N.preventDefault(), (
|
|
537
|
+
N.preventDefault(), (I = e.onClick) == null || I.call(e);
|
|
538
538
|
else if (N.key === "Tab" && !N.shiftKey) {
|
|
539
539
|
const P = document.querySelectorAll(fe(o));
|
|
540
540
|
for (const $ of P) {
|
|
@@ -548,14 +548,14 @@ const Ze = (t) => {
|
|
|
548
548
|
}), d.addEventListener("focus", () => {
|
|
549
549
|
document.querySelectorAll(
|
|
550
550
|
`.highlight-content${fe(o)}`
|
|
551
|
-
).forEach((
|
|
552
|
-
|
|
551
|
+
).forEach((I) => {
|
|
552
|
+
I.style.boxShadow = `0 0 0 ${Ut} ${n.colors.focusOutline}`, I.style.borderRadius = jt;
|
|
553
553
|
});
|
|
554
554
|
}), d.addEventListener("blur", () => {
|
|
555
555
|
document.querySelectorAll(
|
|
556
556
|
`.highlight-content${fe(o)}`
|
|
557
|
-
).forEach((
|
|
558
|
-
|
|
557
|
+
).forEach((I) => {
|
|
558
|
+
I.style.boxShadow = "", I.style.borderRadius = I.dataset.selected ? tt : "";
|
|
559
559
|
});
|
|
560
560
|
});
|
|
561
561
|
};
|
|
@@ -564,12 +564,12 @@ function Qt(t, e) {
|
|
|
564
564
|
document.querySelectorAll(
|
|
565
565
|
`.highlight-content${fe(t.id ?? "")}`
|
|
566
566
|
).forEach((c) => {
|
|
567
|
-
|
|
567
|
+
ot(c, o, r, i, l);
|
|
568
568
|
});
|
|
569
569
|
const m = document.getElementById(
|
|
570
570
|
Ee(t.id ?? "")
|
|
571
571
|
);
|
|
572
|
-
m && (m.setAttribute("aria-expanded", String(o && !!t.isTrayOpen)), o ? m.setAttribute("aria-current", "true") : m.removeAttribute("aria-current"));
|
|
572
|
+
m && (m.setAttribute("aria-label", t.labelPrefix ?? nt), m.setAttribute("aria-expanded", String(o && !!t.isTrayOpen)), o ? m.setAttribute("aria-current", "true") : m.removeAttribute("aria-current"));
|
|
573
573
|
}
|
|
574
574
|
const Yt = (t) => {
|
|
575
575
|
const e = t.id ?? "", n = document.getElementById(Ee(e)), o = document.getElementById(et(e));
|
|
@@ -603,26 +603,26 @@ function Zt(t) {
|
|
|
603
603
|
}
|
|
604
604
|
});
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function rt({
|
|
607
607
|
api: t,
|
|
608
608
|
enabled: e = !0,
|
|
609
609
|
...n
|
|
610
610
|
}) {
|
|
611
|
-
return
|
|
611
|
+
return ht({
|
|
612
612
|
queryKey: de.notes(n),
|
|
613
613
|
queryFn: () => t.getNotes(n),
|
|
614
614
|
enabled: e
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
617
|
const Jt = 100;
|
|
618
|
-
function
|
|
618
|
+
function st({
|
|
619
619
|
api: t,
|
|
620
620
|
courseId: e,
|
|
621
621
|
learningObject: n,
|
|
622
622
|
reactions: o,
|
|
623
623
|
enabled: r = !0
|
|
624
624
|
}) {
|
|
625
|
-
return
|
|
625
|
+
return rt({
|
|
626
626
|
api: t,
|
|
627
627
|
filter: {
|
|
628
628
|
...e ? { courseId: e } : {},
|
|
@@ -662,7 +662,7 @@ function en(t) {
|
|
|
662
662
|
}
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
|
-
const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Back", ln = "Edit note", an = "Save", cn = "Cancel", dn = "Delete note", un = "Delete note confirmation", fn = "note", mn = "Add note (optional)", gn = "Remove from Notebook", hn = "Add a note (optional)", pn = "Mark important", yn = "Mark unclear", Nn = "Saved to Notebook.", bn = "Note updated", En = "Note deleted",
|
|
665
|
+
const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Back", ln = "Edit note", an = "Save", cn = "Cancel", dn = "Delete note", un = "Delete note confirmation", fn = "note", mn = "Add note (optional)", gn = "Remove from Notebook", hn = "Add a note (optional)", pn = "Mark important", yn = "Mark unclear", Nn = "Saved to Notebook.", bn = "Note updated", En = "Note deleted", Tn = "Error saving to Notebook.", Sn = "Error updating note", vn = "Note deletion failed", In = "Loading notes", Cn = "Failed to load notes", xn = "Start capturing your notes", Rn = "Your notes from learning materials will appear here. Highlight key ideas, reflections, or questions as you learn—they'll all be saved in your Notebook for easy review later.", kn = "Nothing here yet", wn = "Adjust your filters or create a new note to get started.", On = "You have no notes for the selected filter", Ln = "Filter", An = "Previous page", Dn = "Next page", Pn = "All courses", _n = "All notes", Fn = "Close Notebook panel", Mn = "To use the Notebook feature, highlight an excerpt from your learning material to flag it as 'confusing' or 'important' and leave an optional note.", Bn = "The content you highlighted is no longer available.", $n = "Notebook note", _e = {
|
|
666
666
|
notebook: tn,
|
|
667
667
|
notes: nn,
|
|
668
668
|
important: on,
|
|
@@ -682,8 +682,8 @@ const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Bac
|
|
|
682
682
|
savedToNotebook: Nn,
|
|
683
683
|
noteUpdated: bn,
|
|
684
684
|
noteDeleted: En,
|
|
685
|
-
errorSavingNote:
|
|
686
|
-
errorUpdatingNote:
|
|
685
|
+
errorSavingNote: Tn,
|
|
686
|
+
errorUpdatingNote: Sn,
|
|
687
687
|
noteDeletionFailed: vn,
|
|
688
688
|
loadingNotes: In,
|
|
689
689
|
failedToLoadNotes: Cn,
|
|
@@ -701,8 +701,8 @@ const tn = "Notebook", nn = "Notes", on = "Important", rn = "Unclear", sn = "Bac
|
|
|
701
701
|
featureDescription: Mn,
|
|
702
702
|
highlightUnavailable: Bn,
|
|
703
703
|
notebookNote: $n
|
|
704
|
-
},
|
|
705
|
-
function
|
|
704
|
+
}, it = Ke(null);
|
|
705
|
+
function lt(t, e) {
|
|
706
706
|
const n = _e[t] ?? t;
|
|
707
707
|
return e ? n.replace(/%\{([^}]+)}/g, (o, r) => String(e[r] ?? `%{${r}}`)) : n;
|
|
708
708
|
}
|
|
@@ -714,15 +714,15 @@ function Hn({
|
|
|
714
714
|
const o = me(
|
|
715
715
|
() => ({
|
|
716
716
|
translations: { ..._e, ...t },
|
|
717
|
-
translate: e ??
|
|
717
|
+
translate: e ?? lt
|
|
718
718
|
}),
|
|
719
719
|
[t, e]
|
|
720
720
|
);
|
|
721
|
-
return /* @__PURE__ */ s(
|
|
721
|
+
return /* @__PURE__ */ s(it.Provider, { value: o, children: n });
|
|
722
722
|
}
|
|
723
723
|
function J() {
|
|
724
|
-
const t = Xe(
|
|
725
|
-
return t || { translations: _e, translate:
|
|
724
|
+
const t = Xe(it);
|
|
725
|
+
return t || { translations: _e, translate: lt };
|
|
726
726
|
}
|
|
727
727
|
const Gn = (t) => ({
|
|
728
728
|
selectedNoteId: t ?? null,
|
|
@@ -749,7 +749,7 @@ function Un(t, e) {
|
|
|
749
749
|
return t;
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
|
-
const
|
|
752
|
+
const at = Ke(null);
|
|
753
753
|
function Eo({
|
|
754
754
|
api: t,
|
|
755
755
|
currentUserId: e,
|
|
@@ -761,9 +761,9 @@ function Eo({
|
|
|
761
761
|
initialNoteId: a,
|
|
762
762
|
translations: m,
|
|
763
763
|
translate: c,
|
|
764
|
-
children:
|
|
764
|
+
children: y
|
|
765
765
|
}) {
|
|
766
|
-
const [d, h] = Qe(Un, Gn(a)), b = B(a != null),
|
|
766
|
+
const [d, h] = Qe(Un, Gn(a)), b = B(a != null), p = me(
|
|
767
767
|
() => ({
|
|
768
768
|
api: t,
|
|
769
769
|
currentUserId: e,
|
|
@@ -784,29 +784,29 @@ function Eo({
|
|
|
784
784
|
}),
|
|
785
785
|
[t, e, n, o, r, i, l, d]
|
|
786
786
|
);
|
|
787
|
-
return /* @__PURE__ */ s(
|
|
787
|
+
return /* @__PURE__ */ s(at.Provider, { value: p, children: /* @__PURE__ */ s(Hn, { translations: m, translate: c, children: y }) });
|
|
788
788
|
}
|
|
789
|
-
function
|
|
790
|
-
const t = Xe(
|
|
789
|
+
function ct() {
|
|
790
|
+
const t = Xe(at);
|
|
791
791
|
if (!t)
|
|
792
792
|
throw new Error("useNotebook must be used within a NotebookProvider");
|
|
793
793
|
return t;
|
|
794
794
|
}
|
|
795
|
-
const
|
|
796
|
-
const { isTrayOpen: e, closeTray: n } =
|
|
795
|
+
const dt = "notebook-tray-content", To = ({ children: t }) => {
|
|
796
|
+
const { isTrayOpen: e, closeTray: n } = ct(), { translations: o } = J();
|
|
797
797
|
return /* @__PURE__ */ s(
|
|
798
|
-
|
|
798
|
+
yt,
|
|
799
799
|
{
|
|
800
800
|
label: o.notebook,
|
|
801
801
|
open: e,
|
|
802
802
|
onDismiss: n,
|
|
803
803
|
placement: "end",
|
|
804
804
|
size: "regular",
|
|
805
|
-
children: /* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */ s(x.Item, { children: /* @__PURE__ */ s(Q, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */
|
|
805
|
+
children: /* @__PURE__ */ v(x, { direction: "column", height: "100vh", id: dt, children: [
|
|
806
|
+
/* @__PURE__ */ s(x.Item, { children: /* @__PURE__ */ s(Q, { as: "div", padding: "small medium", borderWidth: "0 0 small 0", children: /* @__PURE__ */ v(x, { justifyItems: "space-between", alignItems: "center", children: [
|
|
807
807
|
/* @__PURE__ */ s(Ne, { level: "h3", children: o.notebook }),
|
|
808
808
|
/* @__PURE__ */ s(
|
|
809
|
-
|
|
809
|
+
pt,
|
|
810
810
|
{
|
|
811
811
|
screenReaderLabel: o.closeNotebookPanel,
|
|
812
812
|
onClick: n,
|
|
@@ -832,8 +832,8 @@ const ct = "notebook-tray-content", So = ({ children: t }) => {
|
|
|
832
832
|
borderColor: "secondary",
|
|
833
833
|
borderRadius: "medium",
|
|
834
834
|
shadow: "resting",
|
|
835
|
-
children: /* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */
|
|
835
|
+
children: /* @__PURE__ */ v(ce, { children: [
|
|
836
|
+
/* @__PURE__ */ v(
|
|
837
837
|
ce.Item,
|
|
838
838
|
{
|
|
839
839
|
ref: o,
|
|
@@ -844,7 +844,7 @@ const ct = "notebook-tray-content", So = ({ children: t }) => {
|
|
|
844
844
|
]
|
|
845
845
|
}
|
|
846
846
|
),
|
|
847
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ v(
|
|
848
848
|
ce.Item,
|
|
849
849
|
{
|
|
850
850
|
ref: r,
|
|
@@ -858,8 +858,8 @@ const ct = "notebook-tray-content", So = ({ children: t }) => {
|
|
|
858
858
|
] })
|
|
859
859
|
}
|
|
860
860
|
);
|
|
861
|
-
},
|
|
862
|
-
function
|
|
861
|
+
}, Se = "notebook-inline-reaction-menu";
|
|
862
|
+
function So({
|
|
863
863
|
containerRef: t,
|
|
864
864
|
highlightTheme: e,
|
|
865
865
|
debounceTime: n = 500,
|
|
@@ -872,24 +872,24 @@ function To({
|
|
|
872
872
|
api: a,
|
|
873
873
|
objectId: m,
|
|
874
874
|
objectType: c,
|
|
875
|
-
courseId:
|
|
875
|
+
courseId: y,
|
|
876
876
|
pageLastModifiedAt: d,
|
|
877
877
|
selectedNoteId: h,
|
|
878
878
|
isTrayOpen: b,
|
|
879
|
-
selectNote:
|
|
879
|
+
selectNote: p,
|
|
880
880
|
openTray: E
|
|
881
|
-
} =
|
|
881
|
+
} = ct(), { translations: g } = J(), { data: Y } = st({
|
|
882
882
|
api: a,
|
|
883
|
-
courseId:
|
|
883
|
+
courseId: y,
|
|
884
884
|
learningObject: { type: c, id: m }
|
|
885
|
-
}), { mutate: j } = Vt(a), { mutateAsync: N } = en(a), { mutate:
|
|
885
|
+
}), { mutate: j } = Vt(a), { mutateAsync: N } = en(a), { mutate: I } = Zt(a), P = B([]), [$, _] = U([]), [T, L] = U(null), [C, F] = U(""), [Z, V] = U(null), ae = B(null);
|
|
886
886
|
ae.current = Z;
|
|
887
887
|
const [ee, re] = U(!1);
|
|
888
888
|
W(() => {
|
|
889
889
|
const w = t.current;
|
|
890
890
|
if (!w) return;
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
891
|
+
const S = w.closest(".user_content") ?? w;
|
|
892
|
+
if (S.classList.contains("enhanced")) {
|
|
893
893
|
re(!0);
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
@@ -900,16 +900,16 @@ function To({
|
|
|
900
900
|
return;
|
|
901
901
|
}
|
|
902
902
|
});
|
|
903
|
-
return G.observe(
|
|
903
|
+
return G.observe(S, { attributes: !0, attributeFilter: ["class"] }), () => G.disconnect();
|
|
904
904
|
}, [t]);
|
|
905
905
|
const z = K(() => {
|
|
906
906
|
V(null), L(null), F("");
|
|
907
907
|
}, []);
|
|
908
908
|
W(() => {
|
|
909
909
|
if (!ee || !t.current) return;
|
|
910
|
-
let
|
|
910
|
+
let S = null;
|
|
911
911
|
const G = () => {
|
|
912
|
-
|
|
912
|
+
S && clearTimeout(S), S = setTimeout(() => {
|
|
913
913
|
var Me;
|
|
914
914
|
const R = window.getSelection(), u = t.current;
|
|
915
915
|
if (!(R != null && R.rangeCount) || !u) return;
|
|
@@ -918,11 +918,11 @@ function To({
|
|
|
918
918
|
const q = R.getRangeAt(0);
|
|
919
919
|
if (!u.contains(q.commonAncestorContainer)) return;
|
|
920
920
|
const Fe = (Me = ie.fromRange(u, q)) == null ? void 0 : Me.toSelector();
|
|
921
|
-
Fe && !
|
|
921
|
+
Fe && !Gt(Fe, $) && (L(q.cloneRange()), F(k), V(Ht(q)));
|
|
922
922
|
}, n);
|
|
923
923
|
}, M = (R) => {
|
|
924
924
|
if (!(R.target instanceof Node)) return;
|
|
925
|
-
const u = document.getElementById(
|
|
925
|
+
const u = document.getElementById(Se);
|
|
926
926
|
u != null && u.contains(R.target) ? (R.preventDefault(), R.stopImmediatePropagation()) : z();
|
|
927
927
|
}, A = () => {
|
|
928
928
|
z();
|
|
@@ -930,15 +930,15 @@ function To({
|
|
|
930
930
|
R.key === "Escape" && ae.current !== null && (z(), R.stopImmediatePropagation());
|
|
931
931
|
};
|
|
932
932
|
return document.addEventListener("selectionchange", G), document.addEventListener("mousedown", M), document.addEventListener("touchstart", M), document.addEventListener("keydown", D), window.addEventListener("scroll", A, !0), () => {
|
|
933
|
-
|
|
933
|
+
S && clearTimeout(S), document.removeEventListener("selectionchange", G), document.removeEventListener("mousedown", M), document.removeEventListener("touchstart", M), document.removeEventListener("keydown", D), window.removeEventListener("scroll", A, !0);
|
|
934
934
|
};
|
|
935
935
|
}, [ee, $, n, t, z]);
|
|
936
936
|
const se = K(
|
|
937
937
|
(w) => {
|
|
938
938
|
var u;
|
|
939
|
-
const
|
|
940
|
-
if (!
|
|
941
|
-
const { highlightData: G, reaction: M, id: A } = w, { range: D } = G, R = D && ((u = le.fromSelector(
|
|
939
|
+
const S = t.current;
|
|
940
|
+
if (!S || !w.highlightData) return null;
|
|
941
|
+
const { highlightData: G, reaction: M, id: A } = w, { range: D } = G, R = D && ((u = le.fromSelector(S, D)) == null ? void 0 : u.toRange());
|
|
942
942
|
if (R) {
|
|
943
943
|
const k = M[0] === O.IMPORTANT ? g.important : g.unclear, q = {
|
|
944
944
|
id: A,
|
|
@@ -946,21 +946,21 @@ function To({
|
|
|
946
946
|
type: M[0],
|
|
947
947
|
isTrayOpen: b,
|
|
948
948
|
labelPrefix: `${g.notebookNote} (${k})`,
|
|
949
|
-
popupId:
|
|
949
|
+
popupId: dt,
|
|
950
950
|
onClick: () => {
|
|
951
|
-
|
|
951
|
+
p(A), E();
|
|
952
952
|
}
|
|
953
953
|
};
|
|
954
954
|
return Xt(R, q, e), G.textPosition;
|
|
955
955
|
}
|
|
956
956
|
return null;
|
|
957
957
|
},
|
|
958
|
-
[t, h, b, e, g,
|
|
958
|
+
[t, h, b, e, g, p, E]
|
|
959
959
|
);
|
|
960
960
|
W(() => {
|
|
961
961
|
if (!ee || !Y || !t.current) return;
|
|
962
|
-
const w = t.current,
|
|
963
|
-
if (
|
|
962
|
+
const w = t.current, S = Y.notes, G = /* @__PURE__ */ new Set(), M = [], A = [];
|
|
963
|
+
if (S.length === 0) {
|
|
964
964
|
if (P.current.length > 0) {
|
|
965
965
|
for (const D of P.current)
|
|
966
966
|
je(D, w);
|
|
@@ -968,24 +968,24 @@ function To({
|
|
|
968
968
|
}
|
|
969
969
|
return;
|
|
970
970
|
}
|
|
971
|
-
if (d &&
|
|
972
|
-
const { notesForUpdate: D, noteIdsForDelete: R } =
|
|
971
|
+
if (d && S[0].highlightData.pageLastModifiedAt !== d) {
|
|
972
|
+
const { notesForUpdate: D, noteIdsForDelete: R } = Bt(
|
|
973
973
|
w,
|
|
974
|
-
|
|
974
|
+
S,
|
|
975
975
|
d
|
|
976
976
|
);
|
|
977
977
|
for (const u of D)
|
|
978
978
|
N({ id: u.id, input: u }).catch((k) => r == null ? void 0 : r(k));
|
|
979
979
|
for (const u of R)
|
|
980
|
-
|
|
980
|
+
I(u, { onError: i });
|
|
981
981
|
} else {
|
|
982
|
-
for (const D of
|
|
982
|
+
for (const D of S) {
|
|
983
983
|
const R = se(D);
|
|
984
984
|
G.add(D.id), R && (M.push(D), A.push(R));
|
|
985
985
|
}
|
|
986
986
|
for (const D of P.current)
|
|
987
987
|
G.has(D.id) || je(D, w);
|
|
988
|
-
_(A), P.current = M, h &&
|
|
988
|
+
_(A), P.current = M, h && $t(h);
|
|
989
989
|
}
|
|
990
990
|
}, [
|
|
991
991
|
ee,
|
|
@@ -994,22 +994,22 @@ function To({
|
|
|
994
994
|
d,
|
|
995
995
|
t,
|
|
996
996
|
N,
|
|
997
|
-
|
|
997
|
+
I,
|
|
998
998
|
h
|
|
999
999
|
]);
|
|
1000
1000
|
const H = (w) => {
|
|
1001
|
-
const
|
|
1002
|
-
if (!
|
|
1003
|
-
const G = le.fromRange(
|
|
1001
|
+
const S = t.current;
|
|
1002
|
+
if (!T || !S) return;
|
|
1003
|
+
const G = le.fromRange(S, T), M = ie.fromRange(S, T);
|
|
1004
1004
|
j(
|
|
1005
1005
|
{
|
|
1006
|
-
courseId:
|
|
1006
|
+
courseId: y,
|
|
1007
1007
|
objectId: m,
|
|
1008
1008
|
objectType: c,
|
|
1009
1009
|
userText: "",
|
|
1010
1010
|
reaction: [w],
|
|
1011
1011
|
highlightData: {
|
|
1012
|
-
selectedText:
|
|
1012
|
+
selectedText: C,
|
|
1013
1013
|
textPosition: (M == null ? void 0 : M.toSelector()) ?? null,
|
|
1014
1014
|
range: G.toSelector(),
|
|
1015
1015
|
pageLastModifiedAt: d ?? ""
|
|
@@ -1019,17 +1019,17 @@ function To({
|
|
|
1019
1019
|
onSuccess: (A) => {
|
|
1020
1020
|
var R;
|
|
1021
1021
|
const D = A.id;
|
|
1022
|
-
z(), (R = window.getSelection()) == null || R.removeAllRanges(),
|
|
1022
|
+
z(), (R = window.getSelection()) == null || R.removeAllRanges(), p(D), E(), l == null || l(A);
|
|
1023
1023
|
},
|
|
1024
1024
|
onError: o
|
|
1025
1025
|
}
|
|
1026
1026
|
);
|
|
1027
1027
|
};
|
|
1028
|
-
return !
|
|
1028
|
+
return !T || !Z ? null : mt(
|
|
1029
1029
|
/* @__PURE__ */ s(
|
|
1030
1030
|
"div",
|
|
1031
1031
|
{
|
|
1032
|
-
id:
|
|
1032
|
+
id: Se,
|
|
1033
1033
|
role: "toolbar",
|
|
1034
1034
|
style: {
|
|
1035
1035
|
position: "fixed",
|
|
@@ -1039,8 +1039,8 @@ function To({
|
|
|
1039
1039
|
whiteSpace: "nowrap"
|
|
1040
1040
|
},
|
|
1041
1041
|
onBlur: (w) => {
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1042
|
+
const S = document.getElementById(Se);
|
|
1043
|
+
S != null && S.contains(w.relatedTarget) || z();
|
|
1044
1044
|
},
|
|
1045
1045
|
children: /* @__PURE__ */ s(jn, { onSelectReaction: H })
|
|
1046
1046
|
}
|
|
@@ -1069,10 +1069,10 @@ const Wn = (t, e) => ({
|
|
|
1069
1069
|
lineHeight: "normal"
|
|
1070
1070
|
};
|
|
1071
1071
|
return /* @__PURE__ */ s("span", { "data-note-highlight": "true", style: l, children: t });
|
|
1072
|
-
},
|
|
1072
|
+
}, ut = () => {
|
|
1073
1073
|
const { translations: t } = J();
|
|
1074
|
-
return /* @__PURE__ */
|
|
1075
|
-
/* @__PURE__ */ s(x.Item, { as: "div", children: /* @__PURE__ */ s(
|
|
1074
|
+
return /* @__PURE__ */ v(x, { gap: "xx-small", alignItems: "start", as: "div", children: [
|
|
1075
|
+
/* @__PURE__ */ s(x.Item, { as: "div", children: /* @__PURE__ */ s(Nt, { color: "error" }) }),
|
|
1076
1076
|
/* @__PURE__ */ s(x.Item, { padding: "xxx-small none", shouldShrink: !0, children: /* @__PURE__ */ s(Ce, { maxLines: 3, children: t.highlightUnavailable }) })
|
|
1077
1077
|
] });
|
|
1078
1078
|
}, zn = {
|
|
@@ -1118,11 +1118,11 @@ function vo({
|
|
|
1118
1118
|
focusNoteId: i
|
|
1119
1119
|
}) {
|
|
1120
1120
|
var se;
|
|
1121
|
-
const [l, a] = Qe(qn, zn), { filter: m, courseFilter: c, currentPage:
|
|
1121
|
+
const [l, a] = Qe(qn, zn), { filter: m, courseFilter: c, currentPage: y, totalPages: d } = l;
|
|
1122
1122
|
W(() => {
|
|
1123
1123
|
a({ type: "SET_PAGE", payload: 1 });
|
|
1124
1124
|
}, [r]);
|
|
1125
|
-
const h = n ? c : e, b = (
|
|
1125
|
+
const h = n ? c : e, b = (y - 1) * r, p = !!o, E = {
|
|
1126
1126
|
...h ? { courseId: h } : {},
|
|
1127
1127
|
...m ? { reactions: [m] } : {},
|
|
1128
1128
|
...o ? { learningObject: o } : {}
|
|
@@ -1130,21 +1130,21 @@ function vo({
|
|
|
1130
1130
|
data: g,
|
|
1131
1131
|
isLoading: Y,
|
|
1132
1132
|
isError: j
|
|
1133
|
-
} =
|
|
1133
|
+
} = rt({
|
|
1134
1134
|
api: t,
|
|
1135
1135
|
filter: E,
|
|
1136
1136
|
offset: b,
|
|
1137
1137
|
pageSize: r,
|
|
1138
|
-
enabled: !
|
|
1138
|
+
enabled: !p
|
|
1139
1139
|
}), {
|
|
1140
1140
|
data: N,
|
|
1141
|
-
isLoading:
|
|
1141
|
+
isLoading: I,
|
|
1142
1142
|
isError: P
|
|
1143
|
-
} =
|
|
1143
|
+
} = st({
|
|
1144
1144
|
api: t,
|
|
1145
1145
|
courseId: h ?? void 0,
|
|
1146
1146
|
learningObject: o,
|
|
1147
|
-
enabled:
|
|
1147
|
+
enabled: p
|
|
1148
1148
|
}), $ = me(() => {
|
|
1149
1149
|
const H = (N == null ? void 0 : N.notes) ?? [];
|
|
1150
1150
|
return m ? H.filter((w) => w.reaction.includes(m)) : H;
|
|
@@ -1155,13 +1155,13 @@ function vo({
|
|
|
1155
1155
|
return;
|
|
1156
1156
|
}
|
|
1157
1157
|
if (_.current === i) return;
|
|
1158
|
-
const H = $.findIndex((
|
|
1158
|
+
const H = $.findIndex((S) => S.id === i);
|
|
1159
1159
|
if (H === -1) return;
|
|
1160
1160
|
_.current = i;
|
|
1161
1161
|
const w = Math.floor(H / r) + 1;
|
|
1162
|
-
w !==
|
|
1163
|
-
}, [i, $, r,
|
|
1164
|
-
const
|
|
1162
|
+
w !== y && a({ type: "FOCUS_PAGE", payload: w });
|
|
1163
|
+
}, [i, $, r, y]);
|
|
1164
|
+
const T = p ? $.slice(b, b + r) : (g == null ? void 0 : g.notes) ?? [], L = p ? I : Y, C = p ? P : j, F = p ? Math.max(1, Math.ceil($.length / r)) : ((se = g == null ? void 0 : g.pageInfo) == null ? void 0 : se.totalNrOfPages) ?? void 0, Z = p ? { totalCount: $.length, totalNrOfPages: F } : g == null ? void 0 : g.pageInfo;
|
|
1165
1165
|
W(() => {
|
|
1166
1166
|
a({ type: "SET_TOTAL_PAGES", payload: F });
|
|
1167
1167
|
}, [F]);
|
|
@@ -1183,13 +1183,13 @@ function vo({
|
|
|
1183
1183
|
a({ type: "SET_COURSE_FILTER", payload: H });
|
|
1184
1184
|
}, []);
|
|
1185
1185
|
return {
|
|
1186
|
-
notes:
|
|
1186
|
+
notes: T,
|
|
1187
1187
|
pageInfo: Z,
|
|
1188
1188
|
isLoading: L,
|
|
1189
|
-
isError:
|
|
1189
|
+
isError: C,
|
|
1190
1190
|
filter: m,
|
|
1191
1191
|
courseFilter: c,
|
|
1192
|
-
currentPage:
|
|
1192
|
+
currentPage: y,
|
|
1193
1193
|
totalPages: d,
|
|
1194
1194
|
setFilter: re,
|
|
1195
1195
|
setCourseFilter: z,
|
|
@@ -1232,8 +1232,8 @@ function Io({ filter: t, setFilter: e }) {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
1234
1234
|
const { translations: e } = J(), n = t ? e.nothingHereYet : e.emptyStateHeading, o = t ? e.adjustFiltersOrCreate : e.emptyStateDescription;
|
|
1235
|
-
return /* @__PURE__ */ s(Q, { as: "div", textAlign: "center", children: /* @__PURE__ */
|
|
1236
|
-
!t && /* @__PURE__ */ s(
|
|
1235
|
+
return /* @__PURE__ */ s(Q, { as: "div", textAlign: "center", children: /* @__PURE__ */ v(x, { direction: "column", alignItems: "center", gap: "small", children: [
|
|
1236
|
+
!t && /* @__PURE__ */ s(bt, { size: "medium" }),
|
|
1237
1237
|
/* @__PURE__ */ s(Ne, { level: "h3", children: n }),
|
|
1238
1238
|
/* @__PURE__ */ s(te, { color: "secondary", children: o })
|
|
1239
1239
|
] }) });
|
|
@@ -1248,8 +1248,8 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1248
1248
|
translationKey: "unclear",
|
|
1249
1249
|
icon: /* @__PURE__ */ s(we, { size: "x-small" })
|
|
1250
1250
|
}
|
|
1251
|
-
},
|
|
1252
|
-
const { translations: o } = J(), r = Xn[t], i = o[r.translationKey], [l, a] = U(!1), m = B(null), c = B(null),
|
|
1251
|
+
}, ft = ({ type: t, onTypeChange: e, renderAsMenuTrigger: n = !1 }) => {
|
|
1252
|
+
const { translations: o } = J(), r = Xn[t], i = o[r.translationKey], [l, a] = U(!1), m = B(null), c = B(null), y = B(null), d = K(
|
|
1253
1253
|
(h) => {
|
|
1254
1254
|
e == null || e(h), a(!1);
|
|
1255
1255
|
},
|
|
@@ -1257,16 +1257,16 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1257
1257
|
);
|
|
1258
1258
|
return W(() => {
|
|
1259
1259
|
if (!l) return;
|
|
1260
|
-
const h = (
|
|
1261
|
-
|
|
1262
|
-
}, b = (
|
|
1260
|
+
const h = (p) => {
|
|
1261
|
+
p.key === "Escape" && p.stopPropagation();
|
|
1262
|
+
}, b = (p) => {
|
|
1263
1263
|
var E;
|
|
1264
|
-
|
|
1264
|
+
p.key === "Escape" && (p.stopPropagation(), a(!1), (E = y.current) == null || E.focus());
|
|
1265
1265
|
};
|
|
1266
1266
|
return document.addEventListener("keydown", h, !0), document.addEventListener("keyup", b, !0), () => {
|
|
1267
1267
|
document.removeEventListener("keydown", h, !0), document.removeEventListener("keyup", b, !0);
|
|
1268
1268
|
};
|
|
1269
|
-
}, [l]), n && e ? /* @__PURE__ */
|
|
1269
|
+
}, [l]), n && e ? /* @__PURE__ */ v(
|
|
1270
1270
|
ce,
|
|
1271
1271
|
{
|
|
1272
1272
|
placement: "bottom start",
|
|
@@ -1280,17 +1280,17 @@ const Kn = ({ hasActiveFilter: t = !1 }) => {
|
|
|
1280
1280
|
color: r.color,
|
|
1281
1281
|
renderIcon: r.icon,
|
|
1282
1282
|
elementRef: (h) => {
|
|
1283
|
-
|
|
1283
|
+
y.current = h;
|
|
1284
1284
|
},
|
|
1285
1285
|
children: i
|
|
1286
1286
|
}
|
|
1287
1287
|
),
|
|
1288
1288
|
children: [
|
|
1289
|
-
/* @__PURE__ */
|
|
1289
|
+
/* @__PURE__ */ v(ce.Item, { ref: m, onClick: () => d(O.CONFUSING), children: [
|
|
1290
1290
|
/* @__PURE__ */ s(we, { size: "x-small" }),
|
|
1291
1291
|
` ${o.markUnclear}`
|
|
1292
1292
|
] }),
|
|
1293
|
-
/* @__PURE__ */
|
|
1293
|
+
/* @__PURE__ */ v(ce.Item, { ref: c, onClick: () => d(O.IMPORTANT), children: [
|
|
1294
1294
|
/* @__PURE__ */ s(Oe, { size: "x-small" }),
|
|
1295
1295
|
` ${o.markImportant}`
|
|
1296
1296
|
] })
|
|
@@ -1316,19 +1316,19 @@ const Qn = ({
|
|
|
1316
1316
|
onSaveNote: a,
|
|
1317
1317
|
onTypeChange: m,
|
|
1318
1318
|
isActive: c,
|
|
1319
|
-
isPanelView:
|
|
1319
|
+
isPanelView: y = !1,
|
|
1320
1320
|
courseName: d,
|
|
1321
1321
|
locale: h,
|
|
1322
1322
|
highlightTheme: b,
|
|
1323
|
-
renderLink:
|
|
1323
|
+
renderLink: p,
|
|
1324
1324
|
href: E
|
|
1325
1325
|
}) => {
|
|
1326
|
-
const { translations: g } = J(), [Y, j] = U(!1), [N,
|
|
1326
|
+
const { translations: g } = J(), [Y, j] = U(!1), [N, I] = U(!1), [P, $] = U(o || ""), [_, T] = U(!1), [L, C] = U(!1), [F, Z] = U(!1), V = B(null), ae = K((u) => {
|
|
1327
1327
|
V.current = u;
|
|
1328
1328
|
}, []), ee = B(null), re = B(null), z = B(!1), se = B(null), H = B(null), w = B(!1);
|
|
1329
1329
|
W(() => {
|
|
1330
1330
|
var u, k;
|
|
1331
|
-
c ? ((u = V.current) == null || u.scrollIntoView({ behavior: "smooth", block: "nearest" }), (k = V.current) == null || k.focus()) :
|
|
1331
|
+
c ? ((u = V.current) == null || u.scrollIntoView({ behavior: "smooth", block: "nearest" }), (k = V.current) == null || k.focus()) : T(!1);
|
|
1332
1332
|
}, [c]), W(() => {
|
|
1333
1333
|
var u, k;
|
|
1334
1334
|
N ? (z.current = !0, (u = ee.current) == null || u.focus()) : z.current && (z.current = !1, (k = re.current) == null || k.focus());
|
|
@@ -1339,25 +1339,25 @@ const Qn = ({
|
|
|
1339
1339
|
u != null && u.isConnected && u.focus();
|
|
1340
1340
|
}
|
|
1341
1341
|
}, [_]);
|
|
1342
|
-
const
|
|
1343
|
-
w.current = !k,
|
|
1342
|
+
const S = K((u, k) => {
|
|
1343
|
+
w.current = !k, T(!1);
|
|
1344
1344
|
}, []);
|
|
1345
1345
|
W(() => {
|
|
1346
1346
|
if (!_) return;
|
|
1347
1347
|
const u = (q) => {
|
|
1348
1348
|
q.key === "Escape" && q.stopPropagation();
|
|
1349
1349
|
}, k = (q) => {
|
|
1350
|
-
q.key === "Escape" && (q.stopPropagation(),
|
|
1350
|
+
q.key === "Escape" && (q.stopPropagation(), S());
|
|
1351
1351
|
};
|
|
1352
1352
|
return window.addEventListener("keydown", u, !0), window.addEventListener("keyup", k, !0), () => {
|
|
1353
1353
|
window.removeEventListener("keydown", u, !0), window.removeEventListener("keyup", k, !0);
|
|
1354
1354
|
};
|
|
1355
|
-
}, [_,
|
|
1355
|
+
}, [_, S]);
|
|
1356
1356
|
const G = r === O.IMPORTANT ? g.important : g.unclear, M = (u) => {
|
|
1357
1357
|
u.key === "Enter" && (u.preventDefault(), i == null || i());
|
|
1358
1358
|
}, A = [g.note, G];
|
|
1359
1359
|
A.push(n || g.highlightUnavailable), o && A.push(o), e && A.push(ze(e, h)), d && A.push(d);
|
|
1360
|
-
const D = A.join(", "), R = /* @__PURE__ */
|
|
1360
|
+
const D = A.join(", "), R = /* @__PURE__ */ v(
|
|
1361
1361
|
Q,
|
|
1362
1362
|
{
|
|
1363
1363
|
as: "div",
|
|
@@ -1386,16 +1386,16 @@ const Qn = ({
|
|
|
1386
1386
|
height: "100%",
|
|
1387
1387
|
opacity: c && _ && l ? 0.25 : void 0
|
|
1388
1388
|
},
|
|
1389
|
-
children: /* @__PURE__ */
|
|
1389
|
+
children: /* @__PURE__ */ v(x, { direction: "column", gap: "small", height: "100%", children: [
|
|
1390
1390
|
/* @__PURE__ */ s(
|
|
1391
|
-
|
|
1391
|
+
ft,
|
|
1392
1392
|
{
|
|
1393
1393
|
type: r,
|
|
1394
|
-
onTypeChange:
|
|
1395
|
-
renderAsMenuTrigger:
|
|
1394
|
+
onTypeChange: y && m ? (u) => m(t, u) : void 0,
|
|
1395
|
+
renderAsMenuTrigger: y && !!m && !!c
|
|
1396
1396
|
}
|
|
1397
1397
|
),
|
|
1398
|
-
n ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(te, { children: c &&
|
|
1398
|
+
n ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: /* @__PURE__ */ s(te, { children: c && y ? /* @__PURE__ */ s(
|
|
1399
1399
|
xe,
|
|
1400
1400
|
{
|
|
1401
1401
|
type: r,
|
|
@@ -1403,9 +1403,9 @@ const Qn = ({
|
|
|
1403
1403
|
theme: b,
|
|
1404
1404
|
children: n
|
|
1405
1405
|
}
|
|
1406
|
-
) : /* @__PURE__ */
|
|
1407
|
-
L && /* @__PURE__ */ s(
|
|
1408
|
-
/* @__PURE__ */ s("span", { "aria-hidden": L, style: { display: "block" }, children: /* @__PURE__ */ s(Ce, { maxLines: 3, truncate: "word", onUpdate:
|
|
1406
|
+
) : /* @__PURE__ */ v(qe, { children: [
|
|
1407
|
+
L && /* @__PURE__ */ s(Te, { children: n }),
|
|
1408
|
+
/* @__PURE__ */ s("span", { "aria-hidden": L, style: { display: "block" }, children: /* @__PURE__ */ s(Ce, { maxLines: 3, truncate: "word", onUpdate: C, children: /* @__PURE__ */ s(
|
|
1409
1409
|
xe,
|
|
1410
1410
|
{
|
|
1411
1411
|
type: r,
|
|
@@ -1414,13 +1414,13 @@ const Qn = ({
|
|
|
1414
1414
|
children: n
|
|
1415
1415
|
}
|
|
1416
1416
|
) }) })
|
|
1417
|
-
] }) }) }) : /* @__PURE__ */ s(
|
|
1418
|
-
/* @__PURE__ */ s(x.Item, { shouldGrow: !0, children: /* @__PURE__ */
|
|
1419
|
-
N &&
|
|
1417
|
+
] }) }) }) : /* @__PURE__ */ s(ut, {}),
|
|
1418
|
+
/* @__PURE__ */ s(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ v(x, { direction: "column", gap: "small", height: "100%", children: [
|
|
1419
|
+
N && y ? /* @__PURE__ */ v(x, { direction: "column", gap: "x-small", margin: "xx-small", children: [
|
|
1420
1420
|
/* @__PURE__ */ s(
|
|
1421
1421
|
Ye,
|
|
1422
1422
|
{
|
|
1423
|
-
label: /* @__PURE__ */ s(
|
|
1423
|
+
label: /* @__PURE__ */ s(Te, { children: g.editNote }),
|
|
1424
1424
|
value: P,
|
|
1425
1425
|
onChange: (u) => $(u.target.value),
|
|
1426
1426
|
placeholder: g.addNoteOptional,
|
|
@@ -1429,7 +1429,7 @@ const Qn = ({
|
|
|
1429
1429
|
}
|
|
1430
1430
|
}
|
|
1431
1431
|
),
|
|
1432
|
-
/* @__PURE__ */
|
|
1432
|
+
/* @__PURE__ */ v(x, { gap: "xx-small", children: [
|
|
1433
1433
|
/* @__PURE__ */ s(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1434
1434
|
ne,
|
|
1435
1435
|
{
|
|
@@ -1437,7 +1437,7 @@ const Qn = ({
|
|
|
1437
1437
|
size: "small",
|
|
1438
1438
|
"data-testid": `note-card-${t}-cancel`,
|
|
1439
1439
|
onClick: () => {
|
|
1440
|
-
$(o || ""),
|
|
1440
|
+
$(o || ""), I(!1);
|
|
1441
1441
|
},
|
|
1442
1442
|
children: g.cancel
|
|
1443
1443
|
}
|
|
@@ -1450,13 +1450,13 @@ const Qn = ({
|
|
|
1450
1450
|
size: "small",
|
|
1451
1451
|
"data-testid": `note-card-${t}-save`,
|
|
1452
1452
|
onClick: () => {
|
|
1453
|
-
a == null || a(t, P.trim()),
|
|
1453
|
+
a == null || a(t, P.trim()), I(!1);
|
|
1454
1454
|
},
|
|
1455
1455
|
children: g.save
|
|
1456
1456
|
}
|
|
1457
1457
|
) })
|
|
1458
1458
|
] })
|
|
1459
|
-
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c &&
|
|
1459
|
+
] }) : o ? /* @__PURE__ */ s("div", { style: { wordBreak: "break-word", overflowWrap: "break-word" }, children: c && y ? /* @__PURE__ */ v(te, { children: [
|
|
1460
1460
|
o,
|
|
1461
1461
|
" ",
|
|
1462
1462
|
/* @__PURE__ */ s(
|
|
@@ -1472,15 +1472,15 @@ const Qn = ({
|
|
|
1472
1472
|
re.current = u;
|
|
1473
1473
|
},
|
|
1474
1474
|
onClick: (u) => {
|
|
1475
|
-
u.stopPropagation(),
|
|
1475
|
+
u.stopPropagation(), I(!0);
|
|
1476
1476
|
},
|
|
1477
1477
|
children: /* @__PURE__ */ s(Ie, {})
|
|
1478
1478
|
}
|
|
1479
1479
|
)
|
|
1480
|
-
] }) : /* @__PURE__ */
|
|
1481
|
-
F && /* @__PURE__ */ s(
|
|
1480
|
+
] }) : /* @__PURE__ */ v(te, { children: [
|
|
1481
|
+
F && /* @__PURE__ */ s(Te, { children: o }),
|
|
1482
1482
|
/* @__PURE__ */ s("span", { "aria-hidden": F, style: { display: "block" }, children: /* @__PURE__ */ s(Ce, { maxLines: 3, truncate: "word", onUpdate: Z, children: o }) })
|
|
1483
|
-
] }) }) :
|
|
1483
|
+
] }) }) : y && c ? /* @__PURE__ */ s("div", { children: /* @__PURE__ */ v(te, { color: "secondary", children: [
|
|
1484
1484
|
g.addNotePrompt,
|
|
1485
1485
|
" ",
|
|
1486
1486
|
/* @__PURE__ */ s(
|
|
@@ -1496,13 +1496,13 @@ const Qn = ({
|
|
|
1496
1496
|
re.current = u;
|
|
1497
1497
|
},
|
|
1498
1498
|
onClick: (u) => {
|
|
1499
|
-
u.stopPropagation(),
|
|
1499
|
+
u.stopPropagation(), I(!0);
|
|
1500
1500
|
},
|
|
1501
1501
|
children: /* @__PURE__ */ s(Ie, {})
|
|
1502
1502
|
}
|
|
1503
1503
|
)
|
|
1504
1504
|
] }) }) : null,
|
|
1505
|
-
/* @__PURE__ */
|
|
1505
|
+
/* @__PURE__ */ v(x, { justifyItems: "space-between", alignItems: "center", margin: "auto 0 0 0", children: [
|
|
1506
1506
|
/* @__PURE__ */ s(te, { as: "div", size: "small", color: "secondary", children: ze(e, h) }),
|
|
1507
1507
|
c && l && /* @__PURE__ */ s(
|
|
1508
1508
|
ue,
|
|
@@ -1518,7 +1518,7 @@ const Qn = ({
|
|
|
1518
1518
|
se.current = u;
|
|
1519
1519
|
},
|
|
1520
1520
|
onClick: (u) => {
|
|
1521
|
-
u.stopPropagation(), w.current = !1,
|
|
1521
|
+
u.stopPropagation(), w.current = !1, T(!0);
|
|
1522
1522
|
},
|
|
1523
1523
|
children: /* @__PURE__ */ s(ye, {})
|
|
1524
1524
|
}
|
|
@@ -1539,7 +1539,7 @@ const Qn = ({
|
|
|
1539
1539
|
}
|
|
1540
1540
|
),
|
|
1541
1541
|
c && _ && l && /* @__PURE__ */ s(
|
|
1542
|
-
|
|
1542
|
+
Tt,
|
|
1543
1543
|
{
|
|
1544
1544
|
open: !0,
|
|
1545
1545
|
as: "div",
|
|
@@ -1550,7 +1550,7 @@ const Qn = ({
|
|
|
1550
1550
|
shouldCloseOnDocumentClick: !0,
|
|
1551
1551
|
shouldCloseOnEscape: !1,
|
|
1552
1552
|
shouldReturnFocus: !1,
|
|
1553
|
-
onDismiss:
|
|
1553
|
+
onDismiss: S,
|
|
1554
1554
|
children: /* @__PURE__ */ s(
|
|
1555
1555
|
Q,
|
|
1556
1556
|
{
|
|
@@ -1562,7 +1562,7 @@ const Qn = ({
|
|
|
1562
1562
|
insetInlineStart: "0",
|
|
1563
1563
|
insetInlineEnd: "0",
|
|
1564
1564
|
stacking: "above",
|
|
1565
|
-
children: /* @__PURE__ */
|
|
1565
|
+
children: /* @__PURE__ */ v(
|
|
1566
1566
|
x,
|
|
1567
1567
|
{
|
|
1568
1568
|
direction: "column",
|
|
@@ -1590,7 +1590,7 @@ const Qn = ({
|
|
|
1590
1590
|
renderIcon: /* @__PURE__ */ s(ye, {}),
|
|
1591
1591
|
"data-testid": `note-card-${t}-confirm-delete`,
|
|
1592
1592
|
onClick: (u) => {
|
|
1593
|
-
u.stopPropagation(), l(t),
|
|
1593
|
+
u.stopPropagation(), l(t), T(!1);
|
|
1594
1594
|
},
|
|
1595
1595
|
children: g.deleteNote
|
|
1596
1596
|
}
|
|
@@ -1610,7 +1610,7 @@ const Qn = ({
|
|
|
1610
1610
|
H.current = u;
|
|
1611
1611
|
},
|
|
1612
1612
|
onClick: (u) => {
|
|
1613
|
-
u.stopPropagation(),
|
|
1613
|
+
u.stopPropagation(), S();
|
|
1614
1614
|
},
|
|
1615
1615
|
children: g.cancel
|
|
1616
1616
|
}
|
|
@@ -1625,7 +1625,7 @@ const Qn = ({
|
|
|
1625
1625
|
]
|
|
1626
1626
|
}
|
|
1627
1627
|
);
|
|
1628
|
-
return E &&
|
|
1628
|
+
return E && p ? p({ href: E, children: R, ariaLabel: D }) : R;
|
|
1629
1629
|
}, Yn = {
|
|
1630
1630
|
display: "grid",
|
|
1631
1631
|
gap: "1rem",
|
|
@@ -1645,74 +1645,74 @@ const Qn = ({
|
|
|
1645
1645
|
onNoteDelete: a,
|
|
1646
1646
|
onNoteSave: m,
|
|
1647
1647
|
onNoteTypeChange: c,
|
|
1648
|
-
onNotesEmptied:
|
|
1648
|
+
onNotesEmptied: y,
|
|
1649
1649
|
selectedNoteId: d,
|
|
1650
1650
|
hasActiveFilter: h = !1,
|
|
1651
1651
|
columnCount: b = 1,
|
|
1652
|
-
highlightTheme:
|
|
1652
|
+
highlightTheme: p,
|
|
1653
1653
|
locale: E,
|
|
1654
1654
|
courseNames: g,
|
|
1655
1655
|
renderNoteLink: Y,
|
|
1656
1656
|
noteHref: j
|
|
1657
1657
|
}) => {
|
|
1658
|
-
const { translations: N } = J(),
|
|
1659
|
-
(
|
|
1660
|
-
const L = t.findIndex((F) => F.id ===
|
|
1661
|
-
let
|
|
1662
|
-
t.length > 1 && (
|
|
1658
|
+
const { translations: N } = J(), I = B(null), P = B(null), $ = K(
|
|
1659
|
+
(T) => {
|
|
1660
|
+
const L = t.findIndex((F) => F.id === T);
|
|
1661
|
+
let C = null;
|
|
1662
|
+
t.length > 1 && (C = L > 0 ? t[L - 1].id : t[1].id), P.current = { targetId: C }, a == null || a(T);
|
|
1663
1663
|
},
|
|
1664
1664
|
[t, a]
|
|
1665
1665
|
);
|
|
1666
1666
|
if (W(() => {
|
|
1667
1667
|
var L;
|
|
1668
|
-
const
|
|
1669
|
-
if (
|
|
1670
|
-
if (P.current = null,
|
|
1671
|
-
|
|
1668
|
+
const T = P.current;
|
|
1669
|
+
if (T)
|
|
1670
|
+
if (P.current = null, T.targetId === null)
|
|
1671
|
+
y == null || y();
|
|
1672
1672
|
else {
|
|
1673
|
-
const
|
|
1674
|
-
`[data-testid="note-card-${
|
|
1673
|
+
const C = (L = I.current) == null ? void 0 : L.querySelector(
|
|
1674
|
+
`[data-testid="note-card-${T.targetId}"]`
|
|
1675
1675
|
);
|
|
1676
|
-
|
|
1676
|
+
C == null || C.focus();
|
|
1677
1677
|
}
|
|
1678
|
-
}, [t,
|
|
1679
|
-
return /* @__PURE__ */ s(Q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(
|
|
1678
|
+
}, [t, y]), e)
|
|
1679
|
+
return /* @__PURE__ */ s(Q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-loading", children: /* @__PURE__ */ s(vt, { renderTitle: N.loadingNotes }) });
|
|
1680
1680
|
if (n)
|
|
1681
1681
|
return /* @__PURE__ */ s(Q, { as: "div", textAlign: "center", padding: "large", "data-testid": "notes-error", children: /* @__PURE__ */ s(Ne, { level: "h4", children: N.failedToLoadNotes }) });
|
|
1682
1682
|
if (t.length === 0)
|
|
1683
1683
|
return /* @__PURE__ */ s(Q, { as: "div", padding: "large", "data-testid": "empty-notes", children: /* @__PURE__ */ s(Kn, { hasActiveFilter: h }) });
|
|
1684
1684
|
const _ = typeof o == "number" && typeof r == "number" && r > 1 && i !== void 0;
|
|
1685
|
-
return /* @__PURE__ */
|
|
1685
|
+
return /* @__PURE__ */ v(qe, { children: [
|
|
1686
1686
|
/* @__PURE__ */ s(
|
|
1687
1687
|
"ul",
|
|
1688
1688
|
{
|
|
1689
|
-
ref:
|
|
1689
|
+
ref: I,
|
|
1690
1690
|
style: { ...Yn, gridTemplateColumns: `repeat(${b}, minmax(0, 1fr))` },
|
|
1691
1691
|
role: "list",
|
|
1692
1692
|
"data-testid": "notes-grid",
|
|
1693
|
-
children: t.map((
|
|
1693
|
+
children: t.map((T) => {
|
|
1694
1694
|
var L;
|
|
1695
1695
|
return /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(
|
|
1696
1696
|
Qn,
|
|
1697
1697
|
{
|
|
1698
|
-
noteId:
|
|
1699
|
-
date:
|
|
1700
|
-
type:
|
|
1701
|
-
highlight: (L =
|
|
1702
|
-
note:
|
|
1703
|
-
isActive: d ===
|
|
1698
|
+
noteId: T.id,
|
|
1699
|
+
date: T.createdAt,
|
|
1700
|
+
type: T.reaction[0] ?? O.IMPORTANT,
|
|
1701
|
+
highlight: (L = T.highlightData) == null ? void 0 : L.selectedText,
|
|
1702
|
+
note: T.userText,
|
|
1703
|
+
isActive: d === T.id,
|
|
1704
1704
|
isPanelView: !!d,
|
|
1705
|
-
onClick: l ? () => l(
|
|
1705
|
+
onClick: l ? () => l(T.id) : void 0,
|
|
1706
1706
|
onDelete: a ? $ : void 0,
|
|
1707
|
-
onSaveNote: m ? (
|
|
1708
|
-
onTypeChange: c ? (
|
|
1709
|
-
highlightTheme:
|
|
1707
|
+
onSaveNote: m ? (C, F) => m(C, F) : void 0,
|
|
1708
|
+
onTypeChange: c ? (C, F) => c(C, F) : void 0,
|
|
1709
|
+
highlightTheme: p,
|
|
1710
1710
|
locale: E,
|
|
1711
|
-
courseName: g == null ? void 0 : g.get(
|
|
1711
|
+
courseName: g == null ? void 0 : g.get(T.courseId),
|
|
1712
1712
|
renderLink: Y,
|
|
1713
|
-
href: j ? j(
|
|
1713
|
+
href: j ? j(T.id, T) : void 0
|
|
1714
1714
|
}
|
|
1715
|
-
) },
|
|
1715
|
+
) }, T.id);
|
|
1716
1716
|
})
|
|
1717
1717
|
}
|
|
1718
1718
|
),
|
|
@@ -1740,11 +1740,11 @@ const Qn = ({
|
|
|
1740
1740
|
onBack: a,
|
|
1741
1741
|
editing: m = !1
|
|
1742
1742
|
}) => {
|
|
1743
|
-
const { translations: c } = J(), [
|
|
1744
|
-
return /* @__PURE__ */
|
|
1745
|
-
n != null ? /* @__PURE__ */ s(Q, { as: "div", children: /* @__PURE__ */ s(te, { children: /* @__PURE__ */ s(xe, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ s(
|
|
1746
|
-
/* @__PURE__ */ s(
|
|
1747
|
-
|
|
1743
|
+
const { translations: c } = J(), [y, d] = U(m), [h, b] = U(t || ""), [p, E] = U(!1);
|
|
1744
|
+
return /* @__PURE__ */ v(x, { direction: "column", gap: "small", "data-testid": "single-note", children: [
|
|
1745
|
+
n != null ? /* @__PURE__ */ s(Q, { as: "div", children: /* @__PURE__ */ s(te, { children: /* @__PURE__ */ s(xe, { type: e, isCardActive: !0, theme: o, children: n }) }) }) : /* @__PURE__ */ s(ut, {}),
|
|
1746
|
+
/* @__PURE__ */ s(ft, { type: e, onTypeChange: l, renderAsMenuTrigger: !!l }),
|
|
1747
|
+
y ? /* @__PURE__ */ v(x, { direction: "column", gap: "x-small", children: [
|
|
1748
1748
|
/* @__PURE__ */ s(
|
|
1749
1749
|
Ye,
|
|
1750
1750
|
{
|
|
@@ -1754,7 +1754,7 @@ const Qn = ({
|
|
|
1754
1754
|
resize: "vertical"
|
|
1755
1755
|
}
|
|
1756
1756
|
),
|
|
1757
|
-
/* @__PURE__ */
|
|
1757
|
+
/* @__PURE__ */ v(x, { gap: "xx-small", children: [
|
|
1758
1758
|
/* @__PURE__ */ s(x.Item, { shouldGrow: !0, children: /* @__PURE__ */ s(
|
|
1759
1759
|
ne,
|
|
1760
1760
|
{
|
|
@@ -1781,23 +1781,23 @@ const Qn = ({
|
|
|
1781
1781
|
}
|
|
1782
1782
|
) })
|
|
1783
1783
|
] })
|
|
1784
|
-
] }) : /* @__PURE__ */
|
|
1785
|
-
t && /* @__PURE__ */
|
|
1784
|
+
] }) : /* @__PURE__ */ v(x, { direction: "column", gap: "small", children: [
|
|
1785
|
+
t && /* @__PURE__ */ v(Q, { as: "div", children: [
|
|
1786
1786
|
/* @__PURE__ */ s(Ne, { level: "h4", margin: "0 0 xx-small 0", children: c.note }),
|
|
1787
1787
|
/* @__PURE__ */ s(te, { children: t })
|
|
1788
1788
|
] }),
|
|
1789
|
-
/* @__PURE__ */
|
|
1789
|
+
/* @__PURE__ */ v(x, { justifyItems: "space-between", children: [
|
|
1790
1790
|
/* @__PURE__ */ s(
|
|
1791
1791
|
ne,
|
|
1792
1792
|
{
|
|
1793
1793
|
size: "small",
|
|
1794
|
-
renderIcon: /* @__PURE__ */ s(
|
|
1794
|
+
renderIcon: /* @__PURE__ */ s(Et, {}),
|
|
1795
1795
|
"data-testid": "single-note-back",
|
|
1796
1796
|
onClick: () => a == null ? void 0 : a(),
|
|
1797
1797
|
children: c.back
|
|
1798
1798
|
}
|
|
1799
1799
|
),
|
|
1800
|
-
/* @__PURE__ */
|
|
1800
|
+
/* @__PURE__ */ v(x, { gap: "xx-small", children: [
|
|
1801
1801
|
i && /* @__PURE__ */ s(
|
|
1802
1802
|
ue,
|
|
1803
1803
|
{
|
|
@@ -1825,7 +1825,7 @@ const Qn = ({
|
|
|
1825
1825
|
)
|
|
1826
1826
|
] })
|
|
1827
1827
|
] }),
|
|
1828
|
-
|
|
1828
|
+
p && i && /* @__PURE__ */ s(Q, { as: "div", background: "primary", padding: "medium", borderRadius: "large", children: /* @__PURE__ */ v(x, { direction: "column", justifyItems: "center", alignItems: "center", gap: "x-small", children: [
|
|
1829
1829
|
/* @__PURE__ */ s(
|
|
1830
1830
|
ne,
|
|
1831
1831
|
{
|
|
@@ -1855,24 +1855,24 @@ const Qn = ({
|
|
|
1855
1855
|
] });
|
|
1856
1856
|
};
|
|
1857
1857
|
export {
|
|
1858
|
-
|
|
1858
|
+
So as ContentWithNoteWrapper,
|
|
1859
1859
|
xe as Highlight,
|
|
1860
|
-
|
|
1860
|
+
ut as HighlightError,
|
|
1861
1861
|
Qn as NoteCard,
|
|
1862
|
-
|
|
1862
|
+
ft as NoteChip,
|
|
1863
1863
|
jn as NoteReactionMenu,
|
|
1864
1864
|
Kn as NotebookEmptyState,
|
|
1865
1865
|
Eo as NotebookProvider,
|
|
1866
1866
|
Hn as NotebookTranslationsProvider,
|
|
1867
|
-
|
|
1867
|
+
To as NotebookTray,
|
|
1868
1868
|
Co as NotesListView,
|
|
1869
1869
|
O as REACTION_TYPE,
|
|
1870
1870
|
xo as SingleNote,
|
|
1871
1871
|
Pe as createTransparentColor,
|
|
1872
1872
|
Vt as useCreateNote,
|
|
1873
1873
|
Zt as useDeleteNote,
|
|
1874
|
-
|
|
1875
|
-
|
|
1874
|
+
rt as useGetNotes,
|
|
1875
|
+
ct as useNotebook,
|
|
1876
1876
|
J as useNotebookTranslations,
|
|
1877
1877
|
vo as useNotesData,
|
|
1878
1878
|
Io as useReactionFilter,
|