@qti-editor/interaction-choice 1.0.0 → 1.1.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/convert-selection-to-choice.commands.d.ts +1 -1
- package/dist/extensions/correct-response-click.d.ts +3 -5
- package/dist/extensions/correct-response-click.d.ts.map +1 -1
- package/dist/extensions/correct-response-click.js +3 -7
- package/dist/extensions/index.d.ts +2 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +3 -1
- package/dist/extensions/prosekit.d.ts +11 -0
- package/dist/extensions/prosekit.d.ts.map +1 -0
- package/dist/extensions/prosekit.js +13 -0
- package/package.json +10 -8
package/dist/components/qti-choice-interaction/commands/convert-selection-to-choice.commands.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EditorView } from '
|
|
1
|
+
import type { EditorView } from 'prosemirror-view';
|
|
2
2
|
export declare function canConvertFlatListToChoiceInteraction(view: EditorView): boolean;
|
|
3
3
|
export declare function convertFlatListToChoiceInteraction(view: EditorView): boolean;
|
|
4
4
|
//# sourceMappingURL=convert-selection-to-choice.commands.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Plugin } from 'prosekit/pm/state';
|
|
1
|
+
import { Plugin } from 'prosemirror-state';
|
|
3
2
|
/**
|
|
4
3
|
* Event name for correct response changes at the interaction level.
|
|
5
4
|
* Dispatched when selections change to update the ProseMirror document.
|
|
@@ -14,13 +13,12 @@ export interface QtiCorrectResponseChangeDetail {
|
|
|
14
13
|
interactionElement: HTMLElement;
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
|
-
* Creates a ProseMirror
|
|
16
|
+
* Creates a ProseMirror plugin that handles correct response clicks.
|
|
18
17
|
*
|
|
19
|
-
* When a qti-simple-choice is clicked (on part="ch"), this
|
|
18
|
+
* When a qti-simple-choice is clicked (on part="ch"), this plugin:
|
|
20
19
|
* 1. Aggregates all selected choices in the parent interaction
|
|
21
20
|
* 2. Computes maxChoices (1 for single, 0 for multiple)
|
|
22
21
|
* 3. Updates the interaction node's attributes
|
|
23
22
|
*/
|
|
24
|
-
export declare function defineCorrectResponseClickExtension(): Extension;
|
|
25
23
|
export declare function createCorrectResponseClickPlugin(): Plugin;
|
|
26
24
|
//# sourceMappingURL=correct-response-click.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correct-response-click.d.ts","sourceRoot":"","sources":["../../src/extensions/correct-response-click.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"correct-response-click.d.ts","sourceRoot":"","sources":["../../src/extensions/correct-response-click.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,mBAAmB,CAAC;AAUtD;;;GAGG;AACH,eAAO,MAAM,iCAAiC,gCAAgC,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,kBAAkB,EAAE,WAAW,CAAC;CACjC;AAqDD;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,IAAI,MAAM,CAyCzD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Plugin, PluginKey } from 'prosekit/pm/state';
|
|
1
|
+
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
3
2
|
import { QTI_CORRECT_RESPONSE_TOGGLE_EVENT, } from '@qti-editor/interaction-shared';
|
|
4
3
|
const correctResponseClickPluginKey = new PluginKey('correct-response-click');
|
|
5
4
|
/**
|
|
@@ -52,16 +51,13 @@ function findInteractionNodePos(view, interactionElement) {
|
|
|
52
51
|
return foundPos;
|
|
53
52
|
}
|
|
54
53
|
/**
|
|
55
|
-
* Creates a ProseMirror
|
|
54
|
+
* Creates a ProseMirror plugin that handles correct response clicks.
|
|
56
55
|
*
|
|
57
|
-
* When a qti-simple-choice is clicked (on part="ch"), this
|
|
56
|
+
* When a qti-simple-choice is clicked (on part="ch"), this plugin:
|
|
58
57
|
* 1. Aggregates all selected choices in the parent interaction
|
|
59
58
|
* 2. Computes maxChoices (1 for single, 0 for multiple)
|
|
60
59
|
* 3. Updates the interaction node's attributes
|
|
61
60
|
*/
|
|
62
|
-
export function defineCorrectResponseClickExtension() {
|
|
63
|
-
return definePlugin(createCorrectResponseClickPlugin);
|
|
64
|
-
}
|
|
65
61
|
export function createCorrectResponseClickPlugin() {
|
|
66
62
|
return new Plugin({
|
|
67
63
|
key: correctResponseClickPluginKey,
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createCorrectResponseClickPlugin, QTI_CORRECT_RESPONSE_CHANGE_EVENT, type QtiCorrectResponseChangeDetail, } from './correct-response-click.js';
|
|
2
|
+
export { defineCorrectResponseClickExtension } from './prosekit.js';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,iCAAiC,EACjC,KAAK,8BAA8B,GACpC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,mCAAmC,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/extensions/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createCorrectResponseClickPlugin, QTI_CORRECT_RESPONSE_CHANGE_EVENT, } from './correct-response-click.js';
|
|
2
|
+
// ProseKit extension wrapper (optional - requires prosekit)
|
|
3
|
+
export { defineCorrectResponseClickExtension } from './prosekit.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProseKit extension wrappers for choice interaction plugins.
|
|
3
|
+
* Only import this file when using ProseKit.
|
|
4
|
+
*/
|
|
5
|
+
import { type Extension } from 'prosekit/core';
|
|
6
|
+
/**
|
|
7
|
+
* ProseKit extension that wraps the correct response click plugin.
|
|
8
|
+
* Use this when integrating with ProseKit.
|
|
9
|
+
*/
|
|
10
|
+
export declare function defineCorrectResponseClickExtension(): Extension;
|
|
11
|
+
//# sourceMappingURL=prosekit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prosekit.d.ts","sourceRoot":"","sources":["../../src/extensions/prosekit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAI7D;;;GAGG;AACH,wBAAgB,mCAAmC,IAAI,SAAS,CAE/D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProseKit extension wrappers for choice interaction plugins.
|
|
3
|
+
* Only import this file when using ProseKit.
|
|
4
|
+
*/
|
|
5
|
+
import { definePlugin } from 'prosekit/core';
|
|
6
|
+
import { createCorrectResponseClickPlugin } from './correct-response-click.js';
|
|
7
|
+
/**
|
|
8
|
+
* ProseKit extension that wraps the correct response click plugin.
|
|
9
|
+
* Use this when integrating with ProseKit.
|
|
10
|
+
*/
|
|
11
|
+
export function defineCorrectResponseClickExtension() {
|
|
12
|
+
return definePlugin(createCorrectResponseClickPlugin);
|
|
13
|
+
}
|
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.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/Citolab/qti-editor",
|
|
@@ -26,17 +26,19 @@
|
|
|
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.1.0",
|
|
30
|
+
"@qti-editor/interfaces": "1.1.0",
|
|
31
|
+
"prosemirror-commands": "^1.7.1",
|
|
32
|
+
"prosemirror-model": "^1.25.4",
|
|
33
|
+
"prosemirror-state": "^1.4.4",
|
|
34
|
+
"prosemirror-view": "^1.31.0"
|
|
31
35
|
},
|
|
32
36
|
"peerDependencies": {
|
|
33
|
-
"lit": "^3.3.1"
|
|
37
|
+
"lit": "^3.3.1",
|
|
38
|
+
"prosekit": "^0.18.4"
|
|
34
39
|
},
|
|
35
40
|
"devDependencies": {
|
|
36
|
-
"lit": "^3.3.2"
|
|
37
|
-
"prosemirror-commands": "^1.7.1",
|
|
38
|
-
"prosemirror-model": "^1.25.4",
|
|
39
|
-
"prosemirror-state": "^1.4.4"
|
|
41
|
+
"lit": "^3.3.2"
|
|
40
42
|
},
|
|
41
43
|
"files": [
|
|
42
44
|
"dist"
|