@qti-editor/interaction-select-point 1.2.0 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"qti-select-point-interaction.compose.d.ts","sourceRoot":"","sources":["../../../src/components/qti-select-point-interaction/qti-select-point-interaction.compose.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,wBAAwB,EAAmD,MAAM,kDAAkD,CAAC;AA8FnK,wBAAgB,oCAAoC,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,wBAAwB,CAoFvH"}
1
+ {"version":3,"file":"qti-select-point-interaction.compose.d.ts","sourceRoot":"","sources":["../../../src/components/qti-select-point-interaction/qti-select-point-interaction.compose.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,wBAAwB,EAAmD,MAAM,kDAAkD,CAAC;AA8FnK,wBAAgB,oCAAoC,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,wBAAwB,CAmFvH"}
@@ -1,3 +1,4 @@
1
+ import { parseCorrectResponseAttribute } from '@qti-editor/interaction-shared';
1
2
  import { selectPointInteractionComposerMetadata, SELECT_POINT_INTERACTION_TAG } from '../../composer/metadata.js';
2
3
  function toFiniteNumber(value, fallback) {
3
4
  if (value == null || value.trim().length === 0)
@@ -134,7 +135,7 @@ export function composeSelectPointInteractionElement(sourceElement, xmlDoc) {
134
135
  });
135
136
  }
136
137
  else {
137
- const correctResponse = toNonEmptyString(sourceElement.getAttribute('correct-response'));
138
+ const correctResponse = parseCorrectResponseAttribute(sourceElement.getAttribute('correct-response'));
138
139
  responseDeclaration = {
139
140
  identifier: responseIdentifier,
140
141
  cardinality: maxChoices > 1 ? 'multiple' : 'single',
@@ -1 +1 @@
1
- {"version":3,"file":"qti-select-point-interaction.schema.d.ts","sourceRoot":"","sources":["../../../src/components/qti-select-point-interaction/qti-select-point-interaction.schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA0C,QAAQ,EAAU,MAAM,mBAAmB,CAAC;AAwElG,eAAO,MAAM,iCAAiC,EAAE,QA6C/C,CAAC"}
1
+ {"version":3,"file":"qti-select-point-interaction.schema.d.ts","sourceRoot":"","sources":["../../../src/components/qti-select-point-interaction/qti-select-point-interaction.schema.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAA0C,QAAQ,EAAU,MAAM,mBAAmB,CAAC;AAwElG,eAAO,MAAM,iCAAiC,EAAE,QA8C/C,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { parseCorrectResponseAttribute, serializeCorrectResponseAttribute, } from '@qti-editor/interaction-shared';
1
2
  import { Fragment } from 'prosemirror-model';
2
3
  function parseNumberAttribute(value) {
3
4
  if (value == null || value === '')
@@ -21,7 +22,7 @@ function parseWrapperAttrs(node) {
21
22
  minChoices: parseNumberAttribute(node.getAttribute('min-choices')) ?? 0,
22
23
  class: node.getAttribute('class') || null,
23
24
  areaMappings: node.getAttribute('area-mappings') || '[]',
24
- correctResponse: node.getAttribute('correct-response') || null,
25
+ correctResponse: parseCorrectResponseAttribute(node.getAttribute('correct-response')),
25
26
  score: scoreAttr && Number.isFinite(Number(scoreAttr)) ? Number(scoreAttr) : 1,
26
27
  };
27
28
  }
@@ -94,8 +95,9 @@ export const qtiSelectPointInteractionNodeSpec = {
94
95
  attrs.class = String(node.attrs.class);
95
96
  if (node.attrs.areaMappings)
96
97
  attrs['area-mappings'] = String(node.attrs.areaMappings);
97
- if (node.attrs.correctResponse)
98
- attrs['correct-response'] = String(node.attrs.correctResponse);
98
+ const cr = serializeCorrectResponseAttribute(node.attrs.correctResponse);
99
+ if (cr)
100
+ attrs['correct-response'] = cr;
99
101
  attrs.score = String(node.attrs.score ?? 1);
100
102
  return ['qti-select-point-interaction', attrs, 0];
101
103
  },
@@ -18,7 +18,7 @@ export const selectPointInteractionComposerMetadata = {
18
18
  internalKind: 'map_response_point',
19
19
  internalSourceXml: MAP_RESPONSE_POINT_INTERNAL_TEMPLATE,
20
20
  },
21
- editorOnlyAttributes: ['class', 'area-mappings', 'correct-response', 'score'],
21
+ editorOnlyAttributes: ['area-mappings', 'correct-response', 'score'],
22
22
  userEditableAttributes: ['maxChoices', 'minChoices', 'score'],
23
23
  };
24
24
  export const selectPointNodeAttributePanelMetadataByNodeTypeName = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qti-editor/interaction-select-point",
3
3
  "description": "QTI select-point interaction schemas, components, commands, and composer",
4
- "version": "1.2.0",
4
+ "version": "1.2.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/Citolab/qti-editor",
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@qti-components/select-point-interaction": "^1.0.1",
25
- "@qti-editor/interaction-shared": "1.3.0",
26
- "@qti-editor/interfaces": "1.2.0",
25
+ "@qti-editor/interaction-shared": "1.3.1",
26
+ "@qti-editor/interfaces": "1.2.1",
27
27
  "prosemirror-model": "^1.25.4",
28
28
  "prosemirror-state": "^1.4.4",
29
29
  "prosemirror-view": "^1.31.0"