@digabi/exam-engine-core 22.0.1-alpha.4 → 22.0.1-alpha.6
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/grading-instructions/AnswerGradingInstruction.js +1 -1
- package/dist/components/grading-instructions/AnswerGradingInstruction.js.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.d.ts +2 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.js +40 -22
- package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
- package/dist/components/grading-instructions/ExamGradingInstruction.js +1 -1
- package/dist/components/grading-instructions/ExamGradingInstruction.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/package.json +8 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { GradingInstructionContext } from '../context/GradingInstructionContext';
|
3
|
-
import
|
3
|
+
import EditableGradingInstruction from './EditableGradingInstruction';
|
4
4
|
const AnswerGradingInstruction = ({ element, renderChildNodes }) => {
|
5
5
|
const { editable } = useContext(GradingInstructionContext);
|
6
6
|
return (React.createElement("div", { className: "e-answer-grading-instruction e-multiline-results-text-answer e-mrg-b-2 e-pad-l-2" }, editable ? React.createElement(EditableGradingInstruction, { element: element }) : renderChildNodes(element)));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AnswerGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/AnswerGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,
|
1
|
+
{"version":3,"file":"AnswerGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/AnswerGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,0BAA0B,MAAM,8BAA8B,CAAA;AAErE,MAAM,wBAAwB,GAAgD,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE;IAC9G,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAA;IAC1D,OAAO,CACL,6BAAK,SAAS,EAAC,kFAAkF,IAC9F,QAAQ,CAAC,CAAC,CAAC,oBAAC,0BAA0B,IAAC,OAAO,EAAE,OAAO,GAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CACpF,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,wBAAwB,CAAA"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
|
2
|
+
declare function EditableGradingInstruction({ element }: {
|
3
3
|
element: Element;
|
4
4
|
}): React.JSX.Element;
|
5
|
+
export default EditableGradingInstruction;
|
5
6
|
//# sourceMappingURL=EditableGradingInstruction.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"EditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAA;AA2BnD,iBAAS,0BAA0B,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,qBA0BpE;AAED,eAAe,0BAA0B,CAAA"}
|
@@ -1,26 +1,44 @@
|
|
1
|
-
import React, { useContext,
|
2
|
-
import {
|
1
|
+
import React, { useContext, useState } from 'react';
|
2
|
+
import { schema } from 'prosemirror-schema-basic';
|
3
|
+
import { EditorState } from 'prosemirror-state';
|
4
|
+
import { toggleMark, baseKeymap } from 'prosemirror-commands';
|
3
5
|
import { GradingInstructionContext } from '../context/GradingInstructionContext';
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
|
7
|
-
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
import { ProseMirror, useEditorEventCallback } from '@nytimes/react-prosemirror';
|
7
|
+
import { DOMParser as ProseDOMParser, DOMSerializer } from 'prosemirror-model';
|
8
|
+
import { keymap } from 'prosemirror-keymap';
|
9
|
+
function BoldButton() {
|
10
|
+
const onClick = useEditorEventCallback(view => {
|
11
|
+
const toggleBoldMark = toggleMark(view.state.schema.marks.strong);
|
12
|
+
toggleBoldMark(view.state, view.dispatch, view);
|
13
|
+
});
|
14
|
+
return React.createElement("button", { onClick: onClick }, "Bold");
|
15
|
+
}
|
16
|
+
function ItalicButton() {
|
17
|
+
const onClick = useEditorEventCallback(view => {
|
18
|
+
const toggleItalicMark = toggleMark(view.state.schema.marks.em);
|
19
|
+
toggleItalicMark(view.state, view.dispatch, view);
|
20
|
+
});
|
21
|
+
return React.createElement("button", { onClick: onClick }, "Italic");
|
22
|
+
}
|
23
|
+
function EditableGradingInstruction({ element }) {
|
24
|
+
const { onContentChange } = useContext(GradingInstructionContext);
|
25
|
+
const doc = ProseDOMParser.fromSchema(schema).parse(element);
|
26
|
+
const [mount, setMount] = useState(null);
|
27
|
+
const [state, setState] = useState(EditorState.create({ schema, doc, plugins: [keymap(baseKeymap)] }));
|
28
|
+
return (React.createElement(ProseMirror, { mount: mount, state: state, dispatchTransaction: tr => {
|
29
|
+
var _a;
|
30
|
+
setState(s => s.apply(tr));
|
31
|
+
const fragment = DOMSerializer.fromSchema(state.schema).serializeFragment(tr.doc.content);
|
32
|
+
const div = document.createElement('div');
|
33
|
+
div.appendChild(fragment);
|
14
34
|
const path = (_a = element.getAttribute('path')) !== null && _a !== void 0 ? _a : '';
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
}, [language, examType]);
|
24
|
-
return React.createElement("div", { ref: answerGradingInstructionDiv });
|
35
|
+
if (onContentChange) {
|
36
|
+
onContentChange(div.innerHTML, path);
|
37
|
+
}
|
38
|
+
} },
|
39
|
+
React.createElement(BoldButton, null),
|
40
|
+
React.createElement(ItalicButton, null),
|
41
|
+
React.createElement("div", { ref: setMount })));
|
25
42
|
}
|
43
|
+
export default EditableGradingInstruction;
|
26
44
|
//# sourceMappingURL=EditableGradingInstruction.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EditableGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,
|
1
|
+
{"version":3,"file":"EditableGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAChF,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,SAAS,UAAU;IACjB,MAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,CAAC,EAAE;QAC5C,MAAM,cAAc,GAAG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,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;YAC1B,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACzF,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;YACzC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;YACzB,MAAM,IAAI,GAAG,MAAA,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAA;YAC/C,IAAI,eAAe,EAAE,CAAC;gBACpB,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;YACtC,CAAC;QACH,CAAC;QAED,oBAAC,UAAU,OAAG;QACd,oBAAC,YAAY,OAAG;QAChB,6BAAK,GAAG,EAAE,QAAQ,GAAI,CACV,CACf,CAAA;AACH,CAAC;AAED,eAAe,0BAA0B,CAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
2
|
import { GradingInstructionContext } from '../context/GradingInstructionContext';
|
3
|
-
import
|
3
|
+
import EditableGradingInstruction from './EditableGradingInstruction';
|
4
4
|
const ExamGradingInstruction = ({ element, renderChildNodes }) => {
|
5
5
|
const { editable } = useContext(GradingInstructionContext);
|
6
6
|
return (React.createElement("div", { className: "e-exam-grading-instruction notification e-pad-4", "data-annotation-anchor": "exam-grading-instruction" }, editable ? React.createElement(EditableGradingInstruction, { element: element }) : renderChildNodes(element)));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ExamGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/ExamGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,
|
1
|
+
{"version":3,"file":"ExamGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/ExamGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,0BAA0B,MAAM,8BAA8B,CAAA;AAErE,MAAM,sBAAsB,GAAgD,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE;IAC5G,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAA;IAE1D,OAAO,CACL,6BAAK,SAAS,EAAC,iDAAiD,4BAAwB,0BAA0B,IAC/G,QAAQ,CAAC,CAAC,CAAC,oBAAC,0BAA0B,IAAC,OAAO,EAAE,OAAO,GAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,CACpF,CACP,CAAA;AACH,CAAC,CAAA;AACD,eAAe,sBAAsB,CAAA"}
|