@digabi/exam-engine-core 22.0.6-alpha.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/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/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/package.json +3 -2
@@ -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,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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O,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"}
|
@@ -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,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EAAE,WAAW,CAAA;CAAE,qBAmBhE"}
|
@@ -0,0 +1,19 @@
|
|
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,eA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