@qti-editor/interaction-choice 1.1.3 → 1.2.1
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/commands/insert-choice-interaction.commands.d.ts +2 -3
- package/dist/components/qti-choice-interaction/commands/insert-choice-interaction.commands.d.ts.map +1 -1
- package/dist/components/qti-choice-interaction/commands/insert-choice-interaction.commands.js +3 -5
- 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 -0
- 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 +6 -2
- package/dist/composer/metadata.d.ts +6 -0
- package/dist/composer/metadata.d.ts.map +1 -1
- package/dist/composer/metadata.js +4 -3
- package/dist/descriptor.d.ts +6 -0
- package/dist/descriptor.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/components/qti-choice-interaction/commands/insert-choice-interaction.commands.d.ts
CHANGED
|
@@ -9,9 +9,8 @@ export declare const insertChoiceInteraction: Command;
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const insertSimpleChoiceOnEnter: Command;
|
|
11
11
|
/**
|
|
12
|
-
* Enter command
|
|
13
|
-
*
|
|
14
|
-
* 2) Fallback to regular block split behavior elsewhere.
|
|
12
|
+
* Enter command for choice interactions.
|
|
13
|
+
* Inserts new simple choice when inside qti-simple-choice.
|
|
15
14
|
*/
|
|
16
15
|
export declare const qtiChoiceEnterCommand: Command;
|
|
17
16
|
//# sourceMappingURL=insert-choice-interaction.commands.d.ts.map
|
package/dist/components/qti-choice-interaction/commands/insert-choice-interaction.commands.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-choice-interaction.commands.d.ts","sourceRoot":"","sources":["../../../../src/components/qti-choice-interaction/commands/insert-choice-interaction.commands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"insert-choice-interaction.commands.d.ts","sourceRoot":"","sources":["../../../../src/components/qti-choice-interaction/commands/insert-choice-interaction.commands.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAwCrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,OAcvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,OAAmC,CAAC"}
|
package/dist/components/qti-choice-interaction/commands/insert-choice-interaction.commands.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { chainCommands, splitBlock } from 'prosemirror-commands';
|
|
2
1
|
import { createInsertSiblingOnEnterCommand } from '@qti-editor/interaction-shared/commands/enter.js';
|
|
3
2
|
import { createInsertBlockInteractionCommand } from '@qti-editor/interaction-shared/commands/insert.js';
|
|
4
3
|
import { translateQti } from '@qti-editor/interaction-shared';
|
|
@@ -46,8 +45,7 @@ export const insertSimpleChoiceOnEnter = (state, dispatch) => {
|
|
|
46
45
|
})(state, dispatch);
|
|
47
46
|
};
|
|
48
47
|
/**
|
|
49
|
-
* Enter command
|
|
50
|
-
*
|
|
51
|
-
* 2) Fallback to regular block split behavior elsewhere.
|
|
48
|
+
* Enter command for choice interactions.
|
|
49
|
+
* Inserts new simple choice when inside qti-simple-choice.
|
|
52
50
|
*/
|
|
53
|
-
export const qtiChoiceEnterCommand =
|
|
51
|
+
export const qtiChoiceEnterCommand = insertSimpleChoiceOnEnter;
|
|
@@ -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":"AAEA,OAAO,KAAK,EAAmB,wBAAwB,EAAkC,MAAM,kDAAkD,CAAC;AAclJ,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,wBAAwB,
|
|
1
|
+
{"version":3,"file":"qti-choice-interaction.compose.d.ts","sourceRoot":"","sources":["../../../src/components/qti-choice-interaction/qti-choice-interaction.compose.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,wBAAwB,EAAkC,MAAM,kDAAkD,CAAC;AAclJ,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,wBAAwB,CAkDlH"}
|
|
@@ -19,6 +19,7 @@ export function composeChoiceInteractionElement(sourceElement, xmlDoc) {
|
|
|
19
19
|
const correctResponse = toNonEmptyString(sourceElement.getAttribute('correct-response'));
|
|
20
20
|
const maxChoices = toFiniteNumber(sourceElement.getAttribute('max-choices'), 1);
|
|
21
21
|
const minChoices = toFiniteNumber(sourceElement.getAttribute('min-choices'), 0);
|
|
22
|
+
const score = toFiniteNumber(sourceElement.getAttribute('score'), 1);
|
|
22
23
|
const editorOnlyAttributes = [...metadata.editorOnlyAttributes];
|
|
23
24
|
editorOnlyAttributes.forEach(attr => normalizedElement.removeAttribute(attr));
|
|
24
25
|
normalizedElement.setAttribute('max-choices', String(maxChoices));
|
|
@@ -45,6 +46,7 @@ export function composeChoiceInteractionElement(sourceElement, xmlDoc) {
|
|
|
45
46
|
baseType: 'identifier',
|
|
46
47
|
correctResponse: correctResponse ?? undefined,
|
|
47
48
|
sourceTag: metadata.tagName,
|
|
49
|
+
score,
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
return {
|
|
@@ -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":"AAAA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjE,eAAO,MAAM,4BAA4B,EAAE,
|
|
1
|
+
{"version":3,"file":"qti-choice-interaction.schema.d.ts","sourceRoot":"","sources":["../../../src/components/qti-choice-interaction/qti-choice-interaction.schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjE,eAAO,MAAM,4BAA4B,EAAE,QAsC1C,CAAC"}
|
|
@@ -5,7 +5,8 @@ export const qtiChoiceInteractionNodeSpec = {
|
|
|
5
5
|
maxChoices: { default: 0 },
|
|
6
6
|
class: { default: null },
|
|
7
7
|
correctResponse: { default: null },
|
|
8
|
-
responseIdentifier: { default: null }
|
|
8
|
+
responseIdentifier: { default: null },
|
|
9
|
+
score: { default: 1 },
|
|
9
10
|
},
|
|
10
11
|
parseDOM: [
|
|
11
12
|
{
|
|
@@ -15,11 +16,13 @@ export const qtiChoiceInteractionNodeSpec = {
|
|
|
15
16
|
return {};
|
|
16
17
|
const maxChoices = node.getAttribute('max-choices');
|
|
17
18
|
const className = node.getAttribute('class');
|
|
19
|
+
const scoreAttr = node.getAttribute('score');
|
|
18
20
|
return {
|
|
19
21
|
maxChoices: maxChoices ? parseInt(maxChoices, 10) : 0,
|
|
20
22
|
class: className || null,
|
|
21
23
|
correctResponse: node.getAttribute('correct-response'),
|
|
22
|
-
responseIdentifier: node.getAttribute('response-identifier')
|
|
24
|
+
responseIdentifier: node.getAttribute('response-identifier'),
|
|
25
|
+
score: scoreAttr && Number.isFinite(Number(scoreAttr)) ? Number(scoreAttr) : 1,
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
}
|
|
@@ -32,6 +35,7 @@ export const qtiChoiceInteractionNodeSpec = {
|
|
|
32
35
|
attrs['correct-response'] = node.attrs.correctResponse;
|
|
33
36
|
if (node.attrs.responseIdentifier)
|
|
34
37
|
attrs['response-identifier'] = node.attrs.responseIdentifier;
|
|
38
|
+
attrs.score = String(node.attrs.score ?? 1);
|
|
35
39
|
return ['qti-choice-interaction', attrs, 0];
|
|
36
40
|
},
|
|
37
41
|
defining: true,
|
|
@@ -22,6 +22,12 @@ export declare const choiceNodeAttributePanelMetadataByNodeTypeName: {
|
|
|
22
22
|
readonly attribute: "class";
|
|
23
23
|
readonly kind: "choiceInteractionClass";
|
|
24
24
|
}[];
|
|
25
|
+
fields: {
|
|
26
|
+
score: {
|
|
27
|
+
label: string;
|
|
28
|
+
input: "number";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
25
31
|
};
|
|
26
32
|
};
|
|
27
33
|
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -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;;;;;;;;;;;CAYP,CAAC;AAExC,eAAO,MAAM,8CAA8C
|
|
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;;;;;;;;;;;CAYP,CAAC;AAExC,eAAO,MAAM,8CAA8C;;;;;;;;;;;;;;;;CAQL,CAAC"}
|
|
@@ -27,15 +27,16 @@ export const choiceInteractionComposerMetadata = {
|
|
|
27
27
|
internalKind: 'match_correct',
|
|
28
28
|
internalSourceXml: MATCH_CORRECT_INTERNAL_TEMPLATE,
|
|
29
29
|
},
|
|
30
|
-
editorOnlyAttributes: ['class'],
|
|
30
|
+
editorOnlyAttributes: ['class', 'score'],
|
|
31
31
|
// maxChoices and correctResponse are set by clicking choices, not edited directly
|
|
32
|
-
userEditableAttributes: ['class'],
|
|
32
|
+
userEditableAttributes: ['class', 'score'],
|
|
33
33
|
};
|
|
34
34
|
export const choiceNodeAttributePanelMetadataByNodeTypeName = {
|
|
35
35
|
[CHOICE_INTERACTION_NODE_TYPE.toLowerCase()]: {
|
|
36
36
|
nodeTypeName: CHOICE_INTERACTION_NODE_TYPE,
|
|
37
|
-
editableAttributes:
|
|
37
|
+
editableAttributes: ['score'],
|
|
38
38
|
hiddenAttributes: ['class'],
|
|
39
39
|
friendlyEditors: [choiceInteractionClassFriendlyEditor],
|
|
40
|
+
fields: { score: { label: 'Score', input: 'number' } },
|
|
40
41
|
},
|
|
41
42
|
};
|
package/dist/descriptor.d.ts
CHANGED
package/dist/descriptor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../src/descriptor.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAK1F,eAAO,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../src/descriptor.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAK1F,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBP,CAAC"}
|
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.1
|
|
4
|
+
"version": "1.2.1",
|
|
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.
|
|
30
|
-
"@qti-editor/interfaces": "1.
|
|
29
|
+
"@qti-editor/interaction-shared": "1.3.0",
|
|
30
|
+
"@qti-editor/interfaces": "1.2.0",
|
|
31
31
|
"prosemirror-commands": "^1.7.1",
|
|
32
32
|
"prosemirror-model": "^1.25.4",
|
|
33
33
|
"prosemirror-state": "^1.4.4",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"lit": "^3.3.1",
|
|
38
|
-
"prosekit": "^0.
|
|
38
|
+
"prosekit": "^0.20.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"lit": "^3.3.2"
|