@digabi/exam-engine-core 21.0.3-alpha.0 → 21.0.4-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/annotations.test.js +27 -0
- package/dist/__tests__/annotations.test.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/grading/examAnnotationUtils.js.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.js +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
- package/dist/components/shared/AnnotationMark.js +3 -3
- package/dist/components/shared/AnnotationMark.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 +20 -5
- package/dist/components/shared/markText.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/package.json +2 -2
@@ -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,eAAiC;IAC7F,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,SAAS,GAAG,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,0CAAE,aAAa,CAAA;QACtD,MAAM,OAAO,GAAG,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,SAAS,0CAAE,aAAa,CAAA;QAEnD,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzE,MAAM,QAAQ,GAAG,+BAA+B,CAAC,SAAS,CAAC,CAA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,YAAY,CAAC,CAAC,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,UAAU,KAAI,CAAC,CAAC,CAAC,CAAC,CAAC;4BAC9D,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA,MAAA,UAAU,CAAC,WAAW,0CAAE,MAAM,KAAI,CAAC;yBAC5E,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"}
|
@@ -13,7 +13,7 @@ export function EditableGradingInstruction({ element }) {
|
|
13
13
|
makeRichText(answerGradingInstructionDiv.current, {
|
14
14
|
locale: language.startsWith('sv') ? 'SV' : 'FI',
|
15
15
|
screenshotSaver: saveScreenshot ? ({ type, data }) => saveScreenshot(type, data, displayNumber) : undefined,
|
16
|
-
forceInit: true,
|
16
|
+
//forceInit: true,
|
17
17
|
screenshotImageSelector: 'img[src^="data:image/png"], img[src^="data:image/jpeg"]',
|
18
18
|
fileTypes: ['image/png', 'image/jpeg']
|
19
19
|
}, ({ answerHTML }) => (onChange ? onChange(answerHTML, displayNumber) : () => { }));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EditableGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,MAAM,UAAU,0BAA0B,CAAC,EAAE,OAAO,EAAwB;IAC1E,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,CAAA;IACrD,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAA;IAC1E,MAAM,2BAA2B,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAEhE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,2BAA2B,CAAC,OAAO,EAAE,CAAC;YACxC,YAAY,CACV,2BAA2B,CAAC,OAAO,EACnC;gBACE,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;gBAC/C,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC3G,
|
1
|
+
{"version":3,"file":"EditableGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,MAAM,UAAU,0BAA0B,CAAC,EAAE,OAAO,EAAwB;I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Text';
|
3
3
|
export const AnnotationMark = ({ annotation, markedText, onClickAnnotation, setNewAnnotationRef }) => {
|
4
4
|
const markRef = useRef(null);
|
5
5
|
useEffect(() => {
|
6
|
-
if (markRef.current && !
|
6
|
+
if (markRef.current && !isExistingAnnotation(annotation)) {
|
7
7
|
setNewAnnotationRef(markRef.current);
|
8
8
|
}
|
9
9
|
}, []);
|
10
|
-
return (React.createElement("mark", { ref: markRef, className: "e-annotation", "data-annotation-id":
|
10
|
+
return (React.createElement("mark", { ref: markRef, className: "e-annotation", "data-annotation-id": isExistingAnnotation(annotation) ? annotation.annotationId : '', "data-hidden": "false", "data-annotation-path": annotation.annotationAnchor, onClick: e => (isExistingAnnotation(annotation) ? onClickAnnotation(e, annotation) : undefined) },
|
11
11
|
markedText,
|
12
12
|
(annotation === null || annotation === void 0 ? void 0 : annotation.markNumber) && React.createElement("sup", { className: "e-annotation", "data-content": annotation === null || annotation === void 0 ? void 0 : annotation.markNumber })));
|
13
13
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AnnotationMark.js","sourceRoot":"","sources":["../../../src/components/shared/AnnotationMark.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"AnnotationMark.js","sourceRoot":"","sources":["../../../src/components/shared/AnnotationMark.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EAMpB,EAAE,EAAE;IACH,MAAM,OAAO,GAAG,MAAM,CAAc,IAAI,CAAC,CAAA;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;YACzD,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QACtC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL,8BACE,GAAG,EAAE,OAAO,EACZ,SAAS,EAAC,cAAc,wBACJ,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,iBACvE,OAAO,0BACG,UAAU,CAAC,gBAAgB,EACjD,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE9F,UAAU;QACV,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,KAAI,6BAAK,SAAS,EAAC,cAAc,kBAAe,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,GAAI,CAC5F,CACR,CAAA;AACH,CAAC,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { NewRenderableAnnotation, RenderableAnnotation } from '../../types/Score';
|
3
|
-
export declare function
|
3
|
+
export declare function isExistingAnnotation(annotation: NewRenderableAnnotation | RenderableAnnotation): annotation is RenderableAnnotation;
|
4
4
|
export declare function markText(text: string, annotations: (RenderableAnnotation | NewRenderableAnnotation)[], onClickAnnotation: (e: React.MouseEvent<HTMLElement, MouseEvent>, a: RenderableAnnotation) => void, setNewAnnotationRef: (ref: HTMLElement | undefined) => void): React.ReactNode[];
|
5
5
|
//# 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,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAOjF,wBAAgB,
|
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,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAOjF,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,uBAAuB,GAAG,oBAAoB,GACzD,UAAU,IAAI,oBAAoB,CAEpC;AAMD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,CAAC,oBAAoB,GAAG,uBAAuB,CAAC,EAAE,EAC/D,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE,oBAAoB,KAAK,IAAI,EAClG,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,qBA4G5D"}
|
@@ -2,9 +2,9 @@ import * as _ from 'lodash-es';
|
|
2
2
|
import React from 'react';
|
3
3
|
import { AnnotationMark } from './AnnotationMark';
|
4
4
|
function getKey(annotation) {
|
5
|
-
return
|
5
|
+
return isExistingAnnotation(annotation) ? annotation.annotationId + annotation.startIndex : annotation.startIndex;
|
6
6
|
}
|
7
|
-
export function
|
7
|
+
export function isExistingAnnotation(annotation) {
|
8
8
|
return 'annotationId' in annotation;
|
9
9
|
}
|
10
10
|
function getMarkedText(text, startIndex, length) {
|
@@ -20,15 +20,30 @@ export function markText(text, annotations, onClickAnnotation, setNewAnnotationR
|
|
20
20
|
const nodes = [];
|
21
21
|
hiddenAnnotations.forEach(annotation => {
|
22
22
|
const key = getKey(annotation);
|
23
|
-
nodes.push(React.createElement("mark", { key: key, className: "e-annotation", "data-annotation-id":
|
23
|
+
nodes.push(React.createElement("mark", { key: key, className: "e-annotation", "data-annotation-id": isExistingAnnotation(annotation) ? annotation.annotationId : '', "data-hidden": "true" }));
|
24
24
|
});
|
25
25
|
let lastIndex = 0;
|
26
26
|
const onlyLeadingSpacesRemoved = text.replace(/^\s+/, ' ');
|
27
27
|
const indentationSize = text.length - onlyLeadingSpacesRemoved.length;
|
28
|
-
|
28
|
+
const notOverlappingAnnotations = visibleAnnotations.reduce((acc, annotation) => {
|
29
|
+
const overlapsWithAnyVisibleAnnotation = acc.some(a => annotation.startIndex < a.startIndex + a.length &&
|
30
|
+
a.startIndex < annotation.startIndex + annotation.length &&
|
31
|
+
!a.hidden);
|
32
|
+
acc.push({
|
33
|
+
...annotation,
|
34
|
+
hidden: annotation.hidden || overlapsWithAnyVisibleAnnotation
|
35
|
+
});
|
36
|
+
return acc;
|
37
|
+
}, []);
|
38
|
+
for (const annotation of notOverlappingAnnotations) {
|
29
39
|
/* "August 2024 annotation" refers to annotations made on or after 7.8.2024, and on or before x.8.2024.
|
30
40
|
* They use trimmed exam content (textWithoutLineBreaksAndExtraSpaces) for calculating startIndex.
|
31
41
|
* Support for "August 2024 annotations" can be removed at least when S25 exams are held.
|
42
|
+
*
|
43
|
+
* TODO:
|
44
|
+
* When support for Aug 2024 annotations can be removed, just do:
|
45
|
+
* const correctStartIndex = annotation.startIndex
|
46
|
+
* and remove any unused code left behind
|
32
47
|
*/
|
33
48
|
const textWithoutLineBreaksAndExtraSpaces = text.replace(/\n/g, ' ').replace(/\s+/g, ' ');
|
34
49
|
const annotatedTextAugust2024 = getMarkedText(textWithoutLineBreaksAndExtraSpaces, annotation.startIndex, annotation.length);
|
@@ -47,7 +62,7 @@ export function markText(text, annotations, onClickAnnotation, setNewAnnotationR
|
|
47
62
|
}
|
48
63
|
// Add marked text
|
49
64
|
const key = getKey(annotation);
|
50
|
-
nodes.push(annotation.hidden ? (React.createElement("mark", { key: key, className: "e-annotation", "data-annotation-id":
|
65
|
+
nodes.push(annotation.hidden ? (React.createElement("mark", { key: key, className: "e-annotation", "data-annotation-id": isExistingAnnotation(annotation) ? annotation.annotationId : '', "data-hidden": "true" })) : (React.createElement(AnnotationMark, { key: key, annotation: annotation, markedText: annotatedTextWithCorrectedStartIndex, onClickAnnotation: onClickAnnotation, setNewAnnotationRef: setNewAnnotationRef })));
|
51
66
|
lastIndex = correctStartIndex + annotation.length;
|
52
67
|
}
|
53
68
|
// Add remaining unmarked text
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"markText.js","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,SAAS,MAAM,CAAC,UAA0D;IACxE,OAAO,
|
1
|
+
{"version":3,"file":"markText.js","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,SAAS,MAAM,CAAC,UAA0D;IACxE,OAAO,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAA;AACnH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,UAA0D;IAE1D,OAAO,cAAc,IAAI,UAAU,CAAA;AACrC,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,UAAkB,EAAE,MAAc;IACrE,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC,CAAA;AACxD,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,IAAY,EACZ,WAA+D,EAC/D,iBAAkG,EAClG,mB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