@digabi/exam-engine-core 19.12.2-alpha.5 → 19.12.2-alpha.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/exam/RichTextAnswer.d.ts +1 -0
- package/dist/components/exam/RichTextAnswer.d.ts.map +1 -1
- package/dist/components/exam/RichTextAnswer.js +18 -0
- package/dist/components/exam/RichTextAnswer.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/dist/main-bundle.js.LICENSE.txt +18 -0
- package/package.json +3 -3
@@ -29,6 +29,7 @@ export default class RichTextAnswer extends React.PureComponent<Props> {
|
|
29
29
|
private ref;
|
30
30
|
private lastHTML;
|
31
31
|
constructor(props: Props);
|
32
|
+
componentDidMount(): void;
|
32
33
|
handleSaveError: (err: ErrorResponse) => void;
|
33
34
|
handleChange: (data: {
|
34
35
|
answerHTML: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RichTextAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/RichTextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;
|
1
|
+
{"version":3,"file":"RichTextAnswer.d.ts","sourceRoot":"","sources":["../../../src/components/exam/RichTextAnswer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAOhE,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,oBAAoB,GAAG,+BAA+B,GAAG,0BAA0B,CAAA;IACxF,OAAO,CAAC,EAAE,QAAQ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|
+
import { makeRichText } from 'rich-text-editor';
|
4
5
|
import { ExpandQuestionContext } from './Question';
|
5
6
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
6
7
|
import { faExpandAlt } from '@fortawesome/free-solid-svg-icons';
|
@@ -29,6 +30,23 @@ class RichTextAnswer extends React.PureComponent {
|
|
29
30
|
this.ref = React.createRef();
|
30
31
|
this.lastHTML = this.props.answer ? this.props.answer.value : '';
|
31
32
|
}
|
33
|
+
componentDidMount() {
|
34
|
+
const { current } = this.ref;
|
35
|
+
const { answer, saveScreenshot } = this.props;
|
36
|
+
if (current) {
|
37
|
+
if (answer) {
|
38
|
+
current.innerHTML = answer.value;
|
39
|
+
}
|
40
|
+
makeRichText(current, {
|
41
|
+
ignoreEventHandling: this.props.ignoreEventHandling,
|
42
|
+
locale: this.context.language.slice(0, 2).toUpperCase(),
|
43
|
+
screenshotSaver: ({ data, type }) => saveScreenshot(data instanceof Blob ? data : new Blob([data], { type })).catch((err) => {
|
44
|
+
this.handleSaveError(err);
|
45
|
+
throw err; // Rethrow error so rich-text-editor can handle it.
|
46
|
+
})
|
47
|
+
}, this.handleChange);
|
48
|
+
}
|
49
|
+
}
|
32
50
|
componentDidUpdate() {
|
33
51
|
const { current } = this.ref;
|
34
52
|
// Don't update element unless value has changed from last known value to prevent cursor jumping
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RichTextAnswer.js","sourceRoot":"","sources":["../../../src/components/exam/RichTextAnswer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAC/D,OAAO,EA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