@digabi/exam-engine-core 23.5.0 → 23.5.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/__tests__/annotations.test.d.ts +2 -0
- package/dist/__tests__/annotations.test.d.ts.map +1 -0
- package/dist/__tests__/annotations.test.js +306 -0
- package/dist/__tests__/annotations.test.js.map +1 -0
- package/dist/__tests__/playwright/Annotations.test.js +0 -50
- package/dist/__tests__/playwright/Annotations.test.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/assets/closeButton.svg +1 -0
- package/dist/assets/collapse.svg +12 -0
- package/dist/assets/expand.svg +12 -0
- package/dist/assets/helpButton.svg +9 -0
- package/dist/assets/redoButton.svg +5 -0
- package/dist/assets/undoButton.svg +5 -0
- package/dist/components/context/AnnotationProvider.d.ts +1 -5
- package/dist/components/context/AnnotationProvider.d.ts.map +1 -1
- package/dist/components/context/AnnotationProvider.js +12 -12
- package/dist/components/context/AnnotationProvider.js.map +1 -1
- package/dist/components/grading/examAnnotationUtils.d.ts.map +1 -1
- package/dist/components/grading/examAnnotationUtils.js +63 -50
- package/dist/components/grading/examAnnotationUtils.js.map +1 -1
- package/dist/components/results/DNDAnswerContainer.d.ts +4 -0
- package/dist/components/results/DNDAnswerContainer.d.ts.map +1 -0
- package/dist/components/results/DNDAnswerContainer.js +22 -0
- package/dist/components/results/DNDAnswerContainer.js.map +1 -0
- package/dist/components/shared/Formula.d.ts.map +1 -1
- package/dist/components/shared/Formula.js +11 -37
- package/dist/components/shared/Formula.js.map +1 -1
- package/dist/components/shared/Reference.d.ts.map +1 -1
- package/dist/components/shared/Reference.js +10 -7
- package/dist/components/shared/Reference.js.map +1 -1
- package/dist/components/shared/markText.d.ts +1 -1
- package/dist/components/shared/markText.d.ts.map +1 -1
- package/dist/components/shared/markText.js +8 -4
- package/dist/components/shared/markText.js.map +1 -1
- package/dist/eslint.config.d.ts +22 -0
- package/dist/eslint.config.d.ts.map +1 -0
- package/dist/eslint.config.js +31 -0
- package/dist/eslint.config.js.map +1 -0
- package/dist/i18n/exam_titles_fi-FI.d.ts +46 -0
- package/dist/i18n/exam_titles_fi-FI.d.ts.map +1 -0
- package/dist/i18n/exam_titles_fi-FI.js +46 -0
- package/dist/i18n/exam_titles_fi-FI.js.map +1 -0
- package/dist/i18n/exam_titles_fi-FI.json +45 -0
- package/dist/i18n/exam_titles_sv-FI.d.ts +46 -0
- package/dist/i18n/exam_titles_sv-FI.d.ts.map +1 -0
- package/dist/i18n/exam_titles_sv-FI.js +46 -0
- package/dist/i18n/exam_titles_sv-FI.js.map +1 -0
- package/dist/i18n/exam_titles_sv-FI.json +45 -0
- package/dist/i18n/exams.d.ts +11 -0
- package/dist/i18n/exams.d.ts.map +1 -0
- package/dist/i18n/exams.js +10 -0
- package/dist/i18n/exams.js.map +1 -0
- package/dist/main-bundle.js +1 -1
- package/dist/main.css +1 -1
- package/package.json +2 -2
@@ -0,0 +1 @@
|
|
1
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="30" height="30" viewBox="0 0 30 30"><defs><clipPath id="clip-path"><path d="M141.57-89.324v-2.34H143.2v2.34A2.3,2.3,0,0,1,140.9-87.03H130.1a2.3,2.3,0,0,1-2.292-2.294v-17.029a2.294,2.294,0,0,1,2.292-2.292h10.8a2.3,2.3,0,0,1,2.295,2.292v2.342H141.57v-2.342a.669.669,0,0,0-.67-.667H130.1a.667.667,0,0,0-.667.667v17.029a.668.668,0,0,0,.667.669h10.8A.67.67,0,0,0,141.57-89.324Zm3.271-13.579a1.069,1.069,0,0,1,1.825-.755l5.065,5.065a1.065,1.065,0,0,1,0,1.511l-5.065,5.067a1.07,1.07,0,0,1-1.825-.757v-2.412h-6.633a2.3,2.3,0,0,1-2.3-2.3v-.7a2.3,2.3,0,0,1,2.3-2.3h6.633V-102.9" fill="none" clip-rule="evenodd"/></clipPath><clipPath id="clip-path-2"><ellipse cx="10" cy="-29.606" rx="15" ry="14.933" fill="none"/></clipPath></defs><title>closeButton</title><rect width="30" height="30" fill="#fff" opacity="0"/><line x1="25" y1="5" x2="5" y2="25" fill="none" stroke="#6d6d6d" stroke-miterlimit="10" stroke-width="3"/><line x1="5" y1="5" x2="25" y2="25" fill="none" stroke="#6d6d6d" stroke-miterlimit="10" stroke-width="3"/></svg>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<svg width="19px" height="12px" viewBox="0 0 19 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3
|
+
<!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
|
4
|
+
<title>Page 1</title>
|
5
|
+
<desc>Created with Sketch.</desc>
|
6
|
+
<defs></defs>
|
7
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
8
|
+
<g id="Kuuntelu-kokelas-painaa-nappia-Copy-18" transform="translate(-1068.000000, -19.000000)" stroke-width="3" stroke="#359BB7">
|
9
|
+
<polyline id="Page-1" transform="translate(1077.999981, 26.000000) rotate(180.000000) translate(-1077.999981, -26.000000) " points="1085.99996 22 1077.99996 30 1070 22"></polyline>
|
10
|
+
</g>
|
11
|
+
</g>
|
12
|
+
</svg>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<svg width="18px" height="12px" viewBox="0 0 18 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
3
|
+
<!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
|
4
|
+
<title>Page 1</title>
|
5
|
+
<desc>Created with Sketch.</desc>
|
6
|
+
<defs></defs>
|
7
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
8
|
+
<g id="Kuuntelu-kokelas-painaa-nappia-Copy-18" transform="translate(-1069.000000, -21.000000)" stroke-width="3" stroke="#359BB7">
|
9
|
+
<polyline id="Page-1" points="1085.99996 22 1077.99996 30 1070 22"></polyline>
|
10
|
+
</g>
|
11
|
+
</g>
|
12
|
+
</svg>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<svg version="1.1"
|
2
|
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
3
|
+
x="0px" y="0px" width="20px" height="20px" viewBox="0 0 20 20" enable-background="new 0 0 20 20" xml:space="preserve">
|
4
|
+
<path fill="#359BB7" d="M10,20C4.48,20,0,15.52,0,10C0,4.48,4.48,0,10,0s10,4.48,10,10C20,15.52,15.52,20,10,20z M5.57,5.88
|
5
|
+
c-0.14,0.21-0.09,0.5,0.11,0.66l1.4,1.06c0.21,0.16,0.51,0.12,0.67-0.09c0.72-0.91,1.21-1.44,2.31-1.44c0.82,0,1.84,0.53,1.84,1.33
|
6
|
+
c0,0.6-0.5,0.91-1.31,1.37c-0.95,0.53-2.2,1.19-2.2,2.85v0.16c0,0.27,0.22,0.48,0.48,0.48h2.26c0.27,0,0.48-0.22,0.48-0.48v-0.05
|
7
|
+
c0-1.15,3.35-1.2,3.35-4.3c0-2.34-2.43-4.11-4.7-4.11C8.07,3.31,6.67,4.23,5.57,5.88z M8.15,15.16c0,1.02,0.83,1.85,1.85,1.85
|
8
|
+
s1.85-0.83,1.85-1.85s-0.83-1.85-1.85-1.85S8.15,14.14,8.15,15.16z"/>
|
9
|
+
</svg>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20px" height="20px" viewBox="0 0 20 20" version="1.1">
|
2
|
+
<g id="surface1">
|
3
|
+
<path fill="#359BB7" d="M 18.316406 1.253906 C 18.859375 1.253906 19.378906 1.675781 19.378906 2.3125 L 19.378906 8.007812 C 19.378906 8.421875 19.042969 8.757812 18.628906 8.757812 L 12.9375 8.757812 C 12.300781 8.757812 11.882812 8.238281 11.882812 7.695312 C 11.882812 7.4375 11.976562 7.171875 12.191406 6.957031 L 13.953125 5.195312 C 12.851562 4.289062 11.460938 3.761719 9.996094 3.761719 C 6.554688 3.761719 3.753906 6.5625 3.753906 10.003906 C 3.753906 13.449219 6.554688 16.246094 9.996094 16.246094 C 12.851562 16.246094 13.488281 14.75 14.492188 14.75 C 15.214844 14.75 15.742188 15.335938 15.742188 15.996094 C 15.742188 17.367188 12.554688 18.75 10 18.75 C 5.179688 18.75 1.253906 14.824219 1.253906 10.003906 C 1.253906 5.183594 5.179688 1.265625 10 1.265625 C 12.132812 1.265625 14.148438 2.0625 15.71875 3.425781 L 17.578125 1.566406 C 17.792969 1.351562 18.058594 1.253906 18.316406 1.253906 Z M 18.316406 1.253906 "/>
|
4
|
+
</g>
|
5
|
+
</svg>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20px" height="20px" viewBox="0 0 20 20" version="1.1">
|
2
|
+
<g id="surface1">
|
3
|
+
<path fill="#359BB7" d="M 18.75 10 C 18.75 14.820312 14.824219 18.746094 10.003906 18.746094 C 8.097656 18.746094 6.285156 18.136719 4.761719 16.992188 C 4.210938 16.578125 4.097656 15.796875 4.511719 15.242188 C 4.925781 14.691406 5.707031 14.582031 6.261719 14.996094 C 7.351562 15.8125 8.644531 16.242188 10.007812 16.242188 C 13.449219 16.242188 16.25 13.441406 16.25 10 C 16.25 6.558594 13.449219 3.757812 10.007812 3.757812 C 8.542969 3.757812 7.152344 4.285156 6.050781 5.1875 L 7.8125 6.953125 C 8.476562 7.617188 8.007812 8.753906 7.066406 8.753906 L 1.375 8.753906 C 0.960938 8.753906 0.625 8.417969 0.625 8.003906 L 0.625 2.304688 C 0.625 1.367188 1.761719 0.898438 2.425781 1.5625 L 4.285156 3.421875 C 5.855469 2.058594 7.871094 1.253906 10.003906 1.253906 C 14.824219 1.253906 18.75 5.179688 18.75 10 Z M 18.75 10 "/>
|
4
|
+
</g>
|
5
|
+
</svg>
|
@@ -1,9 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { AnnotationPart, ExamImageAnnotation, NewExamAnnotation, WithAnnotationId } from '../../types/ExamAnnotations';
|
3
3
|
import { AnnotationProps } from '../exam/Exam';
|
4
|
-
interface Props {
|
5
|
-
children: React.ReactNode;
|
6
|
-
}
|
7
4
|
export type AnnotationContextType = {
|
8
5
|
annotationsEnabled: true;
|
9
6
|
newAnnotation: NewExamAnnotation | null;
|
@@ -18,6 +15,5 @@ export type AnnotationContextType = {
|
|
18
15
|
export declare const AnnotationContext: React.Context<AnnotationContextType | {
|
19
16
|
annotationsEnabled: false;
|
20
17
|
}>;
|
21
|
-
export declare const AnnotationProvider: ({ children, annotations, onClickAnnotation, onSaveAnnotation }:
|
22
|
-
export {};
|
18
|
+
export declare const AnnotationProvider: ({ children, annotations, onClickAnnotation, onSaveAnnotation }: React.PropsWithChildren<AnnotationProps>) => string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
23
19
|
//# sourceMappingURL=AnnotationProvider.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AnnotationProvider.d.ts","sourceRoot":"","sources":["../../../src/components/context/AnnotationProvider.tsx"],"names":[],"mappings":"AACA,OAAO,
|
1
|
+
{"version":3,"file":"AnnotationProvider.d.ts","sourceRoot":"","sources":["../../../src/components/context/AnnotationProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AACtH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAI9C,MAAM,MAAM,qBAAqB,GAAG;IAClC,kBAAkB,EAAE,IAAI,CAAA;IACxB,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACvC,gBAAgB,EAAE,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAA;IACvD,gBAAgB,EAAE,WAAW,GAAG,IAAI,CAAA;IACpC,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;IACtD,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;IACnE,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAAA;IACvD,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/F,gBAAgB,EAAE,CAAC,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAClG,CAAA;AAED,eAAO,MAAM,iBAAiB;wBAAqE,KAAK;EAEtG,CAAA;AAEF,eAAO,MAAM,kBAAkB,mEAK5B,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,iGAgB1C,CAAA"}
|
@@ -1,29 +1,29 @@
|
|
1
1
|
import * as _ from 'lodash-es';
|
2
|
-
import React, { useMemo } from 'react';
|
2
|
+
import React, { useCallback, useMemo } from 'react';
|
3
3
|
import { onMouseDownForAnnotation } from '../grading/examAnnotationUtils';
|
4
4
|
import { AnnotationPopup } from '../shared/AnnotationPopup';
|
5
5
|
export const AnnotationContext = React.createContext({
|
6
6
|
annotationsEnabled: false
|
7
7
|
});
|
8
8
|
export const AnnotationProvider = ({ children, annotations, onClickAnnotation, onSaveAnnotation }) => {
|
9
|
+
const annotationsEnabled = !!annotations && !!onClickAnnotation && !!onSaveAnnotation;
|
10
|
+
if (!annotationsEnabled) {
|
11
|
+
return children;
|
12
|
+
}
|
13
|
+
return (React.createElement(AnnotationContextProvider, { annotations: annotations, onClickAnnotation: onClickAnnotation, onSaveAnnotation: onSaveAnnotation }, children));
|
14
|
+
};
|
15
|
+
function AnnotationContextProvider({ children, annotations, onClickAnnotation, onSaveAnnotation }) {
|
9
16
|
const [newAnnotation, setNewAnnotation] = React.useState(null);
|
10
17
|
const [newAnnotationRef, setNewAnnotationRef] = React.useState(null);
|
11
|
-
const
|
12
|
-
setNewAnnotation(annotation);
|
13
|
-
};
|
14
|
-
function onMouseDown(e) {
|
18
|
+
const onMouseDown = useCallback((e) => {
|
15
19
|
const target = e.target;
|
16
20
|
const clickIsInPopup = !!target.closest('.e-popup');
|
17
21
|
if (!clickIsInPopup) {
|
18
22
|
setNewAnnotation(null);
|
19
23
|
setNewAnnotationRef(null);
|
20
24
|
}
|
21
|
-
onMouseDownForAnnotation(e,
|
22
|
-
}
|
23
|
-
const annotationsEnabled = !!annotations && !!onClickAnnotation && !!onSaveAnnotation;
|
24
|
-
if (!annotationsEnabled) {
|
25
|
-
return children;
|
26
|
-
}
|
25
|
+
onMouseDownForAnnotation(e, setNewAnnotation);
|
26
|
+
}, [setNewAnnotation, setNewAnnotationRef, onMouseDownForAnnotation]);
|
27
27
|
const textAnnotations = useMemo(() => _.groupBy(annotations.flatMap(a => {
|
28
28
|
if (a.annotationType === 'text') {
|
29
29
|
return a.annotationParts.map((p, index, arr) => {
|
@@ -59,5 +59,5 @@ export const AnnotationProvider = ({ children, annotations, onClickAnnotation, o
|
|
59
59
|
React.createElement("span", { onMouseDown: onMouseDown },
|
60
60
|
React.createElement(AnnotationPopup, null),
|
61
61
|
children)));
|
62
|
-
}
|
62
|
+
}
|
63
63
|
//# sourceMappingURL=AnnotationProvider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AnnotationProvider.js","sourceRoot":"","sources":["../../../src/components/context/AnnotationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"AnnotationProvider.js","sourceRoot":"","sources":["../../../src/components/context/AnnotationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAGnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAc3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAwD;IAC1G,kBAAkB,EAAE,KAAK;CAC1B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EACyB,EAAE,EAAE;IAC7C,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,iBAAiB,IAAI,CAAC,CAAC,gBAAgB,CAAA;IAErF,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,OAAO,CACL,oBAAC,yBAAyB,IACxB,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,gBAAgB,EAAE,gBAAgB,IAEjC,QAAQ,CACiB,CAC7B,CAAA;AACH,CAAC,CAAA;AAQD,SAAS,yBAAyB,CAAC,EACjC,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EACoC;IACpD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAA2B,IAAI,CAAC,CAAA;IACxF,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,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AgB,CACxB,EACH,CAAC,WAAW,CAAC,CACd,CAAA;IAED,MAAM,gBAAgB,GAA8C,OAAO,CACzE,GAAG,EAAE,CACH,CAAC,CAAC,OAAO,CACP,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QACtB,IAAI,CAAC,CAAC,cAAc,KAAK,OAAO,EAAE,CAAC;YACjC,OAAO,CAAC,CAAA;QACV,CAAC;QACD,OAAO,EAAE,CAAA;IACX,CAAC,CAAC,EACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CACxB,EACH,CAAC,WAAW,CAAC,CACd,CAAA;IAED,OAAO,CACL,oBAAC,iBAAiB,CAAC,QAAQ,IACzB,KAAK,EAAE;YACL,kBAAkB,EAAE,IAAI;YACxB,eAAe,EAAE,eAAe;YAChC,gBAAgB,EAAE,gBAAgB;YAClC,iBAAiB;YACjB,gBAAgB;YAChB,aAAa;YACb,gBAAgB;YAChB,gBAAgB;YAChB,mBAAmB;SACpB;QAED,8BAAM,WAAW,EAAE,WAAW;YAC5B,oBAAC,eAAe,OAAG;YAClB,QAAQ,CACJ,CACoB,CAC9B,CAAA;AACH,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"examAnnotationUtils.d.ts","sourceRoot":"","sources":["../../../src/components/grading/examAnnotationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAkB,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAG/E,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,
|
1
|
+
{"version":3,"file":"examAnnotationUtils.d.ts","sourceRoot":"","sources":["../../../src/components/grading/examAnnotationUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAkB,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAG/E,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,QA8C5G"}
|
@@ -1,17 +1,19 @@
|
|
1
1
|
import { textAnnotationFromRange } from './editAnnotations';
|
2
2
|
export function onMouseDownForAnnotation(e, mouseUpCallback) {
|
3
3
|
function onMouseUpAfterAnswerMouseDown() {
|
4
|
+
var _a, _b;
|
4
5
|
window.removeEventListener('mouseup', onMouseUpAfterAnswerMouseDown);
|
5
6
|
/**
|
6
7
|
* selection.anchorNode = where mouse is pressed down (chronologically first)
|
7
8
|
* selection.getRangeAt(0).startContainer = where selection starts (first in DOM)
|
8
9
|
*/
|
9
10
|
const selection = window.getSelection();
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
const initialStartNode = (_a = selection === null || selection === void 0 ? void 0 : selection.anchorNode) === null || _a === void 0 ? void 0 : _a.parentElement;
|
12
|
+
const initialEndNode = (_b = selection === null || selection === void 0 ? void 0 : selection.focusNode) === null || _b === void 0 ? void 0 : _b.parentElement;
|
13
|
+
if (selection && initialStartNode && initialEndNode && selection.toString().length > 0) {
|
14
|
+
const isReversed = initialStartNode.compareDocumentPosition(initialEndNode) & Node.DOCUMENT_POSITION_PRECEDING;
|
15
|
+
const startNode = findAnnotatableNode(initialStartNode, isReversed ? 'previousElementSibling' : 'nextElementSibling');
|
16
|
+
const endNode = findAnnotatableNode(initialEndNode, isReversed ? 'nextElementSibling' : 'previousElementSibling');
|
15
17
|
const hasMarks = selectionContainsNonhiddenMarks(selection);
|
16
18
|
const startNodedisplayNumber = getDisplayNumber(startNode);
|
17
19
|
const endNodeDisplayNumber = getDisplayNumber(endNode);
|
@@ -35,6 +37,19 @@ export function onMouseDownForAnnotation(e, mouseUpCallback) {
|
|
35
37
|
}
|
36
38
|
window.addEventListener('mouseup', onMouseUpAfterAnswerMouseDown);
|
37
39
|
}
|
40
|
+
const findAnnotatableNode = (node, siblingDirection) => {
|
41
|
+
if (node.matches('.e-annotatable')) {
|
42
|
+
return node;
|
43
|
+
}
|
44
|
+
const sibling = node[siblingDirection];
|
45
|
+
if (sibling instanceof HTMLElement) {
|
46
|
+
if (sibling.matches('.e-annotatable')) {
|
47
|
+
return sibling;
|
48
|
+
}
|
49
|
+
return sibling.querySelector('.e-annotatable') || findAnnotatableNode(sibling, siblingDirection);
|
50
|
+
}
|
51
|
+
return node;
|
52
|
+
};
|
38
53
|
const selectionContainsNonhiddenMarks = (selection) => {
|
39
54
|
const rangeChildren = Array.from(selection === null || selection === void 0 ? void 0 : selection.getRangeAt(0).cloneContents().children);
|
40
55
|
const childIsNonHiddenMark = rangeChildren === null || rangeChildren === void 0 ? void 0 : rangeChildren.some(child => child.tagName === 'MARK' && child.getAttribute('data-hidden') === 'false');
|
@@ -44,67 +59,65 @@ const selectionContainsNonhiddenMarks = (selection) => {
|
|
44
59
|
const getDisplayNumber = (node) => { var _a; return (_a = node === null || node === void 0 ? void 0 : node.closest('[data-annotation-anchor]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-annotation-anchor'); };
|
45
60
|
const isAnnotatable = (node) => (node === null || node === void 0 ? void 0 : node.getAttribute('data-annotation-path')) && node.tagName !== 'MARK';
|
46
61
|
const extractAnnotationsFromSelection = (selection) => {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
const
|
55
|
-
|
56
|
-
|
57
|
-
return annotations;
|
58
|
-
if (rangeElements.length === 0) {
|
59
|
-
const annotationAnchor = firstNode.getAttribute('data-annotation-path');
|
60
|
-
if (!annotationAnchor)
|
61
|
-
return annotations;
|
62
|
-
const startAndLength = textAnnotationFromRange(firstNode, range);
|
63
|
-
annotations.push({
|
62
|
+
var _a, _b;
|
63
|
+
const range = selection.getRangeAt(0);
|
64
|
+
const rangeChildren = Array.from(selection === null || selection === void 0 ? void 0 : selection.getRangeAt(0).cloneContents().children);
|
65
|
+
const firstSelectedNodeInDOM = range.startContainer.parentElement;
|
66
|
+
if (!(rangeChildren === null || rangeChildren === void 0 ? void 0 : rangeChildren.length)) {
|
67
|
+
// selection is plain text
|
68
|
+
const annotationAnchor = (_b = (_a = selection === null || selection === void 0 ? void 0 : selection.focusNode) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.getAttribute('data-annotation-path');
|
69
|
+
const startAndLength = textAnnotationFromRange(firstSelectedNodeInDOM, range);
|
70
|
+
return [
|
71
|
+
{
|
64
72
|
annotationAnchor,
|
65
|
-
selectedText: (
|
66
|
-
startIndex: (
|
67
|
-
length: (
|
68
|
-
}
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
73
|
+
selectedText: (selection === null || selection === void 0 ? void 0 : selection.toString()) || '',
|
74
|
+
startIndex: (startAndLength === null || startAndLength === void 0 ? void 0 : startAndLength.startIndex) || 0,
|
75
|
+
length: (startAndLength === null || startAndLength === void 0 ? void 0 : startAndLength.length) || 0
|
76
|
+
}
|
77
|
+
];
|
78
|
+
}
|
79
|
+
else {
|
80
|
+
// selection is in multiple elements
|
81
|
+
const annotations = rangeChildren === null || rangeChildren === void 0 ? void 0 : rangeChildren.reduce((acc, child, index, arr) => {
|
82
|
+
var _a;
|
83
|
+
const childsAnnotationPath = child.getAttribute('data-annotation-path');
|
84
|
+
const isLastRangeChild = index === arr.length - 1;
|
75
85
|
if (childsAnnotationPath) {
|
76
|
-
// child is an annotable node, like <span> text </span>
|
77
|
-
const textContent = (
|
78
|
-
const
|
86
|
+
// child is an annotable node, like <span> text </span>
|
87
|
+
const textContent = (_a = child.textContent) !== null && _a !== void 0 ? _a : '';
|
88
|
+
const newElement = {
|
79
89
|
annotationAnchor: childsAnnotationPath,
|
80
90
|
selectedText: textContent,
|
81
|
-
startIndex:
|
91
|
+
startIndex: index === 0 ? range.startOffset : 0,
|
82
92
|
length: isLastRangeChild ? range.endOffset : textContent.length
|
83
93
|
};
|
84
|
-
|
94
|
+
return [...acc, newElement];
|
85
95
|
}
|
86
96
|
else {
|
87
97
|
// child is a node with children, like <b> <span> text </span> </b>
|
88
|
-
const allChildrenWithAnnotationPath =
|
89
|
-
allChildrenWithAnnotationPath.forEach(
|
90
|
-
var _a
|
91
|
-
const dataAnnotationPath =
|
92
|
-
const textContent = (
|
98
|
+
const allChildrenWithAnnotationPath = child.querySelectorAll('[data-annotation-path]');
|
99
|
+
allChildrenWithAnnotationPath === null || allChildrenWithAnnotationPath === void 0 ? void 0 : allChildrenWithAnnotationPath.forEach((grandChild, kidIndex) => {
|
100
|
+
var _a;
|
101
|
+
const dataAnnotationPath = grandChild.getAttribute('data-annotation-path');
|
102
|
+
const textContent = (_a = grandChild.textContent) !== null && _a !== void 0 ? _a : '';
|
93
103
|
if (dataAnnotationPath) {
|
94
|
-
const
|
95
|
-
const
|
104
|
+
const isFirstOfAll = index === 0 && kidIndex === 0;
|
105
|
+
const isLastGrandChild = kidIndex === allChildrenWithAnnotationPath.length - 1;
|
106
|
+
const isLastOfAll = isLastRangeChild && isLastGrandChild;
|
107
|
+
const startAndLength = textAnnotationFromRange(firstSelectedNodeInDOM, range);
|
108
|
+
const newElement = {
|
96
109
|
annotationAnchor: dataAnnotationPath,
|
97
110
|
selectedText: textContent,
|
98
|
-
startIndex:
|
99
|
-
length:
|
111
|
+
startIndex: isFirstOfAll ? (startAndLength === null || startAndLength === void 0 ? void 0 : startAndLength.startIndex) || 0 : 0,
|
112
|
+
length: isLastOfAll ? range.endOffset : textContent.length
|
100
113
|
};
|
101
|
-
|
114
|
+
acc.push(newElement);
|
102
115
|
}
|
103
116
|
});
|
117
|
+
return acc;
|
104
118
|
}
|
105
|
-
});
|
119
|
+
}, []);
|
106
120
|
return annotations;
|
107
|
-
}
|
108
|
-
return annotations;
|
121
|
+
}
|
109
122
|
};
|
110
123
|
//# sourceMappingURL=examAnnotationUtils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"examAnnotationUtils.js","sourceRoot":"","sources":["../../../src/components/grading/examAnnotationUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,MAAM,UAAU,wBAAwB,CAAC,CAAmB,EAAE,eAA+C;IAC3G,SAAS,6BAA6B
|
1
|
+
{"version":3,"file":"examAnnotationUtils.js","sourceRoot":"","sources":["../../../src/components/grading/examAnnotationUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,MAAM,UAAU,wBAAwB,CAAC,CAAmB,EAAE,eAA+C;IAC3G,SAAS,6BAA6B;;QACpC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAA;QAEpE;;;WAGG;QAEH,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,EAAE,CAAA;QACvC,MAAM,gBAAgB,GAAG,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,0CAAE,aAAa,CAAA;QAC7D,MAAM,cAAc,GAAG,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,0CAAE,aAAa,CAAA;QAE1D,IAAI,SAAS,IAAI,gBAAgB,IAAI,cAAc,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvF,MAAM,UAAU,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,2BAA2B,CAAA;YAC9G,MAAM,SAAS,GAAG,mBAAmB,CACnC,gBAAgB,EAChB,UAAU,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,oBAAoB,CAC7D,CAAA;YACD,MAAM,OAAO,GAAG,mBAAmB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAA;YACjH,MAAM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AAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM;yBAC3D,CAAA;wBACD,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;oBACtB,CAAC;gBACH,CAAC,CAAC,CAAA;gBACF,OAAO,GAAG,CAAA;YACZ,CAAC;QACH,CAAC,EAAE,EAAsB,CAAC,CAAA;QAE1B,OAAO,WAAW,CAAA;IACpB,CAAC;AACH,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DNDAnswerContainer.d.ts","sourceRoot":"","sources":["../../../src/components/results/DNDAnswerContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAO1C,eAAO,MAAM,kBAAkB,kCAAmC,kBAAkB,sBAuCnF,CAAA"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import React, { useContext } from 'react';
|
2
|
+
import { query, queryAll } from '../../dom-utils';
|
3
|
+
import { ResultsContext } from '../context/ResultsContext';
|
4
|
+
import { getAnswerOptionIdsByQuestionId, getAnswerOptionsByOptionId } from '../exam/DNDAnswerContainer';
|
5
|
+
import { DNDTitleAndDroppable } from '../shared/DNDTitleAndDroppable';
|
6
|
+
import { CorrectDNDAnswers } from './CorrectDNDAnswers';
|
7
|
+
export const DNDAnswerContainer = ({ element, renderChildNodes }) => {
|
8
|
+
const { answersByQuestionId, gradingStructure } = useContext(ResultsContext);
|
9
|
+
const answerOptionIdsByQuestionId = getAnswerOptionIdsByQuestionId(element, answersByQuestionId);
|
10
|
+
const answerOptionsByOptionId = getAnswerOptionsByOptionId(element);
|
11
|
+
const dndAnswersWithQuestion = queryAll(element, 'dnd-answer').filter(e => !!query(e, 'dnd-answer-title'));
|
12
|
+
return (React.createElement("div", { className: "e-dnd-answer-container" }, dndAnswersWithQuestion.map(element => {
|
13
|
+
var _a;
|
14
|
+
const questionId = element.getAttribute('question-id');
|
15
|
+
const itemIds = answerOptionIdsByQuestionId[questionId] || [];
|
16
|
+
const answerOptionElements = (_a = (answerOptionIdsByQuestionId[questionId] || [])) === null || _a === void 0 ? void 0 : _a.map(id => (answerOptionsByOptionId === null || answerOptionsByOptionId === void 0 ? void 0 : answerOptionsByOptionId[id]) || null).filter(Boolean);
|
17
|
+
return (React.createElement(React.Fragment, { key: questionId },
|
18
|
+
React.createElement(DNDTitleAndDroppable, { key: questionId, element: element, answerOptionElements: answerOptionElements, renderChildNodes: renderChildNodes, itemIds: itemIds, page: "results" }),
|
19
|
+
gradingStructure && (React.createElement(CorrectDNDAnswers, { key: `${questionId}-correct`, element: element, renderChildNodes: renderChildNodes, answerOptionsById: answerOptionsByOptionId }))));
|
20
|
+
})));
|
21
|
+
};
|
22
|
+
//# sourceMappingURL=DNDAnswerContainer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DNDAnswerContainer.js","sourceRoot":"","sources":["../../../src/components/results/DNDAnswerContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,8BAA8B,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AACvG,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAsB,EAAE,EAAE;IACtF,MAAM,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IAC5E,MAAM,2BAA2B,GAAG,8BAA8B,CAAC,OAAO,EA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
|
1
|
-
{"version":3,"file":"Formula.d.ts","sourceRoot":"","sources":["../../../src/components/shared/Formula.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;
|
1
|
+
{"version":3,"file":"Formula.d.ts","sourceRoot":"","sources":["../../../src/components/shared/Formula.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAOjE,KAAK,KAAK,GAAG,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAA;;AAGzD,wBASE"}
|
@@ -3,8 +3,6 @@ import React, { useContext } from 'react';
|
|
3
3
|
import { getAttribute, getElementPath } from '../../dom-utils';
|
4
4
|
import { AnnotationContext } from '../context/AnnotationProvider';
|
5
5
|
import { IsInSidebarContext } from '../context/IsInSidebarContext';
|
6
|
-
import { isExistingAnnotation } from './markText';
|
7
|
-
import AnnotationMark from './AnnotationTextMark';
|
8
6
|
import HiddenAnnotationMark from './HiddenAnnotationMark';
|
9
7
|
import { AnnotationImageMark, useImageAnnotation } from './AnnotationImageMark';
|
10
8
|
// eslint-disable-next-line prefer-arrow-callback
|
@@ -18,9 +16,9 @@ export default React.memo(function Formula({ element, className }) {
|
|
18
16
|
});
|
19
17
|
// eslint-disable-next-line prefer-arrow-callback
|
20
18
|
const PlainFormula = React.memo(function PlainFormula(props) {
|
21
|
-
const { svg, assistiveTitle,
|
19
|
+
const { svg, assistiveTitle, isDisplayFormula } = useElementAttributes(props);
|
22
20
|
return (React.createElement(React.Fragment, null,
|
23
|
-
React.createElement("span", { className: className, dangerouslySetInnerHTML: { __html: svg }, "aria-hidden": "true" }),
|
21
|
+
React.createElement("span", { className: classNames('e-formula', { 'e-block e-text-center': isDisplayFormula }, props.className), dangerouslySetInnerHTML: { __html: svg }, "aria-hidden": "true" }),
|
24
22
|
React.createElement(AssistiveTitle, { assistiveTitle: assistiveTitle })));
|
25
23
|
});
|
26
24
|
// eslint-disable-next-line prefer-arrow-callback
|
@@ -29,26 +27,12 @@ const AssistiveTitle = React.memo(function AssistiveTitle({ assistiveTitle }) {
|
|
29
27
|
});
|
30
28
|
// eslint-disable-next-line prefer-arrow-callback
|
31
29
|
const AnnotatableFormula = React.memo(function AnnotatableFormula(props) {
|
32
|
-
var _a
|
33
|
-
const {
|
34
|
-
const { svg, assistiveTitle,
|
30
|
+
var _a;
|
31
|
+
const { imageAnnotations, onClickAnnotation, setNewAnnotationRef, newAnnotation, setNewAnnotation } = props.annotationContext;
|
32
|
+
const { svg, assistiveTitle, isDisplayFormula, textContent } = useElementAttributes(props);
|
35
33
|
const path = getElementPath(props.element);
|
36
34
|
const { elementRef, annotationRect, onMouseDown } = useImageAnnotation(path, `kaava ${textContent}`, setNewAnnotation);
|
37
|
-
const
|
38
|
-
...((_a = textAnnotations[path]) !== null && _a !== void 0 ? _a : []),
|
39
|
-
...((newAnnotation === null || newAnnotation === void 0 ? void 0 : newAnnotation.annotationType) === 'text'
|
40
|
-
? ((_c = (_b = newAnnotation === null || newAnnotation === void 0 ? void 0 : newAnnotation.annotationParts) === null || _b === void 0 ? void 0 : _b.filter(p => p.annotationAnchor === path)) !== null && _c !== void 0 ? _c : [])
|
41
|
-
: [])
|
42
|
-
];
|
43
|
-
const textMarks = textElementAnnotations.map(annotation => {
|
44
|
-
const annotationId = isExistingAnnotation(annotation) ? annotation.annotationId : null;
|
45
|
-
const key = `${annotationId !== null && annotationId !== void 0 ? annotationId : 0}_${annotation.startIndex}`;
|
46
|
-
if (annotation.hidden) {
|
47
|
-
return React.createElement(HiddenAnnotationMark, { key: key, annotationId: annotationId });
|
48
|
-
}
|
49
|
-
return (React.createElement(AnnotationMark, { key: key, annotation: annotation, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef, __html: svg }));
|
50
|
-
});
|
51
|
-
const imageMarks = ((_d = imageAnnotations[path]) !== null && _d !== void 0 ? _d : [])
|
35
|
+
const imageMarks = ((_a = imageAnnotations[path]) !== null && _a !== void 0 ? _a : [])
|
52
36
|
.map(({ annotationId, markNumber, resolved, hidden, rect }) => {
|
53
37
|
const key = `${annotationId}_${markNumber}`;
|
54
38
|
if (hidden) {
|
@@ -56,20 +40,11 @@ const AnnotatableFormula = React.memo(function AnnotatableFormula(props) {
|
|
56
40
|
}
|
57
41
|
return (React.createElement(AnnotationImageMark, { key: key, rect: rect, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef, annotationId: annotationId, markNumber: markNumber, resolved: resolved }));
|
58
42
|
})
|
59
|
-
.concat((newAnnotation === null || newAnnotation === void 0 ? void 0 : newAnnotation.annotationType) === 'image' && newAnnotation.annotationAnchor === path
|
60
|
-
? [
|
61
|
-
React.createElement(AnnotationImageMark, { key: "new-annotation-mark", rect: newAnnotation.rect, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef })
|
62
|
-
]
|
63
|
-
: [])
|
64
|
-
.concat(annotationRect
|
65
|
-
? [
|
66
|
-
React.createElement(AnnotationImageMark, { key: "annotation-rect", rect: annotationRect, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef })
|
67
|
-
]
|
68
|
-
: []);
|
43
|
+
.concat((newAnnotation === null || newAnnotation === void 0 ? void 0 : newAnnotation.annotationType) === 'image' && newAnnotation.annotationAnchor === path ? (React.createElement(AnnotationImageMark, { key: "new-annotation-mark", rect: newAnnotation.rect, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef })) : ([]))
|
44
|
+
.concat(annotationRect ? (React.createElement(AnnotationImageMark, { key: "annotation-rect", rect: annotationRect, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef })) : ([]));
|
69
45
|
return (React.createElement(React.Fragment, null,
|
70
|
-
React.createElement("span", { ref: elementRef, className:
|
71
|
-
|
72
|
-
textMarks,
|
46
|
+
React.createElement("span", { ref: elementRef, className: classNames('e-formula e-annotatable', { 'e-block e-text-center': isDisplayFormula }, props.className), "aria-hidden": "true", "data-testid": path, onMouseDown: onMouseDown },
|
47
|
+
React.createElement("span", { dangerouslySetInnerHTML: { __html: svg } }),
|
73
48
|
imageMarks),
|
74
49
|
React.createElement(AssistiveTitle, { assistiveTitle: assistiveTitle })));
|
75
50
|
});
|
@@ -79,7 +54,6 @@ function useElementAttributes(props) {
|
|
79
54
|
const textContent = (_a = props.element.textContent) === null || _a === void 0 ? void 0 : _a.trim();
|
80
55
|
const assistiveTitle = (_b = (getAttribute(props.element, 'assistive-title') || textContent)) !== null && _b !== void 0 ? _b : '';
|
81
56
|
const isDisplayFormula = getAttribute(props.element, 'mode') === 'display';
|
82
|
-
|
83
|
-
return { svg, assistiveTitle, textContent, className };
|
57
|
+
return { svg, assistiveTitle, isDisplayFormula, textContent };
|
84
58
|
}
|
85
59
|
//# sourceMappingURL=Formula.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Formula.js","sourceRoot":"","sources":["../../../src/components/shared/Formula.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAyB,MAAM,+BAA+B,CAAA;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,
|
1
|
+
{"version":3,"file":"Formula.js","sourceRoot":"","sources":["../../../src/components/shared/Formula.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC9D,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c,GAAG,MAAA,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,iBAAiB,CAAC,IAAI,WAAW,CAAC,mCAAI,EAAE,CAAA;IAC5F,MAAM,gBAAgB,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,SAAS,CAAA;IAE1E,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAA;AAC/D,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Reference.d.ts","sourceRoot":"","sources":["../../../src/components/shared/Reference.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAOjE,iBAAS,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,
|
1
|
+
{"version":3,"file":"Reference.d.ts","sourceRoot":"","sources":["../../../src/components/shared/Reference.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAOjE,iBAAS,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,kBAAkB,qBAsDnE;;AAgCD,wBAAoC"}
|
@@ -20,13 +20,16 @@ function Reference({ element, renderChildNodes }) {
|
|
20
20
|
function renderWithPrefix(localName, translationKey, Component) {
|
21
21
|
const childElement = findChildElement(element, localName);
|
22
22
|
return (childElement && (React.createElement(React.Fragment, { key: childElement.localName },
|
23
|
-
|
24
|
-
|
23
|
+
React.createElement("span", null,
|
24
|
+
t(translationKey),
|
25
|
+
" "),
|
25
26
|
React.createElement(Component, { element: childElement, renderChildNodes, key: childElement.localName }))));
|
26
27
|
}
|
27
28
|
return (React.createElement("span", { className: classNames('e-break-word', { 'e-line-through': getBooleanAttribute(element, 'hidden') }) },
|
28
|
-
|
29
|
-
|
29
|
+
React.createElement("span", null,
|
30
|
+
t('references.source'),
|
31
|
+
" ",
|
32
|
+
NBSP),
|
30
33
|
intersperse('. ', [
|
31
34
|
renderWith('author', RenderChildNodes),
|
32
35
|
renderWith('title', Italic),
|
@@ -50,20 +53,20 @@ function Link({ element, renderChildNodes }) {
|
|
50
53
|
function AsDate({ element }) {
|
51
54
|
const textContent = element.textContent;
|
52
55
|
if (/^[0-9]{4}$/.test(textContent)) {
|
53
|
-
return React.createElement(
|
56
|
+
return React.createElement("span", null, textContent);
|
54
57
|
}
|
55
58
|
else {
|
56
59
|
// The XML tag might contain leading or trailing whitespace, which breaks Date parsing.
|
57
60
|
const date = new Date(textContent.trim());
|
58
61
|
const { dateTimeFormatter } = useContext(CommonExamContext);
|
59
|
-
return React.createElement(
|
62
|
+
return React.createElement("span", null, dateTimeFormatter.format(date));
|
60
63
|
}
|
61
64
|
}
|
62
65
|
function intersperse(separator, contents) {
|
63
66
|
return contents.filter(Boolean).reduce((acc, curr, i) => {
|
64
67
|
acc.push(curr);
|
65
68
|
if (i !== contents.length - 1) {
|
66
|
-
acc.push(separator);
|
69
|
+
acc.push(React.createElement("span", { key: i }, separator));
|
67
70
|
}
|
68
71
|
return acc;
|
69
72
|
}, []);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Reference.js","sourceRoot":"","sources":["../../../src/components/shared/Reference.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,gBAAgB,MAAM,qBAAqB,CAAA;AAClD,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,SAAS,SAAS,CAAC,EAAE,OA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C,MAAM,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;QAC3D,OAAO,kCAAO,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAQ,CAAA;IACtD,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,SAAiB,EAAE,QAA2B;IACjE,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAoB,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;QACzE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACd,IAAI,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,GAAG,CAAC,IAAI,CAAC,8BAAM,GAAG,EAAE,CAAC,IAAG,SAAS,CAAQ,CAAC,CAAA;QAC5C,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { AnnotationPart, WithAnnotationId } from '../../types/ExamAnnotations';
|
3
|
-
export declare function getKey(annotation: AnnotationPart):
|
3
|
+
export declare function getKey(annotation: AnnotationPart): string;
|
4
4
|
export declare function isExistingAnnotation(annotation: AnnotationPart): annotation is WithAnnotationId<AnnotationPart>;
|
5
5
|
export declare function markText(text: string, annotations: AnnotationPart[], onClickAnnotation: (e: React.MouseEvent<HTMLElement, MouseEvent>, annotationId: number) => void, setNewAnnotationRef: (ref: HTMLElement | null) => void): React.ReactNode[];
|
6
6
|
//# sourceMappingURL=markText.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"markText.d.ts","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAI9E,wBAAgB,MAAM,CAAC,UAAU,EAAE,cAAc,
|
1
|
+
{"version":3,"file":"markText.d.ts","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAI9E,wBAAgB,MAAM,CAAC,UAAU,EAAE,cAAc,UAIhD;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,cAAc,GAAG,UAAU,IAAI,gBAAgB,CAAC,cAAc,CAAC,CAE/G;AAMD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,cAAc,EAAE,EAC7B,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,EAC/F,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,qBAgGvD"}
|