@digabi/exam-engine-core 21.0.2-alpha.0 → 21.0.3-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/context/AnnotationProvider.d.ts.map +1 -1
- package/dist/components/context/AnnotationProvider.js +3 -3
- package/dist/components/context/AnnotationProvider.js.map +1 -1
- package/dist/components/context/GradingInstructionContext.d.ts +9 -0
- package/dist/components/context/GradingInstructionContext.d.ts.map +1 -0
- package/dist/components/context/GradingInstructionContext.js +3 -0
- package/dist/components/context/GradingInstructionContext.js.map +1 -0
- package/dist/components/grading-instructions/EditableGradingInstruction.d.ts +5 -0
- package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -0
- package/dist/components/grading-instructions/EditableGradingInstruction.js +25 -0
- package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -0
- package/dist/components/grading-instructions/GradingInstructionProvider.d.ts +4 -0
- package/dist/components/grading-instructions/GradingInstructionProvider.d.ts.map +1 -0
- package/dist/components/grading-instructions/GradingInstructionProvider.js +8 -0
- package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -0
- package/dist/main-bundle.js +1 -1
- package/package.json +2 -2
@@ -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,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAI9C,UAAU,KAAK;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAA;IACnD,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,UAAU,EAAE,oBAAoB,KAAK,IAAI,CAAA;IAC5G,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5E;AAED,MAAM,WAAW,qBAAsB,SAAQ,yBAAyB;IACtE,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACvC,gBAAgB,EAAE,CAAC,CAAC,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAA;IACvD,gBAAgB,EAAE,WAAW,GAAG,SAAS,CAAA;IACzC,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,CAAA;CAC5D;AAED,eAAO,MAAM,iBAAiB,sCAAmD,CAAA;AAEjF,eAAO,MAAM,kBAAkB,mEAK5B,KAAK,GAAG,eAAe,iGA0DzB,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as _ from 'lodash-es';
|
2
|
-
import React from 'react';
|
2
|
+
import React, { useMemo } from 'react';
|
3
3
|
import { onMouseDownForAnnotation } from '../grading/examAnnotationUtils';
|
4
4
|
import { AnnotationPopup } from '../shared/AnnotationPopup';
|
5
5
|
export const AnnotationContext = React.createContext({});
|
@@ -20,7 +20,7 @@ export const AnnotationProvider = ({ children, annotations, onClickAnnotation, o
|
|
20
20
|
if (!onClickAnnotation && !onSaveAnnotation) {
|
21
21
|
return children;
|
22
22
|
}
|
23
|
-
const annotationPartsToRenderableAnnotations = _.groupBy((annotations === null || annotations === void 0 ? void 0 : annotations.flatMap(a => a.annotationParts.map((p, index, arr) => {
|
23
|
+
const annotationPartsToRenderableAnnotations = useMemo(() => _.groupBy((annotations === null || annotations === void 0 ? void 0 : annotations.flatMap(a => a.annotationParts.map((p, index, arr) => {
|
24
24
|
const isLastChild = index === arr.length - 1;
|
25
25
|
return {
|
26
26
|
...p,
|
@@ -28,7 +28,7 @@ export const AnnotationProvider = ({ children, annotations, onClickAnnotation, o
|
|
28
28
|
markNumber: isLastChild ? a.markNumber : undefined,
|
29
29
|
hidden: a.hidden
|
30
30
|
};
|
31
|
-
}))) || [], 'annotationAnchor');
|
31
|
+
}))) || [], 'annotationAnchor'), [JSON.stringify(annotations)]);
|
32
32
|
return (React.createElement(AnnotationContext.Provider, { value: {
|
33
33
|
annotations: annotationPartsToRenderableAnnotations,
|
34
34
|
onClickAnnotation,
|
@@ -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,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,OAAO,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAmB3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,EAA2B,CAAC,CAAA;AAEjF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EACQ,EAAE,EAAE;IAC5B,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAA2B,IAAI,CAAC,CAAA;IACxF,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,KAAK,CAAC,QAA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WAAW,EAAE,sCAAsC;YACnD,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,CAAA"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export interface GradingInstructionProps {
|
3
|
+
children?: React.ReactNode;
|
4
|
+
editable?: boolean;
|
5
|
+
onChange?: (answerHTML: string, displayNumber?: string) => void;
|
6
|
+
saveScreenshot?: (type: string, data: Buffer, displayNumber?: string) => Promise<string>;
|
7
|
+
}
|
8
|
+
export declare const GradingInstructionContext: React.Context<GradingInstructionProps>;
|
9
|
+
//# sourceMappingURL=GradingInstructionContext.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"GradingInstructionContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/GradingInstructionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/D,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CACzF;AAED,eAAO,MAAM,yBAAyB,wCAAqD,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"GradingInstructionContext.js","sourceRoot":"","sources":["../../../src/components/context/GradingInstructionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAC,aAAa,CAAC,EAA6B,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"EditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAA;AAM5D,wBAAgB,0BAA0B,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,qBAuB3E"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import React, { useContext, useEffect, useRef } from 'react';
|
2
|
+
import { makeRichText } from 'rich-text-editor';
|
3
|
+
import { GradingInstructionContext } from '../context/GradingInstructionContext';
|
4
|
+
import { CommonExamContext } from '../context/CommonExamContext';
|
5
|
+
import { QuestionContext } from '../context/QuestionContext';
|
6
|
+
export function EditableGradingInstruction({ element }) {
|
7
|
+
const { language } = useContext(CommonExamContext);
|
8
|
+
const { displayNumber } = useContext(QuestionContext);
|
9
|
+
const { onChange, saveScreenshot } = useContext(GradingInstructionContext);
|
10
|
+
const answerGradingInstructionDiv = useRef(null);
|
11
|
+
useEffect(() => {
|
12
|
+
if (answerGradingInstructionDiv.current) {
|
13
|
+
makeRichText(answerGradingInstructionDiv.current, {
|
14
|
+
locale: language.startsWith('sv') ? 'SV' : 'FI',
|
15
|
+
screenshotSaver: saveScreenshot ? ({ type, data }) => saveScreenshot(type, data, displayNumber) : undefined,
|
16
|
+
forceInit: true,
|
17
|
+
screenshotImageSelector: 'img[src^="data:image/png"], img[src^="data:image/jpeg"]',
|
18
|
+
fileTypes: ['image/png', 'image/jpeg']
|
19
|
+
}, ({ answerHTML }) => (onChange ? onChange(answerHTML, displayNumber) : () => { }));
|
20
|
+
answerGradingInstructionDiv.current.replaceChildren(element);
|
21
|
+
}
|
22
|
+
}, [language]);
|
23
|
+
return React.createElement("div", { ref: answerGradingInstructionDiv });
|
24
|
+
}
|
25
|
+
//# sourceMappingURL=EditableGradingInstruction.js.map
|
@@ -0,0 +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,SAAS,EAAE,IAAI;gBACf,uBAAuB,EAAE,yDAAyD;gBAClF,SAAS,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC;aACvC,EACD,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAChF,CAAA;YACD,2BAA2B,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;QAC9D,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IACd,OAAO,6BAAK,GAAG,EAAE,2BAA2B,GAAI,CAAA;AAClD,CAAC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { GradingInstructionProps } from '../context/GradingInstructionContext';
|
3
|
+
export declare const GradingInstructionProvider: ({ editable, onChange, saveScreenshot, children }: GradingInstructionProps) => React.JSX.Element;
|
4
|
+
//# sourceMappingURL=GradingInstructionProvider.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"GradingInstructionProvider.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAA6B,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAEzG,eAAO,MAAM,0BAA0B,qDAKpC,uBAAuB,sBAUzB,CAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { GradingInstructionContext } from '../context/GradingInstructionContext';
|
3
|
+
export const GradingInstructionProvider = ({ editable, onChange, saveScreenshot, children }) => (React.createElement(GradingInstructionContext.Provider, { value: {
|
4
|
+
editable,
|
5
|
+
onChange,
|
6
|
+
saveScreenshot
|
7
|
+
} }, children));
|
8
|
+
//# sourceMappingURL=GradingInstructionProvider.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"GradingInstructionProvider.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,yBAAyB,EAA2B,MAAM,sCAAsC,CAAA;AAEzG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACzC,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,QAAQ,EACgB,EAAE,EAAE,CAAC,CAC7B,oBAAC,yBAAyB,CAAC,QAAQ,IACjC,KAAK,EAAE;QACL,QAAQ;QACR,QAAQ;QACR,cAAc;KACf,IAEA,QAAQ,CAC0B,CACtC,CAAA"}
|