@digabi/exam-engine-core 20.5.1-alpha.1 → 20.5.1-alpha.2
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/GradingInstructionContext.d.ts +1 -1
- package/dist/components/context/GradingInstructionContext.d.ts.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.js +7 -5
- package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/package.json +2 -2
@@ -4,7 +4,7 @@ export interface GradingInstructionPropsBase {
|
|
4
4
|
}
|
5
5
|
export interface EditableProps extends GradingInstructionPropsBase {
|
6
6
|
editable: true;
|
7
|
-
onContentChange: (answerHTML: string,
|
7
|
+
onContentChange: (answerHTML: string, xpath: string | null) => void;
|
8
8
|
saveScreenshot: (type: string, data: Buffer, displayNumber?: string) => Promise<string>;
|
9
9
|
}
|
10
10
|
export interface NotEditableProps extends GradingInstructionPropsBase {
|
@@ -1 +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,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,MAAM,WAAW,aAAc,SAAQ,2BAA2B;IAChE,QAAQ,EAAE,IAAI,CAAA;IACd,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,
|
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,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,MAAM,WAAW,aAAc,SAAQ,2BAA2B;IAChE,QAAQ,EAAE,IAAI,CAAA;IACd,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACnE,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CACxF;AAED,MAAM,WAAW,gBAAiB,SAAQ,2BAA2B;IACnE,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,eAAe,CAAC,EAAE,KAAK,CAAA;IACvB,cAAc,CAAC,EAAE,KAAK,CAAA;CACvB;AAED,MAAM,MAAM,uBAAuB,GAAG,aAAa,GAAG,gBAAgB,CAAA;AAEtE,eAAO,MAAM,yBAAyB,wCAAqD,CAAA"}
|
@@ -1 +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,
|
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"}
|
@@ -10,29 +10,31 @@ export function EditableGradingInstruction({ element }) {
|
|
10
10
|
const answerGradingInstructionDiv = useRef(null);
|
11
11
|
useEffect(() => {
|
12
12
|
if (answerGradingInstructionDiv.current) {
|
13
|
+
const xpath = answerGradingInstructionDiv.current.getAttribute('data-xpath');
|
13
14
|
makeRichText(answerGradingInstructionDiv.current, {
|
14
15
|
locale: language.startsWith('sv') ? 'SV' : 'FI',
|
15
16
|
screenshotSaver: saveScreenshot ? ({ type, data }) => saveScreenshot(type, data, displayNumber) : undefined,
|
16
17
|
screenshotImageSelector: 'img[src^="data:image/png"], img[src^="data:image/jpeg"]',
|
17
18
|
fileTypes: ['image/png', 'image/jpeg']
|
18
|
-
}, ({ answerHTML }) => (onContentChange ? onContentChange(answerHTML,
|
19
|
+
}, ({ answerHTML }) => (onContentChange ? onContentChange(answerHTML, xpath) : () => { }));
|
19
20
|
answerGradingInstructionDiv.current.replaceChildren(element);
|
20
21
|
}
|
21
22
|
}, [language]);
|
22
|
-
return React.createElement("div", { ref: answerGradingInstructionDiv, "data-xpath": xpathOf(element) });
|
23
|
+
return React.createElement("div", { ref: answerGradingInstructionDiv, "data-xpath": xpathOf(element, language) });
|
23
24
|
}
|
24
25
|
function indexOf(element) {
|
25
26
|
if (element.parentElement) {
|
26
|
-
const siblings = Array.from(element.parentElement.querySelectorAll(element.localName));
|
27
|
+
const siblings = Array.from(element.parentElement.querySelectorAll(`${element.parentElement.localName} > ${element.localName}`));
|
27
28
|
const index = siblings.findIndex(s => s == element);
|
28
29
|
return `[${index + 1}]`;
|
29
30
|
}
|
30
31
|
return '';
|
31
32
|
}
|
32
|
-
function xpathOf(element) {
|
33
|
+
function xpathOf(element, language) {
|
33
34
|
const index = indexOf(element);
|
34
35
|
if (element.parentElement) {
|
35
|
-
|
36
|
+
const localization = element.nodeName.includes('grading-instruction') ? `/e:localization[@lang="${language}"]` : '';
|
37
|
+
return `${xpathOf(element.parentElement, language)}/${element.nodeName}${index}${localization}`;
|
36
38
|
}
|
37
39
|
return `/${element.nodeName}${index}`;
|
38
40
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EditableGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA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