@digabi/exam-engine-core 22.1.3-alpha.3 → 22.1.4-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/EditableGradingInstruction.test.js +3 -7
- package/dist/__tests__/EditableGradingInstruction.test.js.map +1 -1
- package/dist/__tests__/editor/FormatButton.test.d.ts +2 -0
- package/dist/__tests__/editor/FormatButton.test.d.ts.map +1 -0
- package/dist/__tests__/editor/FormatButton.test.js +97 -0
- package/dist/__tests__/editor/FormatButton.test.js.map +1 -0
- package/dist/__tests__/editor/Formula.test.js +15 -8
- package/dist/__tests__/editor/Formula.test.js.map +1 -1
- package/dist/__tests__/editor/ImageUploadButton.test.d.ts +2 -0
- package/dist/__tests__/editor/ImageUploadButton.test.d.ts.map +1 -0
- package/dist/__tests__/editor/ImageUploadButton.test.js +69 -0
- package/dist/__tests__/editor/ImageUploadButton.test.js.map +1 -0
- package/dist/__tests__/editor/br.test.js +2 -6
- package/dist/__tests__/editor/br.test.js.map +1 -1
- package/dist/__tests__/editor/hr.test.js +2 -6
- package/dist/__tests__/editor/hr.test.js.map +1 -1
- package/dist/__tests__/editor/nbsp.test.js +3 -7
- package/dist/__tests__/editor/nbsp.test.js.map +1 -1
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/__tests__/utils/prosemirror.d.ts +0 -1
- package/dist/__tests__/utils/prosemirror.d.ts.map +1 -1
- package/dist/__tests__/utils/prosemirror.js +0 -8
- package/dist/__tests__/utils/prosemirror.js.map +1 -1
- package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts +2 -0
- package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts.map +1 -1
- package/dist/__tests__/utils/renderEditableGradingInstruction.js +8 -2
- package/dist/__tests__/utils/renderEditableGradingInstruction.js.map +1 -1
- package/dist/__tests__/utils/util.d.ts +2 -0
- package/dist/__tests__/utils/util.d.ts.map +1 -0
- package/dist/__tests__/utils/util.js +10 -0
- package/dist/__tests__/utils/util.js.map +1 -0
- package/dist/components/context/AttachmentContext.d.ts.map +1 -1
- package/dist/components/context/ExamContext.d.ts.map +1 -1
- package/dist/components/context/GradingInstructionContext.d.ts +2 -2
- package/dist/components/context/GradingInstructionContext.d.ts.map +1 -1
- package/dist/components/context/QuestionContext.d.ts.map +1 -1
- package/dist/components/context/ResultsContext.d.ts.map +1 -1
- package/dist/components/context/SectionContext.d.ts.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.js +37 -55
- package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
- package/dist/components/grading-instructions/ExamGradingInstruction.d.ts.map +1 -1
- package/dist/components/grading-instructions/ExamGradingInstruction.js +7 -2
- package/dist/components/grading-instructions/ExamGradingInstruction.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 +2 -2
- package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -1
- package/dist/components/grading-instructions/GradingInstructions.d.ts +1 -1
- package/dist/components/grading-instructions/GradingInstructions.js +2 -2
- package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
- package/dist/components/grading-instructions/editor/Formula.d.ts +1 -0
- package/dist/components/grading-instructions/editor/Formula.d.ts.map +1 -1
- package/dist/components/grading-instructions/editor/Formula.js +17 -4
- package/dist/components/grading-instructions/editor/Formula.js.map +1 -1
- package/dist/components/grading-instructions/editor/ImageUploadButton.d.ts +6 -0
- package/dist/components/grading-instructions/editor/ImageUploadButton.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/ImageUploadButton.js +73 -0
- package/dist/components/grading-instructions/editor/ImageUploadButton.js.map +1 -0
- package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts +4 -0
- package/dist/components/grading-instructions/editor/schemas/image-schema.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/schemas/image-schema.js +47 -0
- package/dist/components/grading-instructions/editor/schemas/image-schema.js.map +1 -0
- package/dist/main-bundle.js +1 -1
- package/dist/main-bundle.js.LICENSE.txt +1 -1
- package/dist/main.css +1 -1
- package/package.json +2 -2
- package/dist/components/Localization.d.ts +0 -5
- package/dist/components/Localization.d.ts.map +0 -1
- package/dist/components/Localization.js +0 -9
- package/dist/components/Localization.js.map +0 -1
- package/dist/components/grading-instructions/GradingInstruction.d.ts +0 -7
- package/dist/components/grading-instructions/GradingInstruction.d.ts.map +0 -1
- package/dist/components/grading-instructions/GradingInstruction.js +0 -9
- package/dist/components/grading-instructions/GradingInstruction.js.map +0 -1
- package/dist/components/grading-instructions/editor/CurrentElement.d.ts +0 -2
- package/dist/components/grading-instructions/editor/CurrentElement.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/CurrentElement.js +0 -8
- package/dist/components/grading-instructions/editor/CurrentElement.js.map +0 -1
- package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts +0 -5
- package/dist/components/grading-instructions/editor/CurrentLocalization.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/CurrentLocalization.js +0 -17
- package/dist/components/grading-instructions/editor/CurrentLocalization.js.map +0 -1
- package/dist/components/grading-instructions/editor/Localization.d.ts +0 -3
- package/dist/components/grading-instructions/editor/Localization.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/Localization.js +0 -36
- package/dist/components/grading-instructions/editor/Localization.js.map +0 -1
- package/dist/components/grading-instructions/editor/localizatio.d.ts +0 -3
- package/dist/components/grading-instructions/editor/localizatio.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/localizatio.js +0 -36
- package/dist/components/grading-instructions/editor/localizatio.js.map +0 -1
- package/dist/components/grading-instructions/editor/localizationSpan.d.ts +0 -3
- package/dist/components/grading-instructions/editor/localizationSpan.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/localizationSpan.js +0 -36
- package/dist/components/grading-instructions/editor/localizationSpan.js.map +0 -1
- package/dist/components/grading-instructions/editor/spanWithPath.d.ts +0 -3
- package/dist/components/grading-instructions/editor/spanWithPath.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/spanWithPath.js +0 -24
- package/dist/components/grading-instructions/editor/spanWithPath.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"prosemirror.d.ts","sourceRoot":"","sources":["../../../__tests__/utils/prosemirror.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"prosemirror.d.ts","sourceRoot":"","sources":["../../../__tests__/utils/prosemirror.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,sBA2B9B"}
|
@@ -1,8 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.mockCreateRange = mockCreateRange;
|
4
|
-
exports.promisifiedFireEventInput = promisifiedFireEventInput;
|
5
|
-
const react_1 = require("@testing-library/react");
|
6
4
|
function mockCreateRange() {
|
7
5
|
const originalCreateRange = global.window.document.createRange;
|
8
6
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
@@ -29,10 +27,4 @@ function mockCreateRange() {
|
|
29
27
|
};
|
30
28
|
return () => (global.window.document.createRange = originalCreateRange);
|
31
29
|
}
|
32
|
-
function promisifiedFireEventInput(element, options) {
|
33
|
-
return new Promise(resolve => {
|
34
|
-
react_1.fireEvent.input(element, options);
|
35
|
-
resolve();
|
36
|
-
});
|
37
|
-
}
|
38
30
|
//# sourceMappingURL=prosemirror.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"prosemirror.js","sourceRoot":"","sources":["../../../__tests__/utils/prosemirror.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"prosemirror.js","sourceRoot":"","sources":["../../../__tests__/utils/prosemirror.ts"],"names":[],"mappings":";;AAAA,0CA2BC;AA3BD,SAAgB,eAAe;IAC7B,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAA;IAC9D,6DAA6D;IAC7D,mBAAmB;IACnB,MAAM,CAAC,KAAK,GAAG,SAAS,KAAK,KAAI,CAAC,CAAA;IAElC,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAAE,EAAE;QAChD,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QACzC,GAAG,CAAC,SAAS,GAAG,IAAI,CAAA;QACpB,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IACxB,CAAC,CAAA;IACD,6DAA6D;IAC7D,mBAAmB;IACnB,KAAK,CAAC,SAAS,CAAC,wBAAwB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAA;IAE3F,6DAA6D;IAC7D,mBAAmB;IACnB,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,GAAG,SAAS,WAAW;QACvD,OAAO;YACL,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;YAChB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;YAClB,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YAC3C,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE;YACxB,wBAAwB;SACzB,CAAA;IACH,CAAC,CAAA;IACD,OAAO,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,GAAG,mBAAmB,CAAC,CAAA;AACzE,CAAC"}
|
@@ -1,2 +1,4 @@
|
|
1
|
+
export declare const mockedPermanentUrl = "mocked-permanent-url";
|
2
|
+
export declare const mockedResolvedPath = "mock-resolved-path";
|
1
3
|
export declare function renderGradingInstruction(inputData: string, onContentChangeMock?: () => void): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|
2
4
|
//# sourceMappingURL=renderEditableGradingInstruction.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"renderEditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../__tests__/utils/renderEditableGradingInstruction.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"renderEditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../__tests__/utils/renderEditableGradingInstruction.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,kBAAkB,yBAAyB,CAAA;AACxD,eAAO,MAAM,kBAAkB,uBAAuB,CAAA;AAMtD,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,aAAW,gIAezF"}
|
@@ -3,14 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.mockedResolvedPath = exports.mockedPermanentUrl = void 0;
|
6
7
|
exports.renderGradingInstruction = renderGradingInstruction;
|
7
8
|
const react_1 = require("@testing-library/react");
|
8
9
|
const GradingInstructionProvider_1 = require("../../src/components/grading-instructions/GradingInstructionProvider");
|
9
10
|
const EditableGradingInstruction_1 = __importDefault(require("../../src/components/grading-instructions/EditableGradingInstruction"));
|
10
11
|
const react_2 = __importDefault(require("react"));
|
12
|
+
const CommonExamContext_1 = require("../../src/components/context/CommonExamContext");
|
13
|
+
exports.mockedPermanentUrl = 'mocked-permanent-url';
|
14
|
+
exports.mockedResolvedPath = 'mock-resolved-path';
|
15
|
+
const WrappedGradingInstructionProvider = (0, CommonExamContext_1.withCommonExamContext)(GradingInstructionProvider_1.GradingInstructionProvider);
|
11
16
|
function renderGradingInstruction(inputData, onContentChangeMock = () => { }) {
|
12
17
|
const doc = new DOMParser().parseFromString(inputData, 'text/html');
|
13
|
-
return (0, react_1.render)(react_2.default.createElement(
|
14
|
-
react_2.default.createElement(EditableGradingInstruction_1.default, { element: doc.documentElement })
|
18
|
+
return (0, react_1.render)(react_2.default.createElement(WrappedGradingInstructionProvider, { editable: true, onContentChange: onContentChangeMock, onSaveImage: () => Promise.resolve(exports.mockedPermanentUrl), answers: [], attachmentsURL: "", resolveAttachment: filename => `/${exports.mockedResolvedPath}/${filename}`, doc: doc },
|
19
|
+
react_2.default.createElement(EditableGradingInstruction_1.default, { element: doc.documentElement }),
|
20
|
+
"x"));
|
15
21
|
}
|
16
22
|
//# sourceMappingURL=renderEditableGradingInstruction.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"renderEditableGradingInstruction.js","sourceRoot":"","sources":["../../../__tests__/utils/renderEditableGradingInstruction.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"renderEditableGradingInstruction.js","sourceRoot":"","sources":["../../../__tests__/utils/renderEditableGradingInstruction.tsx"],"names":[],"mappings":";;;;;;AAeA,4DAeC;AA9BD,kDAA+C;AAC/C,qHAAiH;AACjH,sIAA6G;AAC7G,kDAAyB;AACzB,sFAAsF;AAIzE,QAAA,kBAAkB,GAAG,sBAAsB,CAAA;AAC3C,QAAA,kBAAkB,GAAG,oBAAoB,CAAA;AAEtD,MAAM,iCAAiC,GAAG,IAAA,yCAAqB,EAC7D,uDAA0B,CAC3B,CAAA;AAED,SAAgB,wBAAwB,CAAC,SAAiB,EAAE,mBAAmB,GAAG,GAAG,EAAE,GAAE,CAAC;IACxF,MAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;IACnE,OAAO,IAAA,cAAM,EACX,8BAAC,iCAAiC,IAChC,QAAQ,EAAE,IAAI,EACd,eAAe,EAAE,mBAAmB,EACpC,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,0BAAkB,CAAC,EACtD,OAAO,EAAE,EAAE,EACX,cAAc,EAAC,EAAE,EACjB,iBAAiB,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,0BAAkB,IAAI,QAAQ,EAAE,EACnE,GAAG,EAAE,GAAG;QAER,8BAAC,oCAA0B,IAAC,OAAO,EAAE,GAAG,CAAC,eAAe,GAAI;YAC1B,CACrC,CAAA;AACH,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../__tests__/utils/util.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,QAI5D"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.insertText = insertText;
|
4
|
+
const react_1 = require("@testing-library/react");
|
5
|
+
function insertText(element, text) {
|
6
|
+
react_1.fireEvent.input(element, {
|
7
|
+
target: { innerText: text, innerHTML: text }
|
8
|
+
});
|
9
|
+
}
|
10
|
+
//# sourceMappingURL=util.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../__tests__/utils/util.ts"],"names":[],"mappings":";;AAEA,gCAIC;AAND,kDAAkD;AAElD,SAAgB,UAAU,CAAC,OAAoB,EAAE,IAAY;IAC3D,iBAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QACvB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KAC7C,CAAC,CAAA;AACJ,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/AttachmentContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,KAAK,CAAC;IAAC,aAAa,EAAE,IAAI,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,IAAI,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpE,eAAO,MAAM,iBAAiB,kCAAkE,CAAA;AAEhG,eAAO,MAAM,qBAAqB,
|
1
|
+
{"version":3,"file":"AttachmentContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/AttachmentContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,KAAK,CAAC;IAAC,aAAa,EAAE,IAAI,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,IAAI,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpE,eAAO,MAAM,iBAAiB,kCAAkE,CAAA;AAEhG,eAAO,MAAM,qBAAqB,mEASjC,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ExamContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ExamContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,WAAW,WAAW;IAC1B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,aAAa,EAAE,aAAa,CAAA;CAC7B;AAED,eAAO,MAAM,WAAW,4BAAyC,CAAA;AAEjE,eAAO,MAAM,eAAe,
|
1
|
+
{"version":3,"file":"ExamContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ExamContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,WAAW,WAAW;IAC1B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,aAAa,EAAE,aAAa,CAAA;CAC7B;AAED,eAAO,MAAM,WAAW,4BAAyC,CAAA;AAEjE,eAAO,MAAM,eAAe,mEAO1B,CAAA"}
|
@@ -5,12 +5,12 @@ export interface GradingInstructionPropsBase {
|
|
5
5
|
export interface EditableProps extends GradingInstructionPropsBase {
|
6
6
|
editable: true;
|
7
7
|
onContentChange: (answerHTML: string, path: string) => void;
|
8
|
-
|
8
|
+
onSaveImage: (file: File, displayNumber?: string) => Promise<string>;
|
9
9
|
}
|
10
10
|
export interface NotEditableProps extends GradingInstructionPropsBase {
|
11
11
|
editable?: false;
|
12
12
|
onContentChange?: never;
|
13
|
-
|
13
|
+
onSaveImage?: never;
|
14
14
|
}
|
15
15
|
export type GradingInstructionProps = EditableProps | NotEditableProps;
|
16
16
|
export declare const GradingInstructionContext: React.Context<GradingInstructionProps>;
|
@@ -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,WAAW,aAAc,SAAQ,2BAA2B;IAChE,QAAQ,EAAE,IAAI,CAAA;IACd,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3D,
|
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":"QuestionContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/QuestionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,OAAO,EAAE,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,eAAO,MAAM,eAAe,gCAA8D,CAAA;AAE1F,eAAO,MAAM,mBAAmB,
|
1
|
+
{"version":3,"file":"QuestionContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/QuestionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,OAAO,CAAA;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,OAAO,EAAE,CAAA;IACzB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,eAAO,MAAM,eAAe,gCAA8D,CAAA;AAE1F,eAAO,MAAM,mBAAmB,mEAsB9B,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ResultsContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ResultsContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAgB,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAI9G,MAAM,WAAW,cAAc;IAC7B,mBAAmB,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IACnD,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,cAAc,+BAA4D,CAAA;AAEvF,eAAO,MAAM,kBAAkB,
|
1
|
+
{"version":3,"file":"ResultsContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ResultsContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAgB,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAI9G,MAAM,WAAW,cAAc;IAC7B,mBAAmB,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IACnD,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,cAAc,+BAA4D,CAAA;AAEvF,eAAO,MAAM,kBAAkB,mEAgB9B,CAAA;AAED,wBAAgB,mCAAmC,CACjD,gBAAgB,EAAE,gBAAgB,EAClC,EAAE,EAAE,MAAM,GACT,iBAAiB,GAAG,SAAS,CAY/B;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAEhF;AAED,wBAAgB,+BAA+B,CAC7C,iBAAiB,EAAE,OAAO,EAAE,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,KAAK,EAAE,EACf,mBAAmB,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,GAClD,MAAM,CAMR;AAED,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,OAAO,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,KAAK,EAAE,EACf,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,GAC1C,MAAM,CAgCR"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SectionContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/SectionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,OAAO,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,OAAO,EAAE,CAAA;CAC1B;AAED,eAAO,MAAM,cAAc,+BAA4D,CAAA;AAEvF,eAAO,MAAM,kBAAkB,
|
1
|
+
{"version":3,"file":"SectionContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/SectionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,OAAO,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,OAAO,EAAE,CAAA;CAC1B;AAED,eAAO,MAAM,cAAc,+BAA4D,CAAA;AAEvF,eAAO,MAAM,kBAAkB,mEAkB7B,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"EditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAoCnD,iBAAS,0BAA0B,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,qBAyDpE;AAED,eAAe,0BAA0B,CAAA"}
|
@@ -12,72 +12,54 @@ import { FormulaPopup } from './editor/FormulaPopup';
|
|
12
12
|
import FormatButton from './editor/FormatButton';
|
13
13
|
import { NbspButton, nbspPlugin } from './editor/NBSP';
|
14
14
|
import { spanWithNowrap } from './editor/spanWithNowrap';
|
15
|
-
import {
|
16
|
-
import {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
const outputSchema = new Schema({
|
22
|
-
nodes: baseSchema.spec.nodes.append(formulaOutputSchema).append(tableSchema),
|
23
|
-
marks: baseSchema.spec.marks.append(spanWithNowrap).append(localization(false))
|
24
|
-
});
|
25
|
-
function Menu({ setFormulaState, currentElement }) {
|
26
|
-
return (React.createElement("div", { className: "ProseMirror-menu" },
|
15
|
+
import { ImageUploadButton } from './editor/ImageUploadButton';
|
16
|
+
import { imageInputSchema, imageOutputSchema } from './editor/schemas/image-schema';
|
17
|
+
import { CommonExamContext } from '../context/CommonExamContext';
|
18
|
+
function Menu(props) {
|
19
|
+
const { onSaveImage } = useContext(GradingInstructionContext);
|
20
|
+
return (React.createElement(React.Fragment, null,
|
27
21
|
React.createElement(FormatButton, { markName: "strong", displayName: "Bold" }),
|
28
22
|
React.createElement(FormatButton, { markName: "em", displayName: "Italic" }),
|
23
|
+
onSaveImage && React.createElement(ImageUploadButton, { saveImage: onSaveImage }),
|
29
24
|
React.createElement(TableMenu, null),
|
30
|
-
React.createElement(FormulaButton, { setFormulaState: setFormulaState }),
|
31
|
-
React.createElement(NbspButton, null)
|
32
|
-
React.createElement(CurrentLocalization, { currentElement: currentElement })));
|
25
|
+
React.createElement(FormulaButton, { disabled: !!props.formulaState, setFormulaState: props.setFormulaState }),
|
26
|
+
React.createElement(NbspButton, null)));
|
33
27
|
}
|
34
28
|
function EditableGradingInstruction({ element }) {
|
35
29
|
const { onContentChange } = useContext(GradingInstructionContext);
|
36
|
-
const
|
30
|
+
const { resolveAttachment } = useContext(CommonExamContext);
|
31
|
+
const inputSchema = new Schema({
|
32
|
+
nodes: baseSchema.spec.nodes
|
33
|
+
.append(formulaSchema)
|
34
|
+
.append(tableSchema)
|
35
|
+
.update('image', imageInputSchema(resolveAttachment)),
|
36
|
+
marks: baseSchema.spec.marks.append(spanWithNowrap)
|
37
|
+
});
|
38
|
+
const outputSchema = new Schema({
|
39
|
+
nodes: baseSchema.spec.nodes.append(formulaOutputSchema).append(tableSchema).update('image', imageOutputSchema),
|
40
|
+
marks: baseSchema.spec.marks.append(spanWithNowrap)
|
41
|
+
});
|
42
|
+
const doc = ProseDOMParser.fromSchema(inputSchema).parse(element);
|
37
43
|
const [mount, setMount] = useState(null);
|
38
44
|
const [formulaState, setFormulaState] = useState(null);
|
39
45
|
const formulaPlugin = new FormulaPlugin(setFormulaState);
|
40
|
-
const [state, setState] = useState(EditorState.create({ schema, doc, plugins: [keymap(baseKeymap), formulaPlugin, nbspPlugin] }));
|
41
|
-
const [currentElement, setCurrentElement] = useState(null);
|
42
|
-
function findElementFromPosition(rootNode, pos) {
|
43
|
-
var _a;
|
44
|
-
if (rootNode == null) {
|
45
|
-
return null;
|
46
|
-
}
|
47
|
-
const node = rootNode.nodeAt(pos);
|
48
|
-
if (!node) {
|
49
|
-
return null;
|
50
|
-
}
|
51
|
-
const serializedNode = DOMSerializer.fromSchema(outputSchema).serializeNode(node);
|
52
|
-
const element = serializedNode;
|
53
|
-
if (((_a = element.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) == 'e:localization') {
|
54
|
-
return element;
|
55
|
-
}
|
56
|
-
const parent = serializedNode.parentNode;
|
57
|
-
return findElementFromPosition(parent, pos);
|
58
|
-
}
|
46
|
+
const [state, setState] = useState(EditorState.create({ schema: inputSchema, doc, plugins: [keymap(baseKeymap), formulaPlugin, nbspPlugin] }));
|
59
47
|
return (React.createElement(ProseMirror, { mount: mount, state: state, dispatchTransaction: tr => {
|
60
|
-
|
61
|
-
setState(s =>
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
.replace(/<hr>/g, '<hr/>');
|
74
|
-
onContentChange(nbspFixed, path);
|
75
|
-
}
|
76
|
-
}
|
77
|
-
return newContent;
|
78
|
-
});
|
48
|
+
var _a;
|
49
|
+
setState(s => s.apply(tr));
|
50
|
+
const fragment = DOMSerializer.fromSchema(outputSchema).serializeFragment(tr.doc.content);
|
51
|
+
const div = document.createElement('div');
|
52
|
+
div.appendChild(fragment);
|
53
|
+
const path = (_a = element.getAttribute('path')) !== null && _a !== void 0 ? _a : '';
|
54
|
+
if (onContentChange) {
|
55
|
+
const nbspFixed = div.innerHTML
|
56
|
+
.replace(/ /g, ' ')
|
57
|
+
.replace(/<br>/g, '<br/>')
|
58
|
+
.replace(/<hr>/g, '<hr/>');
|
59
|
+
onContentChange(nbspFixed, path);
|
60
|
+
}
|
79
61
|
} },
|
80
|
-
React.createElement(Menu, {
|
62
|
+
React.createElement(Menu, { formulaState: formulaState, setFormulaState: setFormulaState }),
|
81
63
|
React.createElement("div", { ref: setMount }),
|
82
64
|
formulaState && (React.createElement(FormulaPopup, { state: formulaState, onFinish: () => {
|
83
65
|
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,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,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,
|
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,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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{"version":3,"file":"ExamGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/ExamGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"ExamGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/ExamGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAIjE,QAAA,MAAM,sBAAsB,EAAE,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CAQvE,CAAA;AACD,eAAe,sBAAsB,CAAA"}
|
@@ -1,4 +1,9 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
|
1
|
+
import React, { useContext } from 'react';
|
2
|
+
import { GradingInstructionContext } from '../context/GradingInstructionContext';
|
3
|
+
import EditableGradingInstruction from './EditableGradingInstruction';
|
4
|
+
const ExamGradingInstruction = ({ element, renderChildNodes }) => {
|
5
|
+
const { editable } = useContext(GradingInstructionContext);
|
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)));
|
7
|
+
};
|
3
8
|
export default ExamGradingInstruction;
|
4
9
|
//# sourceMappingURL=ExamGradingInstruction.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ExamGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/ExamGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
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"}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { GradingInstructionProps } from '../context/GradingInstructionContext';
|
3
|
-
export declare const GradingInstructionProvider: ({ editable, onContentChange,
|
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,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { GradingInstructionContext } from '../context/GradingInstructionContext';
|
3
|
-
export const GradingInstructionProvider = ({ editable, onContentChange,
|
4
|
-
const contextValue = editable ? { editable, onContentChange,
|
3
|
+
export const GradingInstructionProvider = ({ editable, onContentChange, onSaveImage, children }) => {
|
4
|
+
const contextValue = editable ? { editable, onContentChange, onSaveImage } : { editable };
|
5
5
|
return React.createElement(GradingInstructionContext.Provider, { value: contextValue }, children);
|
6
6
|
};
|
7
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,EACzC,QAAQ,EACR,eAAe,EACf,
|
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"}
|
@@ -2,6 +2,6 @@ import React from 'react';
|
|
2
2
|
import { AnnotationProps, CommonExamProps } from '../exam/Exam';
|
3
3
|
import { GradingInstructionProps } from '../context/GradingInstructionContext';
|
4
4
|
export declare const GradingInstructionsPageTitle: React.FunctionComponent;
|
5
|
-
declare const _default: React.MemoExoticComponent<React.ComponentType<CommonExamProps &
|
5
|
+
declare const _default: React.MemoExoticComponent<React.ComponentType<CommonExamProps & AnnotationProps & GradingInstructionProps>>;
|
6
6
|
export default _default;
|
7
7
|
//# sourceMappingURL=GradingInstructions.d.ts.map
|
@@ -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, editable, onContentChange,
|
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,7 +85,7 @@ 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,
|
88
|
+
const props = editable ? { editable, onContentChange, onSaveImage } : { editable };
|
89
89
|
return (React.createElement(AnnotationProvider, { annotations: annotations, onClickAnnotation: onClickAnnotation, onSaveAnnotation: onSaveAnnotation },
|
90
90
|
React.createElement(GradingInstructionProvider, { ...props },
|
91
91
|
React.createElement(I18nextProvider, { i18n: i18n },
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"GradingInstructions.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstructions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAA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AK,EAAE,kBAAkB;IACzB,KAAK,EAAE,uCAAuC,CAAC,KAAK,CAAC;IACrD,QAAQ,EAAE,QAAQ;IAClB,gBAAgB,EAAE,aAAa;IAC/B,sBAAsB,EAAE,mBAAmB;IAC3C,8BAA8B,EAAE,wBAAwB;IACxD,iBAAiB,EAAE,cAAc;IACjC,WAAW,EAAE,eAAe;IAC5B,oBAAoB,EAAE,gBAAgB;IACtC,aAAa,EAAE,gBAAgB;IAC/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,QAAQ,EACR,eAAe,EACf,
|
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,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C,SAAS,CAAC,CAC5D;wBACf,IAAI,IAAI,CACP;4BACE,oCAAS,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAU,CAC/C,CACL;wBACA,sBAAsB,IAAI,CACzB,oBAAC,sBAAsB,IAAO,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,GAAM,CACtF;wBACA,eAAe,IAAI,CAClB,6BAAK,SAAS,EAAC,oBAAoB;4BACjC,oBAAC,eAAe,IAAO,OAAO,EAAE,eAAe,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"}
|
@@ -9,6 +9,7 @@ export type FormulaEditorState = {
|
|
9
9
|
export declare const formulaSchema: NodeSpec;
|
10
10
|
export declare const formulaOutputSchema: NodeSpec;
|
11
11
|
export declare function FormulaButton(props: {
|
12
|
+
disabled: boolean;
|
12
13
|
setFormulaState: (values: FormulaEditorState) => void;
|
13
14
|
}): React.JSX.Element;
|
14
15
|
export declare class FormulaPlugin extends Plugin {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Formula.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/Formula.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA0B,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAiC,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,MAAM,kBAAkB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA;AAEjF,eAAO,MAAM,aAAa,EAAE,
|
1
|
+
{"version":3,"file":"Formula.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/Formula.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA0B,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAiC,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,MAAM,kBAAkB,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA;AAEjF,eAAO,MAAM,aAAa,EAAE,QA+B3B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,QAoBjC,CAAA;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,eAAe,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAA;CAAE,qBAoBhH;AAED,qBAAa,aAAc,SAAQ,MAAM;gBAC3B,kBAAkB,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI;CAmBrE"}
|
@@ -9,7 +9,8 @@ export const formulaSchema = {
|
|
9
9
|
atom: true,
|
10
10
|
attrs: {
|
11
11
|
latex: {},
|
12
|
-
mode: { default: '' }
|
12
|
+
mode: { default: '' },
|
13
|
+
assistiveTitle: { default: '' }
|
13
14
|
},
|
14
15
|
parseDOM: [
|
15
16
|
{
|
@@ -17,7 +18,8 @@ export const formulaSchema = {
|
|
17
18
|
getAttrs(dom) {
|
18
19
|
return {
|
19
20
|
latex: dom.textContent,
|
20
|
-
mode: dom.getAttribute('mode')
|
21
|
+
mode: dom.getAttribute('mode'),
|
22
|
+
assistiveTitle: dom.getAttribute('assistive-title')
|
21
23
|
};
|
22
24
|
}
|
23
25
|
}
|
@@ -36,8 +38,19 @@ export const formulaOutputSchema = {
|
|
36
38
|
formula: {
|
37
39
|
...formulaSchema.formula,
|
38
40
|
toDOM(node) {
|
41
|
+
if (!node.attrs.latex) {
|
42
|
+
return '';
|
43
|
+
}
|
44
|
+
const formulaElement = document.createElement('e:formula');
|
45
|
+
if (node.attrs.mode) {
|
46
|
+
formulaElement.setAttribute('mode', node.attrs.mode);
|
47
|
+
}
|
48
|
+
if (node.attrs.assistiveTitle) {
|
49
|
+
formulaElement.setAttribute('assistive-title', node.attrs.assistiveTitle);
|
50
|
+
}
|
51
|
+
formulaElement.textContent = node.attrs.latex;
|
39
52
|
const container = document.createElement('span');
|
40
|
-
container.
|
53
|
+
container.appendChild(formulaElement);
|
41
54
|
return container.firstElementChild;
|
42
55
|
}
|
43
56
|
}
|
@@ -55,7 +68,7 @@ export function FormulaButton(props) {
|
|
55
68
|
}
|
56
69
|
}
|
57
70
|
});
|
58
|
-
return (React.createElement("button", { onClick: onClick, "data-testid": "add-formula" }, "Lis\u00E4\u00E4 kaava"));
|
71
|
+
return (React.createElement("button", { onClick: onClick, "data-testid": "add-formula", disabled: props.disabled }, "Lis\u00E4\u00E4 kaava"));
|
59
72
|
}
|
60
73
|
export class FormulaPlugin extends Plugin {
|
61
74
|
constructor(updateFormulaState) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Formula.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/Formula.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAe,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAiB,QAAQ,EAAkB,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,CAAC,MAAM,aAAa,GAAa;IACrC,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,IAAI;QACV,KAAK,EAAE;YACL,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;
|
1
|
+
{"version":3,"file":"Formula.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/Formula.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAe,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAiB,QAAQ,EAAkB,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,CAAC,MAAM,aAAa,GAAa;IACrC,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,IAAI;QACV,KAAK,EAAE;YACL,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;YACrB,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;SAChC;QACD,QAAQ,EAAE;YACR;gBACE,GAAG,EAAE,4BAA4B;gBACjC,QAAQ,CAAC,GAAgB;oBACvB,OAAO;wBACL,KAAK,EAAE,GAAG,CAAC,WAAW;wBACtB,IAAI,EAAE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC;wBAC9B,cAAc,EAAE,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC;qBACpD,CAAA;gBACH,CAAC;aACF;SACF;QACD,KAAK,CAAC,IAAU;YACd,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;YAC/C,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gBACrB,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAe,CAAC,CAAA;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,OAAO,YAAY,OAAO,EAAE,CAAC;4BAC/B,kBAAkB,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAe,EAAE,CAAC,CAAA;4BAChF,OAAO,IAAI,CAAA;wBACb,CAAC;oBACH,CAAC;oBACD,OAAO,KAAK,CAAA;gBACd,CAAC;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { EditableProps } from '../../context/GradingInstructionContext';
|
3
|
+
export declare function ImageUploadButton({ saveImage }: {
|
4
|
+
saveImage: EditableProps['onSaveImage'];
|
5
|
+
}): React.JSX.Element;
|
6
|
+
//# sourceMappingURL=ImageUploadButton.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ImageUploadButton.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/ImageUploadButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0C,MAAM,OAAO,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAUvE,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,CAAA;CAAE,qBA6E3F"}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import { useEditorEventCallback } from '@nytimes/react-prosemirror';
|
2
|
+
import React, { useRef, useContext } from 'react';
|
3
|
+
import { QuestionContext } from '../../context/QuestionContext';
|
4
|
+
import { CommonExamContext } from '../../context/CommonExamContext';
|
5
|
+
var EditorAction;
|
6
|
+
(function (EditorAction) {
|
7
|
+
EditorAction["REMOVE_IMAGE"] = "REMOVE_IMAGE";
|
8
|
+
EditorAction["UPDATE_IMAGE"] = "UPDATE_IMAGE";
|
9
|
+
EditorAction["INSERT_IMAGE"] = "INSERT_IMAGE";
|
10
|
+
})(EditorAction || (EditorAction = {}));
|
11
|
+
export function ImageUploadButton({ saveImage }) {
|
12
|
+
const inputRef = useRef(null);
|
13
|
+
const { displayNumber } = useContext(QuestionContext);
|
14
|
+
const { resolveAttachment } = useContext(CommonExamContext);
|
15
|
+
const handleButtonClick = () => {
|
16
|
+
if (inputRef.current) {
|
17
|
+
inputRef.current.click();
|
18
|
+
}
|
19
|
+
};
|
20
|
+
const updateEditor = useEditorEventCallback((view, action, tempPath, permanentPath) => {
|
21
|
+
const { state } = view;
|
22
|
+
const { doc, schema: { nodes } } = state;
|
23
|
+
let tr = state.tr;
|
24
|
+
switch (action) {
|
25
|
+
case EditorAction.INSERT_IMAGE:
|
26
|
+
tr = tr.replaceSelectionWith(nodes.image.create({ src: tempPath }));
|
27
|
+
break;
|
28
|
+
case EditorAction.UPDATE_IMAGE:
|
29
|
+
doc.descendants((node, pos) => {
|
30
|
+
if (node.type.name === 'image' && node.attrs.src === tempPath) {
|
31
|
+
tr = tr.setNodeAttribute(pos, 'src', permanentPath);
|
32
|
+
}
|
33
|
+
});
|
34
|
+
break;
|
35
|
+
case EditorAction.REMOVE_IMAGE:
|
36
|
+
doc.descendants((node, pos) => {
|
37
|
+
if (node.type.name === 'image' && node.attrs.src === tempPath) {
|
38
|
+
tr = tr.delete(pos, pos + node.nodeSize);
|
39
|
+
}
|
40
|
+
});
|
41
|
+
break;
|
42
|
+
default:
|
43
|
+
console.error('Unsupported action:', action);
|
44
|
+
}
|
45
|
+
if (tr.steps.length > 0) {
|
46
|
+
view.dispatch(tr);
|
47
|
+
}
|
48
|
+
view.focus();
|
49
|
+
});
|
50
|
+
const handleFileChange = async (event) => {
|
51
|
+
var _a;
|
52
|
+
const file = (_a = event.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
53
|
+
if (file) {
|
54
|
+
const tempPath = URL.createObjectURL(file);
|
55
|
+
updateEditor(EditorAction.INSERT_IMAGE, tempPath);
|
56
|
+
event.target.value = '';
|
57
|
+
try {
|
58
|
+
const permanentPath = await saveImage(file, displayNumber);
|
59
|
+
if (!permanentPath)
|
60
|
+
throw new Error('no permanent image path provided');
|
61
|
+
updateEditor(EditorAction.UPDATE_IMAGE, tempPath, resolveAttachment(permanentPath));
|
62
|
+
}
|
63
|
+
catch (e) {
|
64
|
+
console.error('error getting permanent path for image', e);
|
65
|
+
updateEditor(EditorAction.REMOVE_IMAGE, tempPath);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
};
|
69
|
+
return (React.createElement(React.Fragment, null,
|
70
|
+
React.createElement("button", { onClick: handleButtonClick }, "Lis\u00E4\u00E4 kuva"),
|
71
|
+
React.createElement("input", { type: "file", accept: "image/png, image/jpeg, image/tiff", style: { display: 'none' }, ref: inputRef, onChange: e => void handleFileChange(e), "data-testid": "image-upload-button" })));
|
72
|
+
}
|
73
|
+
//# sourceMappingURL=ImageUploadButton.js.map
|