@digabi/exam-engine-core 22.0.5-editor-ee-to-em.0 → 22.0.7-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/editor/undoRedo.test.d.ts +2 -0
- package/dist/__tests__/editor/undoRedo.test.d.ts.map +1 -0
- package/dist/__tests__/editor/undoRedo.test.js +61 -0
- package/dist/__tests__/editor/undoRedo.test.js.map +1 -0
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/context/GradingInstructionContext.d.ts +11 -6
- package/dist/components/context/GradingInstructionContext.d.ts.map +1 -1
- package/dist/components/context/GradingInstructionContext.js.map +1 -1
- package/dist/components/grading-instructions/AnswerGradingInstruction.d.ts.map +1 -1
- package/dist/components/grading-instructions/AnswerGradingInstruction.js +3 -4
- package/dist/components/grading-instructions/AnswerGradingInstruction.js.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.js +18 -3
- package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
- package/dist/components/grading-instructions/GradingInstructionProvider.d.ts +1 -1
- package/dist/components/grading-instructions/GradingInstructionProvider.d.ts.map +1 -1
- package/dist/components/grading-instructions/GradingInstructionProvider.js +4 -1
- package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -1
- package/dist/components/grading-instructions/GradingInstructions.d.ts +2 -6
- package/dist/components/grading-instructions/GradingInstructions.d.ts.map +1 -1
- package/dist/components/grading-instructions/GradingInstructions.js +3 -2
- package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
- package/dist/components/grading-instructions/editor/FormulaPopup.js +5 -5
- package/dist/components/grading-instructions/editor/FormulaPopup.js.map +1 -1
- package/dist/components/grading-instructions/editor/UndoRedoButtons.d.ts +6 -0
- package/dist/components/grading-instructions/editor/UndoRedoButtons.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/UndoRedoButtons.js +19 -0
- package/dist/components/grading-instructions/editor/UndoRedoButtons.js.map +1 -0
- package/dist/main-bundle.js +1 -1
- package/dist/main.css +1 -1
- package/package.json +12 -2
- package/dist/__tests__/EditableGradingInstruction.test.d.ts +0 -2
- package/dist/__tests__/EditableGradingInstruction.test.d.ts.map +0 -1
- package/dist/__tests__/EditableGradingInstruction.test.js +0 -174
- package/dist/__tests__/EditableGradingInstruction.test.js.map +0 -1
- package/dist/__tests__/FormatButton.test.d.ts +0 -2
- package/dist/__tests__/FormatButton.test.d.ts.map +0 -1
- package/dist/__tests__/FormatButton.test.js +0 -94
- package/dist/__tests__/FormatButton.test.js.map +0 -1
- package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts +0 -4
- package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/schemas/image-schema.js +0 -47
- package/dist/components/grading-instructions/editor/schemas/image-schema.js.map +0 -1
- package/dist/components/grading-instructions/localization.d.ts +0 -3
- package/dist/components/grading-instructions/localization.d.ts.map +0 -1
- package/dist/components/grading-instructions/localization.js +0 -41
- package/dist/components/grading-instructions/localization.js.map +0 -1
@@ -2,11 +2,16 @@ import React from 'react';
|
|
2
2
|
export interface GradingInstructionPropsBase {
|
3
3
|
children?: React.ReactNode;
|
4
4
|
}
|
5
|
-
export
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
export interface EditableProps extends GradingInstructionPropsBase {
|
6
|
+
editable: true;
|
7
|
+
onContentChange: (answerHTML: string, path: string) => void;
|
8
|
+
onSaveImage: (file: File, displayNumber?: string) => Promise<string>;
|
9
|
+
}
|
10
|
+
export interface NotEditableProps extends GradingInstructionPropsBase {
|
11
|
+
editable?: false;
|
12
|
+
onContentChange?: never;
|
13
|
+
onSaveImage?: never;
|
14
|
+
}
|
15
|
+
export type GradingInstructionProps = EditableProps | NotEditableProps;
|
11
16
|
export declare const GradingInstructionContext: React.Context<GradingInstructionProps>;
|
12
17
|
//# sourceMappingURL=GradingInstructionContext.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GradingInstructionContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/GradingInstructionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,MAAM,
|
1
|
+
{"version":3,"file":"GradingInstructionContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/GradingInstructionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B;AAED,MAAM,WAAW,aAAc,SAAQ,2BAA2B;IAChE,QAAQ,EAAE,IAAI,CAAA;IACd,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3D,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CACrE;AAED,MAAM,WAAW,gBAAiB,SAAQ,2BAA2B;IACnE,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,eAAe,CAAC,EAAE,KAAK,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAA;CACpB;AAED,MAAM,MAAM,uBAAuB,GAAG,aAAa,GAAG,gBAAgB,CAAA;AAEtE,eAAO,MAAM,yBAAyB,wCAAqD,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GradingInstructionContext.js","sourceRoot":"","sources":["../../../src/components/context/GradingInstructionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"GradingInstructionContext.js","sourceRoot":"","sources":["../../../src/components/context/GradingInstructionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAoBzB,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAC,aAAa,CAAC,EAA6B,CAAC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AnswerGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/AnswerGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAIjE,QAAA,MAAM,wBAAwB,EAAE,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,
|
1
|
+
{"version":3,"file":"AnswerGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/AnswerGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAIjE,QAAA,MAAM,wBAAwB,EAAE,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CAOzE,CAAA;AAED,eAAe,wBAAwB,CAAA"}
|
@@ -1,10 +1,9 @@
|
|
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
|
-
const {
|
6
|
-
|
7
|
-
return (React.createElement("div", { className: "e-answer-grading-instruction e-multiline-results-text-answer e-mrg-b-2 e-pad-l-2" }, EditorComponent ? (React.createElement(EditorComponent, { element: element, displayNumber: displayNumber })) : (renderChildNodes(element))));
|
5
|
+
const { editable } = useContext(GradingInstructionContext);
|
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)));
|
8
7
|
};
|
9
8
|
export default AnswerGradingInstruction;
|
10
9
|
//# sourceMappingURL=AnswerGradingInstruction.js.map
|
@@ -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 +1 @@
|
|
1
|
-
{"version":3,"file":"EditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"EditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAA;AAgF9D,iBAAS,0BAA0B,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,qBA6FpE;AAED,eAAe,0BAA0B,CAAA"}
|
@@ -14,7 +14,7 @@ import { NbspButton, nbspPlugin } from './editor/NBSP';
|
|
14
14
|
import { ImageUploadButton } from './editor/ImageUploadButton';
|
15
15
|
import { imageInputSchema, imageOutputSchema } from './editor/schemas/imageSchema';
|
16
16
|
import { CommonExamContext } from '../context/CommonExamContext';
|
17
|
-
import { faBold, faItalic, faList, faListOl } from '@fortawesome/free-solid-svg-icons';
|
17
|
+
import { faBold, faItalic, faList, faListOl, faSubscript, faSuperscript } from '@fortawesome/free-solid-svg-icons';
|
18
18
|
import { formulaOutputSchema, formulaSchema } from './editor/schemas/formulaSchema';
|
19
19
|
import { tableSchema } from './editor/schemas/tableSchema';
|
20
20
|
import { spanWithNowrapSchema } from './editor/schemas/spanWithNowrapSchema';
|
@@ -23,6 +23,8 @@ import { listSchema } from './editor/schemas/listSchema';
|
|
23
23
|
import { createListPlugin, ListButton } from './editor/List';
|
24
24
|
import { subSupSchema } from './editor/schemas/subSupSchema';
|
25
25
|
import { spanWithLangSchema } from './editor/schemas/spanWithLangSchema';
|
26
|
+
import { UndoRedoButtons } from './editor/UndoRedoButtons';
|
27
|
+
import { history } from 'prosemirror-history';
|
26
28
|
function Menu(props) {
|
27
29
|
const { onSaveImage } = useContext(GradingInstructionContext);
|
28
30
|
const [isFloating, setIsFloating] = useState(false);
|
@@ -47,6 +49,11 @@ function Menu(props) {
|
|
47
49
|
React.createElement(FormatButton, { markName: "strong", icon: faBold }),
|
48
50
|
React.createElement(FormatButton, { markName: "em", icon: faItalic }),
|
49
51
|
React.createElement("span", { className: "editor-menu-separator" }),
|
52
|
+
React.createElement(UndoRedoButtons, { state: props.state }),
|
53
|
+
React.createElement("span", { className: "editor-menu-separator" }),
|
54
|
+
React.createElement(FormatButton, { markName: "sup", icon: faSuperscript }),
|
55
|
+
React.createElement(FormatButton, { markName: "sub", icon: faSubscript }),
|
56
|
+
React.createElement("span", { className: "editor-menu-separator" }),
|
50
57
|
React.createElement(ListButton, { nodeType: props.schema.nodes.bullet_list, icon: faList }),
|
51
58
|
React.createElement(ListButton, { nodeType: props.schema.nodes.ordered_list, icon: faListOl }),
|
52
59
|
onSaveImage && React.createElement(ImageUploadButton, { saveImage: onSaveImage }),
|
@@ -84,10 +91,18 @@ function EditableGradingInstruction({ element }) {
|
|
84
91
|
const [mount, setMount] = useState(null);
|
85
92
|
const [formulaState, setFormulaState] = useState(null);
|
86
93
|
const formulaPlugin = new FormulaPlugin(setFormulaState);
|
94
|
+
const historyPlugin = history();
|
87
95
|
const [state, setState] = useState(EditorState.create({
|
88
96
|
schema: inputSchema,
|
89
97
|
doc,
|
90
|
-
plugins: [
|
98
|
+
plugins: [
|
99
|
+
tablePlugin(),
|
100
|
+
createListPlugin(inputSchema),
|
101
|
+
keymap(baseKeymap),
|
102
|
+
formulaPlugin,
|
103
|
+
nbspPlugin,
|
104
|
+
historyPlugin
|
105
|
+
]
|
91
106
|
}));
|
92
107
|
return (React.createElement(ProseMirror, { mount: mount, state: state, dispatchTransaction: tr => {
|
93
108
|
setState(s => {
|
@@ -111,7 +126,7 @@ function EditableGradingInstruction({ element }) {
|
|
111
126
|
return newContent;
|
112
127
|
});
|
113
128
|
} },
|
114
|
-
mount && (React.createElement(Menu, { schema: inputSchema, formulaState: formulaState, setFormulaState: setFormulaState, editorElement: mount })),
|
129
|
+
mount && (React.createElement(Menu, { schema: inputSchema, formulaState: formulaState, setFormulaState: setFormulaState, editorElement: mount, state: state })),
|
115
130
|
React.createElement("div", { ref: setMount }),
|
116
131
|
formulaState && (React.createElement(FormulaPopup, { state: formulaState, onFinish: () => {
|
117
132
|
setFormulaState(null);
|
@@ -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,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9D,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAsB,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACnF,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,YAAY,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAA;
|
1
|
+
{"version":3,"file":"EditableGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAA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Q,CAAC;6BAC5B,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;6BACzB,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;6BACzB,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;6BAC5B,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;wBAC/B,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;oBAClC,CAAC;gBACH,CAAC;gBACD,OAAO,UAAU,CAAA;YACnB,CAAC,CAAC,CAAA;QACJ,CAAC;QAEA,KAAK,IAAI,CACR,oBAAC,IAAI,IACH,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,KAAK,EACpB,KAAK,EAAE,KAAK,GACZ,CACH;QACD,6BAAK,GAAG,EAAE,QAAQ,GAAI;QAErB,YAAY,IAAI,CACf,oBAAC,YAAY,IACX,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,GAAG,EAAE;gBACb,eAAe,CAAC,IAAI,CAAC,CAAA;YACvB,CAAC,GACD,CACH,CACW,CACf,CAAA;AACH,CAAC;AAED,eAAe,0BAA0B,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { GradingInstructionProps } from '../context/GradingInstructionContext';
|
3
|
-
export declare const GradingInstructionProvider: ({
|
3
|
+
export declare const GradingInstructionProvider: ({ editable, onContentChange, onSaveImage, children }: GradingInstructionProps) => React.JSX.Element;
|
4
4
|
//# sourceMappingURL=GradingInstructionProvider.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GradingInstructionProvider.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAA6B,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAEzG,eAAO,MAAM,0BAA0B,
|
1
|
+
{"version":3,"file":"GradingInstructionProvider.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAA6B,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAEzG,eAAO,MAAM,0BAA0B,yDAKpC,uBAAuB,sBAGzB,CAAA"}
|
@@ -1,4 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { GradingInstructionContext } from '../context/GradingInstructionContext';
|
3
|
-
export const GradingInstructionProvider = ({
|
3
|
+
export const GradingInstructionProvider = ({ editable, onContentChange, onSaveImage, children }) => {
|
4
|
+
const contextValue = editable ? { editable, onContentChange, onSaveImage } : { editable };
|
5
|
+
return React.createElement(GradingInstructionContext.Provider, { value: contextValue }, children);
|
6
|
+
};
|
4
7
|
//# sourceMappingURL=GradingInstructionProvider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GradingInstructionProvider.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,yBAAyB,EAA2B,MAAM,sCAAsC,CAAA;AAEzG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,
|
1
|
+
{"version":3,"file":"GradingInstructionProvider.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructionProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,yBAAyB,EAA2B,MAAM,sCAAsC,CAAA;AAEzG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACzC,QAAQ,EACR,eAAe,EACf,WAAW,EACX,QAAQ,EACgB,EAAE,EAAE;IAC5B,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAA;IACzF,OAAO,oBAAC,yBAAyB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IAAG,QAAQ,CAAsC,CAAA;AACjH,CAAC,CAAA"}
|
@@ -1,11 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { AnnotationProps, CommonExamProps } from '../exam/Exam';
|
3
|
+
import { GradingInstructionProps } from '../context/GradingInstructionContext';
|
3
4
|
export declare const GradingInstructionsPageTitle: React.FunctionComponent;
|
4
|
-
declare const _default: React.MemoExoticComponent<React.ComponentType<CommonExamProps & AnnotationProps &
|
5
|
-
EditorComponent?: React.ComponentType<{
|
6
|
-
element: Element;
|
7
|
-
displayNumber: string;
|
8
|
-
}>;
|
9
|
-
}>>;
|
5
|
+
declare const _default: React.MemoExoticComponent<React.ComponentType<CommonExamProps & (AnnotationProps & GradingInstructionProps)>>;
|
10
6
|
export default _default;
|
11
7
|
//# sourceMappingURL=GradingInstructions.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GradingInstructions.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAA;AAcpD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;
|
1
|
+
{"version":3,"file":"GradingInstructions.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAA;AAcpD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAoB/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAmH9E,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,iBAGhD,CAAA;;AAED,wBAAqE"}
|
@@ -71,7 +71,7 @@ const renderChildNodes = createRenderChildNodes({
|
|
71
71
|
'section-title': SectionTitle,
|
72
72
|
video: Recording
|
73
73
|
});
|
74
|
-
const GradingInstructions = ({ doc, annotations, onClickAnnotation, onSaveAnnotation,
|
74
|
+
const GradingInstructions = ({ doc, annotations, onClickAnnotation, onSaveAnnotation, editable, onContentChange, onSaveImage }) => {
|
75
75
|
const root = doc.documentElement;
|
76
76
|
const { date, dateTimeFormatter, dayCode, examCode, language, subjectLanguage } = useContext(CommonExamContext);
|
77
77
|
const examTitle = findChildElement(root, 'exam-title');
|
@@ -85,8 +85,9 @@ const GradingInstructions = ({ doc, annotations, onClickAnnotation, onSaveAnnota
|
|
85
85
|
const i18n = useCached(() => initI18n(language, examCode, dayCode));
|
86
86
|
useEffect(changeLanguage(i18n, language));
|
87
87
|
useEffect(scrollToHash, []);
|
88
|
+
const props = editable ? { editable, onContentChange, onSaveImage } : { editable };
|
88
89
|
return (React.createElement(AnnotationProvider, { annotations: annotations, onClickAnnotation: onClickAnnotation, onSaveAnnotation: onSaveAnnotation },
|
89
|
-
React.createElement(GradingInstructionProvider, {
|
90
|
+
React.createElement(GradingInstructionProvider, { ...props },
|
90
91
|
React.createElement(I18nextProvider, { i18n: i18n },
|
91
92
|
React.createElement("main", { className: "e-exam e-grading-instructions", lang: subjectLanguage },
|
92
93
|
React.createElement(React.StrictMode, null),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GradingInstructions.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACzE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/B,OAAO,EAAE,OAAO;IAChB,eAAe,EAAE,YAAY;IAC7B,KAAK,EAAE,SAAS;CACjB,CAAC,CAAA;AAEF,MAAM,mBAAmB,GAAyF,CAAC,EACjH,GAAG,EACH,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,
|
1
|
+
{"version":3,"file":"GradingInstructions.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAC5C,OAAO,kBAAkB,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,cAAc,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AAEvF,OAAO,mBAAmB,MAAM,6BAA6B,CAAA;AAC7D,OAAO,gBAAgB,MAAM,0BAA0B,CAAA;AACvD,OAAO,iBAAiB,MAAM,2BAA2B,CAAA;AACzD,OAAO,eAAe,MAAM,2BAA2B,CAAA;AACvD,OAAO,IAAI,MAAM,gBAAgB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e,EAAE,gBAAgB,GAAM,CACnE,CACP,CACc;oBAChB,gBAAgB,CAAC,IAAI,CAAC,CAClB,CACS,CACS,CACV,CACtB,CAAA;AACH,CAAC,CAAA;AAED,4FAA4F;AAC5F,MAAM,CAAC,MAAM,4BAA4B,GAA4B,GAAG,EAAE;IACxE,MAAM,EAAE,CAAC,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAClC,OAAO,0CAAG,CAAC,CAAC,iCAAiC,CAAC,CAAI,CAAA;AACpD,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,CAAC,CAAA"}
|
@@ -3,14 +3,14 @@ import { useEditorEventCallback } from '@nytimes/react-prosemirror';
|
|
3
3
|
import { Popup } from '../../shared/Popup';
|
4
4
|
export function FormulaPopup({ state, onFinish }) {
|
5
5
|
const onValueChange = (text) => {
|
6
|
-
if (text.length
|
7
|
-
return
|
6
|
+
if (containsOnlyOneImgTag(text) || !text.length || text == '\\' || text.match(/^\\[^<]/)) {
|
7
|
+
return null;
|
8
8
|
}
|
9
|
-
return
|
9
|
+
return 'Ainoastaan yksi kaava sallittu';
|
10
10
|
};
|
11
11
|
const onContentChange = useEditorEventCallback((view, textField) => {
|
12
12
|
const node = view.state.doc.nodeAt(state.pos);
|
13
|
-
const latex = extractLatex(textField) || '';
|
13
|
+
const latex = textField.startsWith('\\') ? textField : extractLatex(textField) || '';
|
14
14
|
const { schema } = view.state;
|
15
15
|
if (node) {
|
16
16
|
const tr = view.state.tr.replaceWith(state.pos, state.pos + node.nodeSize, schema.node('formula', { ...node.attrs, ...{ latex } }));
|
@@ -44,6 +44,6 @@ function extractLatex(value) {
|
|
44
44
|
function containsOnlyOneImgTag(htmlString) {
|
45
45
|
const imgTagPattern = /^<img\s+[^>]*>$/g;
|
46
46
|
const matches = htmlString.trim().match(imgTagPattern);
|
47
|
-
return matches
|
47
|
+
return (matches === null || matches === void 0 ? void 0 : matches.length) === 1;
|
48
48
|
}
|
49
49
|
//# sourceMappingURL=FormulaPopup.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormulaPopup.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/FormulaPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAuD;IACnG,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE;QACrC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,
|
1
|
+
{"version":3,"file":"FormulaPopup.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/FormulaPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAuD;IACnG,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE;QACrC,IAAI,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;YACzF,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,gCAAgC,CAAA;IACzC,CAAC,CAAA;IAED,MAAM,eAAe,GAAG,sBAAsB,CAAC,CAAC,IAAI,EAAE,SAAiB,EAAE,EAAE;QACzE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC7C,MAAM,KAAK,GAA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
|
1
|
+
import React from 'react';
|
2
|
+
import { useEditorEventCallback } from '@nytimes/react-prosemirror';
|
3
|
+
import { undo, redo, undoDepth, redoDepth } from 'prosemirror-history';
|
4
|
+
import { faRedo, faUndo } from '@fortawesome/free-solid-svg-icons';
|
5
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
6
|
+
export function UndoRedoButtons({ state }) {
|
7
|
+
const onUndo = useEditorEventCallback(view => {
|
8
|
+
undo(view.state, view.dispatch);
|
9
|
+
});
|
10
|
+
const onRedo = useEditorEventCallback(view => {
|
11
|
+
redo(view.state, view.dispatch);
|
12
|
+
});
|
13
|
+
return (React.createElement(React.Fragment, null,
|
14
|
+
React.createElement("button", { onClick: onUndo, title: "kumoa muutokset", disabled: undoDepth(state) === 0 },
|
15
|
+
React.createElement(FontAwesomeIcon, { size: "lg", icon: faUndo, className: "editor-menu-icon" })),
|
16
|
+
React.createElement("button", { onClick: onRedo, title: "toista muutokset", disabled: redoDepth(state) === 0 },
|
17
|
+
React.createElement(FontAwesomeIcon, { size: "lg", icon: faRedo, className: "editor-menu-icon" }))));
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=UndoRedoButtons.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UndoRedoButtons.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/UndoRedoButtons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAGhE,MAAM,UAAU,eAAe,CAAC,EAAE,KAAK,EAA0B;IAC/D,MAAM,MAAM,GAAG,sBAA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