@qti-editor/interaction-choice 1.2.1 → 1.2.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/components/qti-choice-interaction/qti-choice-interaction.compose.d.ts.map +1 -1
- package/dist/components/qti-choice-interaction/qti-choice-interaction.compose.js +2 -1
- package/dist/components/qti-choice-interaction/qti-choice-interaction.schema.d.ts.map +1 -1
- package/dist/components/qti-choice-interaction/qti-choice-interaction.schema.js +5 -3
- package/dist/composer/metadata.d.ts.map +1 -1
- package/dist/composer/metadata.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-choice-interaction.compose.d.ts","sourceRoot":"","sources":["../../../src/components/qti-choice-interaction/qti-choice-interaction.compose.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qti-choice-interaction.compose.d.ts","sourceRoot":"","sources":["../../../src/components/qti-choice-interaction/qti-choice-interaction.compose.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,wBAAwB,EAAkC,MAAM,kDAAkD,CAAC;AAclJ,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,wBAAwB,CAkDlH"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseCorrectResponseAttribute } from '@qti-editor/interaction-shared';
|
|
1
2
|
import { choiceInteractionComposerMetadata } from '../../composer/metadata.js';
|
|
2
3
|
function toFiniteNumber(value, fallback) {
|
|
3
4
|
if (value == null || value.trim().length === 0)
|
|
@@ -16,7 +17,7 @@ export function composeChoiceInteractionElement(sourceElement, xmlDoc) {
|
|
|
16
17
|
const warnings = [];
|
|
17
18
|
const normalizedElement = xmlDoc.importNode(sourceElement, true);
|
|
18
19
|
const responseIdentifier = toNonEmptyString(sourceElement.getAttribute('response-identifier'));
|
|
19
|
-
const correctResponse =
|
|
20
|
+
const correctResponse = parseCorrectResponseAttribute(sourceElement.getAttribute('correct-response'));
|
|
20
21
|
const maxChoices = toFiniteNumber(sourceElement.getAttribute('max-choices'), 1);
|
|
21
22
|
const minChoices = toFiniteNumber(sourceElement.getAttribute('min-choices'), 0);
|
|
22
23
|
const score = toFiniteNumber(sourceElement.getAttribute('score'), 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qti-choice-interaction.schema.d.ts","sourceRoot":"","sources":["../../../src/components/qti-choice-interaction/qti-choice-interaction.schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qti-choice-interaction.schema.d.ts","sourceRoot":"","sources":["../../../src/components/qti-choice-interaction/qti-choice-interaction.schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjE,eAAO,MAAM,4BAA4B,EAAE,QAuC1C,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseCorrectResponseAttribute, serializeCorrectResponseAttribute } from '@qti-editor/interaction-shared';
|
|
1
2
|
export const qtiChoiceInteractionNodeSpec = {
|
|
2
3
|
group: 'block',
|
|
3
4
|
content: 'qtiPrompt qtiSimpleChoice+',
|
|
@@ -20,7 +21,7 @@ export const qtiChoiceInteractionNodeSpec = {
|
|
|
20
21
|
return {
|
|
21
22
|
maxChoices: maxChoices ? parseInt(maxChoices, 10) : 0,
|
|
22
23
|
class: className || null,
|
|
23
|
-
correctResponse: node.getAttribute('correct-response'),
|
|
24
|
+
correctResponse: parseCorrectResponseAttribute(node.getAttribute('correct-response')),
|
|
24
25
|
responseIdentifier: node.getAttribute('response-identifier'),
|
|
25
26
|
score: scoreAttr && Number.isFinite(Number(scoreAttr)) ? Number(scoreAttr) : 1,
|
|
26
27
|
};
|
|
@@ -31,8 +32,9 @@ export const qtiChoiceInteractionNodeSpec = {
|
|
|
31
32
|
const attrs = { 'max-choices': String(node.attrs.maxChoices) };
|
|
32
33
|
if (node.attrs.class)
|
|
33
34
|
attrs.class = node.attrs.class;
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const cr = serializeCorrectResponseAttribute(node.attrs.correctResponse);
|
|
36
|
+
if (cr)
|
|
37
|
+
attrs['correct-response'] = cr;
|
|
36
38
|
if (node.attrs.responseIdentifier)
|
|
37
39
|
attrs['response-identifier'] = node.attrs.responseIdentifier;
|
|
38
40
|
attrs.score = String(node.attrs.score ?? 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/composer/metadata.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,uEAAuE,CAAC;AAmB3G,eAAO,MAAM,sBAAsB,EAAG,wBAAiC,CAAC;AACxE,eAAO,MAAM,4BAA4B,EAAG,sBAA+B,CAAC;AAE5E,eAAO,MAAM,iCAAiC;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/composer/metadata.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,uEAAuE,CAAC;AAmB3G,eAAO,MAAM,sBAAsB,EAAG,wBAAiC,CAAC;AACxE,eAAO,MAAM,4BAA4B,EAAG,sBAA+B,CAAC;AAE5E,eAAO,MAAM,iCAAiC;;;;;;;;;;;CAaP,CAAC;AAExC,eAAO,MAAM,8CAA8C;;;;;;;;;;;;;;;;CAQL,CAAC"}
|
|
@@ -27,7 +27,7 @@ export const choiceInteractionComposerMetadata = {
|
|
|
27
27
|
internalKind: 'match_correct',
|
|
28
28
|
internalSourceXml: MATCH_CORRECT_INTERNAL_TEMPLATE,
|
|
29
29
|
},
|
|
30
|
-
editorOnlyAttributes: ['
|
|
30
|
+
editorOnlyAttributes: ['score'],
|
|
31
31
|
// maxChoices and correctResponse are set by clicking choices, not edited directly
|
|
32
32
|
userEditableAttributes: ['class', 'score'],
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qti-editor/interaction-choice",
|
|
3
3
|
"description": "QTI choice interaction schemas, components, commands, and composer",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/Citolab/qti-editor",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@qti-components/interactions": "^1.10.1",
|
|
27
27
|
"@qti-components/interactions-core": "^1.1.3",
|
|
28
28
|
"@qti-components/utilities": "^1.3.2",
|
|
29
|
-
"@qti-editor/interaction-shared": "1.3.
|
|
30
|
-
"@qti-editor/interfaces": "1.2.
|
|
29
|
+
"@qti-editor/interaction-shared": "1.3.1",
|
|
30
|
+
"@qti-editor/interfaces": "1.2.1",
|
|
31
31
|
"prosemirror-commands": "^1.7.1",
|
|
32
32
|
"prosemirror-model": "^1.25.4",
|
|
33
33
|
"prosemirror-state": "^1.4.4",
|