@digabi/exam-engine-core 22.1.3-alpha.2 → 22.1.3
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/context/GradingInstructionContext.d.ts +6 -11
- package/dist/components/context/GradingInstructionContext.d.ts.map +1 -1
- package/dist/components/context/GradingInstructionContext.js.map +1 -1
- package/dist/components/exam/DNDAnswer.d.ts +4 -0
- package/dist/components/exam/DNDAnswer.d.ts.map +1 -0
- package/dist/components/exam/DNDAnswer.js +36 -0
- package/dist/components/exam/DNDAnswer.js.map +1 -0
- package/dist/components/exam/DragAndDrop.d.ts +3 -0
- package/dist/components/exam/DragAndDrop.d.ts.map +1 -0
- package/dist/components/exam/DragAndDrop.js +7 -0
- package/dist/components/exam/DragAndDrop.js.map +1 -0
- package/dist/components/exam/NativeDND.d.ts +3 -0
- package/dist/components/exam/NativeDND.d.ts.map +1 -0
- package/dist/components/exam/NativeDND.js +75 -0
- package/dist/components/exam/NativeDND.js.map +1 -0
- package/dist/components/grading/AnnotatableGradingAnswer.d.ts +4 -0
- package/dist/components/grading/AnnotatableGradingAnswer.d.ts.map +1 -0
- package/dist/components/grading/AnnotatableGradingAnswer.js +24 -0
- package/dist/components/grading/AnnotatableGradingAnswer.js.map +1 -0
- package/dist/components/grading/GradingAnswer.d.ts.map +1 -1
- package/dist/components/grading/GradingAnswer.js +38 -16
- package/dist/components/grading/GradingAnswer.js.map +1 -1
- package/dist/components/grading-instructions/AnswerGradingInstruction.d.ts.map +1 -1
- package/dist/components/grading-instructions/AnswerGradingInstruction.js +4 -3
- package/dist/components/grading-instructions/AnswerGradingInstruction.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 +1 -4
- package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -1
- package/dist/components/grading-instructions/GradingInstructions.d.ts +6 -2
- package/dist/components/grading-instructions/GradingInstructions.d.ts.map +1 -1
- package/dist/components/grading-instructions/GradingInstructions.js +2 -3
- package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
- package/dist/components/shared/AnnotationWrapper.d.ts +5 -0
- package/dist/components/shared/AnnotationWrapper.d.ts.map +1 -0
- package/dist/components/shared/AnnotationWrapper.js +24 -0
- package/dist/components/shared/AnnotationWrapper.js.map +1 -0
- package/dist/components/shared/Mark.d.ts +9 -0
- package/dist/components/shared/Mark.d.ts.map +1 -0
- package/dist/components/shared/Mark.js +14 -0
- package/dist/components/shared/Mark.js.map +1 -0
- package/dist/components/shared/Popup.js +2 -2
- package/dist/components/shared/Popup.js.map +1 -1
- package/dist/dom-utils.d.ts.map +1 -1
- package/dist/dom-utils.js +4 -2
- package/dist/dom-utils.js.map +1 -1
- package/dist/i18n/fi-FI.d.ts +1 -0
- package/dist/i18n/fi-FI.d.ts.map +1 -1
- package/dist/i18n/fi-FI.js +2 -1
- package/dist/i18n/fi-FI.js.map +1 -1
- package/dist/i18n/sv-FI.d.ts.map +1 -1
- package/dist/i18n/sv-FI.js +2 -1
- package/dist/i18n/sv-FI.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/dist/main.css +1 -1
- package/package.json +4 -12
- 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 -171
- 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/__tests__/editor/Formula.test.d.ts +0 -2
- package/dist/__tests__/editor/Formula.test.d.ts.map +0 -1
- package/dist/__tests__/editor/Formula.test.js +0 -43
- package/dist/__tests__/editor/Formula.test.js.map +0 -1
- package/dist/__tests__/editor/br.test.d.ts +0 -2
- package/dist/__tests__/editor/br.test.d.ts.map +0 -1
- package/dist/__tests__/editor/br.test.js +0 -43
- package/dist/__tests__/editor/br.test.js.map +0 -1
- package/dist/__tests__/editor/hr.test.d.ts +0 -2
- package/dist/__tests__/editor/hr.test.d.ts.map +0 -1
- package/dist/__tests__/editor/hr.test.js +0 -43
- package/dist/__tests__/editor/hr.test.js.map +0 -1
- package/dist/__tests__/editor/nbsp.test.d.ts +0 -2
- package/dist/__tests__/editor/nbsp.test.d.ts.map +0 -1
- package/dist/__tests__/editor/nbsp.test.js +0 -59
- package/dist/__tests__/editor/nbsp.test.js.map +0 -1
- package/dist/__tests__/editor/noWrap.test.d.ts +0 -2
- package/dist/__tests__/editor/noWrap.test.d.ts.map +0 -1
- package/dist/__tests__/editor/noWrap.test.js +0 -62
- package/dist/__tests__/editor/noWrap.test.js.map +0 -1
- package/dist/__tests__/utils/ProseMirrorWrapper.d.ts +0 -8
- package/dist/__tests__/utils/ProseMirrorWrapper.d.ts.map +0 -1
- package/dist/__tests__/utils/ProseMirrorWrapper.js +0 -44
- package/dist/__tests__/utils/ProseMirrorWrapper.js.map +0 -1
- package/dist/__tests__/utils/prosemirror.d.ts +0 -3
- package/dist/__tests__/utils/prosemirror.d.ts.map +0 -1
- package/dist/__tests__/utils/prosemirror.js +0 -38
- package/dist/__tests__/utils/prosemirror.js.map +0 -1
- package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts +0 -2
- package/dist/__tests__/utils/renderEditableGradingInstruction.d.ts.map +0 -1
- package/dist/__tests__/utils/renderEditableGradingInstruction.js +0 -16
- package/dist/__tests__/utils/renderEditableGradingInstruction.js.map +0 -1
- 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/EditableGradingInstruction.d.ts +0 -6
- package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +0 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.js +0 -87
- package/dist/components/grading-instructions/EditableGradingInstruction.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/FormatButton.d.ts +0 -8
- package/dist/components/grading-instructions/editor/FormatButton.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/FormatButton.js +0 -23
- package/dist/components/grading-instructions/editor/FormatButton.js.map +0 -1
- package/dist/components/grading-instructions/editor/Formula.d.ts +0 -17
- package/dist/components/grading-instructions/editor/Formula.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/Formula.js +0 -81
- package/dist/components/grading-instructions/editor/Formula.js.map +0 -1
- package/dist/components/grading-instructions/editor/FormulaPopup.d.ts +0 -7
- package/dist/components/grading-instructions/editor/FormulaPopup.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/FormulaPopup.js +0 -49
- package/dist/components/grading-instructions/editor/FormulaPopup.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/NBSP.d.ts +0 -4
- package/dist/components/grading-instructions/editor/NBSP.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/NBSP.js +0 -17
- package/dist/components/grading-instructions/editor/NBSP.js.map +0 -1
- package/dist/components/grading-instructions/editor/Table.d.ts +0 -5
- package/dist/components/grading-instructions/editor/Table.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/Table.js +0 -181
- package/dist/components/grading-instructions/editor/Table.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/spanWithNowrap.d.ts +0 -3
- package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts.map +0 -1
- package/dist/components/grading-instructions/editor/spanWithNowrap.js +0 -19
- package/dist/components/grading-instructions/editor/spanWithNowrap.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 +0,0 @@
|
|
1
|
-
{"version":3,"file":"noWrap.test.js","sourceRoot":"","sources":["../../../__tests__/editor/noWrap.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,Q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CAAC,OAAO,EAAE;QACvB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KAC7C,CAAC,CAAA;AACJ,CAAC"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import React, { ReactNode } from 'react';
|
2
|
-
interface WrapperProps {
|
3
|
-
children?: ReactNode;
|
4
|
-
innerHtml?: string;
|
5
|
-
}
|
6
|
-
declare const ProseMirrorWrapper: React.FC<WrapperProps>;
|
7
|
-
export default ProseMirrorWrapper;
|
8
|
-
//# sourceMappingURL=ProseMirrorWrapper.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ProseMirrorWrapper.d.ts","sourceRoot":"","sources":["../../../__tests__/utils/ProseMirrorWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAMlD,UAAU,YAAY;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAmB9C,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
const react_1 = __importStar(require("react"));
|
27
|
-
const react_prosemirror_1 = require("@nytimes/react-prosemirror");
|
28
|
-
const prosemirror_schema_basic_1 = require("prosemirror-schema-basic");
|
29
|
-
const prosemirror_model_1 = require("prosemirror-model");
|
30
|
-
const prosemirror_state_1 = require("prosemirror-state");
|
31
|
-
const ProseMirrorWrapper = ({ children, innerHtml = '' }) => {
|
32
|
-
const [mount, setMount] = (0, react_1.useState)(null);
|
33
|
-
const container = document.createElement('div');
|
34
|
-
container.innerHTML = innerHtml;
|
35
|
-
const doc = prosemirror_model_1.DOMParser.fromSchema(prosemirror_schema_basic_1.schema).parse(container);
|
36
|
-
const [state, setState] = (0, react_1.useState)(prosemirror_state_1.EditorState.create({ schema: prosemirror_schema_basic_1.schema, doc }));
|
37
|
-
return (react_1.default.createElement(react_prosemirror_1.ProseMirror, { state: state, mount: mount, dispatchTransaction: tr => {
|
38
|
-
setState(s => s.apply(tr));
|
39
|
-
} },
|
40
|
-
react_1.default.createElement("div", { ref: setMount }),
|
41
|
-
children));
|
42
|
-
};
|
43
|
-
exports.default = ProseMirrorWrapper;
|
44
|
-
//# sourceMappingURL=ProseMirrorWrapper.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ProseMirrorWrapper.js","sourceRoot":"","sources":["../../../__tests__/utils/ProseMirrorWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;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|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.mockCreateRange = mockCreateRange;
|
4
|
-
exports.promisifiedFireEventInput = promisifiedFireEventInput;
|
5
|
-
const react_1 = require("@testing-library/react");
|
6
|
-
function mockCreateRange() {
|
7
|
-
const originalCreateRange = global.window.document.createRange;
|
8
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
9
|
-
// @ts-expect-error
|
10
|
-
global.Range = function Range() { };
|
11
|
-
const createContextualFragment = (html) => {
|
12
|
-
const div = document.createElement('div');
|
13
|
-
div.innerHTML = html;
|
14
|
-
return div.children[0];
|
15
|
-
};
|
16
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
17
|
-
// @ts-expect-error
|
18
|
-
Range.prototype.createContextualFragment = (html) => createContextualFragment(html);
|
19
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
20
|
-
// @ts-expect-error
|
21
|
-
global.window.document.createRange = function createRange() {
|
22
|
-
return {
|
23
|
-
setEnd: () => { },
|
24
|
-
setStart: () => { },
|
25
|
-
getBoundingClientRect: () => ({ right: 0 }),
|
26
|
-
getClientRects: () => [],
|
27
|
-
createContextualFragment
|
28
|
-
};
|
29
|
-
};
|
30
|
-
return () => (global.window.document.createRange = originalCreateRange);
|
31
|
-
}
|
32
|
-
function promisifiedFireEventInput(element, options) {
|
33
|
-
return new Promise(resolve => {
|
34
|
-
react_1.fireEvent.input(element, options);
|
35
|
-
resolve();
|
36
|
-
});
|
37
|
-
}
|
38
|
-
//# sourceMappingURL=prosemirror.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"prosemirror.js","sourceRoot":"","sources":["../../../__tests__/utils/prosemirror.ts"],"names":[],"mappings":";;AAEA,0CA2BC;AAED,8DAKC;AApCD,kDAAkD;AAElD,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;AAED,SAAgB,yBAAyB,CAAC,OAAgB,EAAE,OAAe;IACzE,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;QACjC,iBAAS,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACjC,OAAO,EAAE,CAAA;IACX,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export declare function renderGradingInstruction(inputData: string, onContentChangeMock?: () => void): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|
2
|
-
//# sourceMappingURL=renderEditableGradingInstruction.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"renderEditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../__tests__/utils/renderEditableGradingInstruction.tsx"],"names":[],"mappings":"AAKA,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,aAAW,gIAWzF"}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.renderGradingInstruction = renderGradingInstruction;
|
7
|
-
const react_1 = require("@testing-library/react");
|
8
|
-
const GradingInstructionProvider_1 = require("../../src/components/grading-instructions/GradingInstructionProvider");
|
9
|
-
const EditableGradingInstruction_1 = __importDefault(require("../../src/components/grading-instructions/EditableGradingInstruction"));
|
10
|
-
const react_2 = __importDefault(require("react"));
|
11
|
-
function renderGradingInstruction(inputData, onContentChangeMock = () => { }) {
|
12
|
-
const doc = new DOMParser().parseFromString(inputData, 'text/html');
|
13
|
-
return (0, react_1.render)(react_2.default.createElement(GradingInstructionProvider_1.GradingInstructionProvider, { editable: true, onContentChange: onContentChangeMock, saveScreenshot: () => Promise.resolve('') },
|
14
|
-
react_2.default.createElement(EditableGradingInstruction_1.default, { element: doc.documentElement })));
|
15
|
-
}
|
16
|
-
//# sourceMappingURL=renderEditableGradingInstruction.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"renderEditableGradingInstruction.js","sourceRoot":"","sources":["../../../__tests__/utils/renderEditableGradingInstruction.tsx"],"names":[],"mappings":";;;;;AAKA,4DAWC;AAhBD,kDAA+C;AAC/C,qHAAiH;AACjH,sIAA6G;AAC7G,kDAAyB;AAEzB,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,uDAA0B,IACzB,QAAQ,EAAE,IAAI,EACd,eAAe,EAAE,mBAAmB,EACpC,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAEzC,8BAAC,oCAA0B,IAAC,OAAO,EAAE,GAAG,CAAC,eAAe,GAAI,CACjC,CAC9B,CAAA;AACH,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Localization.d.ts","sourceRoot":"","sources":["../../src/components/Localization.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAI9D,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CAW7D,CAAA;AACD,eAAe,YAAY,CAAA"}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import React, { useContext } from 'react';
|
2
|
-
import { GradingInstructionContext } from './context/GradingInstructionContext';
|
3
|
-
import EditableGradingInstruction from './grading-instructions/EditableGradingInstruction';
|
4
|
-
const Localization = ({ element, renderChildNodes }) => {
|
5
|
-
const { editable } = useContext(GradingInstructionContext);
|
6
|
-
return (React.createElement("div", { className: "e-exam-grading-instruction-localization notification e-pad-4", "data-annotation-anchor": "exam-grading-instruction-localization" }, editable ? React.createElement(EditableGradingInstruction, { element: element }) : renderChildNodes(element)));
|
7
|
-
};
|
8
|
-
export default Localization;
|
9
|
-
//# sourceMappingURL=Localization.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Localization.js","sourceRoot":"","sources":["../../src/components/Localization.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAA;AAC/E,OAAO,0BAA0B,MAAM,mDAAmD,CAAA;AAE1F,MAAM,YAAY,GAAgD,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,EAAE;IAClG,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAA;IAE1D,OAAO,CACL,6BACE,SAAS,EAAC,8DAA8D,4BACjD,uCAAuC,IAE7D,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,YAAY,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"EditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAA;AA8CnD,iBAAS,0BAA0B,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,qBAkEpE;AAED,eAAe,0BAA0B,CAAA"}
|
@@ -1,87 +0,0 @@
|
|
1
|
-
import React, { useContext, useState } from 'react';
|
2
|
-
import { schema as baseSchema } from 'prosemirror-schema-basic';
|
3
|
-
import { EditorState } from 'prosemirror-state';
|
4
|
-
import { baseKeymap } from 'prosemirror-commands';
|
5
|
-
import { GradingInstructionContext } from '../context/GradingInstructionContext';
|
6
|
-
import { ProseMirror } from '@nytimes/react-prosemirror';
|
7
|
-
import { DOMParser as ProseDOMParser, DOMSerializer, Schema } from 'prosemirror-model';
|
8
|
-
import { keymap } from 'prosemirror-keymap';
|
9
|
-
import { FormulaButton, formulaOutputSchema, FormulaPlugin, formulaSchema } from './editor/Formula';
|
10
|
-
import { TableMenu, tableSchema } from './editor/Table';
|
11
|
-
import { FormulaPopup } from './editor/FormulaPopup';
|
12
|
-
import FormatButton from './editor/FormatButton';
|
13
|
-
import { NbspButton, nbspPlugin } from './editor/NBSP';
|
14
|
-
import { spanWithNowrap } from './editor/spanWithNowrap';
|
15
|
-
import { localization } from './editor/localization';
|
16
|
-
import { CurrentLocalization } from './editor/CurrentLocalization';
|
17
|
-
const schema = new Schema({
|
18
|
-
nodes: baseSchema.spec.nodes.append(formulaSchema).append(tableSchema),
|
19
|
-
marks: baseSchema.spec.marks.append(spanWithNowrap).append(localization(true))
|
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" },
|
27
|
-
React.createElement(FormatButton, { markName: "strong", displayName: "Bold" }),
|
28
|
-
React.createElement(FormatButton, { markName: "em", displayName: "Italic" }),
|
29
|
-
React.createElement(TableMenu, null),
|
30
|
-
React.createElement(FormulaButton, { setFormulaState: setFormulaState }),
|
31
|
-
React.createElement(NbspButton, null),
|
32
|
-
React.createElement(CurrentLocalization, { currentElement: currentElement })));
|
33
|
-
}
|
34
|
-
function EditableGradingInstruction({ element }) {
|
35
|
-
const { onContentChange } = useContext(GradingInstructionContext);
|
36
|
-
const doc = ProseDOMParser.fromSchema(schema).parse(element);
|
37
|
-
const [mount, setMount] = useState(null);
|
38
|
-
const [formulaState, setFormulaState] = useState(null);
|
39
|
-
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
|
-
}
|
59
|
-
return (React.createElement(ProseMirror, { mount: mount, state: state, dispatchTransaction: tr => {
|
60
|
-
setCurrentElement(findElementFromPosition(tr.doc, tr.selection.from));
|
61
|
-
setState(s => {
|
62
|
-
var _a;
|
63
|
-
const newContent = s.apply(tr);
|
64
|
-
if (tr.docChanged) {
|
65
|
-
const fragment = DOMSerializer.fromSchema(outputSchema).serializeFragment(tr.doc.content);
|
66
|
-
const div = document.createElement('div');
|
67
|
-
div.appendChild(fragment);
|
68
|
-
const path = (_a = element.getAttribute('path')) !== null && _a !== void 0 ? _a : '';
|
69
|
-
if (onContentChange) {
|
70
|
-
const nbspFixed = div.innerHTML
|
71
|
-
.replace(/ /g, ' ')
|
72
|
-
.replace(/<br>/g, '<br/>')
|
73
|
-
.replace(/<hr>/g, '<hr/>');
|
74
|
-
onContentChange(nbspFixed, path);
|
75
|
-
}
|
76
|
-
}
|
77
|
-
return newContent;
|
78
|
-
});
|
79
|
-
} },
|
80
|
-
React.createElement(Menu, { setFormulaState: setFormulaState, currentElement: currentElement }),
|
81
|
-
React.createElement("div", { ref: setMount }),
|
82
|
-
formulaState && (React.createElement(FormulaPopup, { state: formulaState, onFinish: () => {
|
83
|
-
setFormulaState(null);
|
84
|
-
} }))));
|
85
|
-
}
|
86
|
-
export default EditableGradingInstruction;
|
87
|
-
//# sourceMappingURL=EditableGradingInstruction.js.map
|
@@ -1 +0,0 @@
|
|
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,EAAQ,MAAM,mBAAmB,CAAA;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAsB,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACvH,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,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAElE,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;IACxB,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;IACtE,KAAK,E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"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAO9F,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { createRenderChildNodes } from '../../createRenderChildNodes';
|
3
|
-
import Localization from '../Localization';
|
4
|
-
const renderChildNodes = createRenderChildNodes({
|
5
|
-
'e:localization': Localization
|
6
|
-
});
|
7
|
-
const GradingInstruction = ({ element, instructionType }) => (React.createElement("div", { className: `${instructionType} e-multiline-results-text-answer e-mrg-b-2 e-pad-l-2` }, renderChildNodes(element)));
|
8
|
-
export default GradingInstruction;
|
9
|
-
//# sourceMappingURL=GradingInstruction.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"GradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/GradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAE1C,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;IAC9C,gBAAgB,EAAE,YAAY;CAC/B,CAAC,CAAA;AAEF,MAAM,kBAAkB,GAA2E,CAAC,EAClG,OAAO,EACP,eAAe,EAChB,EAAE,EAAE,CAAC,CACJ,6BAAK,SAAS,EAAE,GAAG,eAAe,sDAAsD,IACrF,gBAAgB,CAAC,OAAO,CAAC,CACtB,CACP,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CurrentElement.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/CurrentElement.tsx"],"names":[],"mappings":""}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
function CurrentElement({ currentElement }) {
|
3
|
-
return (React.createElement("div", null,
|
4
|
-
props.currentElement.getAttribute('lang'),
|
5
|
-
" ",
|
6
|
-
props.currentElement.getAttribute('exam-type')));
|
7
|
-
}
|
8
|
-
//# sourceMappingURL=CurrentElement.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CurrentElement.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/CurrentElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,SAAS,cAAc,CAAC,EAAE,cAAc,EAAsC;IAC5E,OAAO,CACL;QACG,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,MAAM,CAAC;;QAAG,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,WAAW,CAAC,CACvF,CACP,CAAA;AACH,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CurrentLocalization.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/CurrentLocalization.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,wBAAgB,mBAAmB,CAAC,EAAE,cAAc,EAAE,EAAE;IAAE,cAAc,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,qBAYzF"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
export function CurrentLocalization({ currentElement }) {
|
3
|
-
var _a;
|
4
|
-
const locale = currentElement === null || currentElement === void 0 ? void 0 : currentElement.getAttribute('lang');
|
5
|
-
const lang = (_a = locale === null || locale === void 0 ? void 0 : locale.split('-')[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
6
|
-
const examType = currentElement === null || currentElement === void 0 ? void 0 : currentElement.getAttribute('exam-type');
|
7
|
-
return (React.createElement("span", { className: "element-target" },
|
8
|
-
React.createElement("span", null, "Kohdennus:"),
|
9
|
-
React.createElement("span", { className: "enabled" }, lang ? `${lang} yleinen` : 'Yleinen'),
|
10
|
-
React.createElement("span", { className: examType == 'hearing-impaired' ? 'enabled' : 'disabled' },
|
11
|
-
lang,
|
12
|
-
" / KV"),
|
13
|
-
React.createElement("span", { className: examType == 'visually-impaired' ? 'enabled' : 'disabled' },
|
14
|
-
lang,
|
15
|
-
" / NV")));
|
16
|
-
}
|
17
|
-
//# sourceMappingURL=CurrentLocalization.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"CurrentLocalization.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/CurrentLocalization.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,UAAU,mBAAmB,CAAC,EAAE,cAAc,EAAsC;;IACxF,MAAM,MAAM,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,YAAY,CAAC,MAAM,CAAC,CAAA;IACnD,MAAM,IAAI,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,0CAAE,WAAW,EAAE,CAAA;IACjD,MAAM,QAAQ,GAAG,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,YAAY,CAAC,WAAW,CAAC,CAAA;IAC1D,OAAO,CACL,8BAAM,SAAS,EAAC,gBAAgB;QAC9B,+CAAuB;QACvB,8BAAM,SAAS,EAAC,SAAS,IAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,SAAS,CAAQ;QACvE,8BAAM,SAAS,EAAE,QAAQ,IAAI,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;YAAG,IAAI;oBAAa;QAC5F,8BAAM,SAAS,EAAE,QAAQ,IAAI,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU;YAAG,IAAI;oBAAa,CACxF,CACR,CAAA;AACH,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FormatButton.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/FormatButton.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,UAAU,KAAK;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;CACpB;AAID,iBAAS,YAAY,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,KAAK,qBAuBrD;AAED,eAAe,YAAY,CAAA"}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { useEditorEventCallback, useEditorState } from '@nytimes/react-prosemirror';
|
2
|
-
import { toggleMark } from 'prosemirror-commands';
|
3
|
-
import React, { useEffect, useState } from 'react';
|
4
|
-
const getMarkType = (state, markName) => state.schema.marks[markName];
|
5
|
-
function FormatButton({ markName, displayName }) {
|
6
|
-
const editorState = useEditorState();
|
7
|
-
const [isActive, setIsActive] = useState(false);
|
8
|
-
const onClick = useEditorEventCallback(view => {
|
9
|
-
const { state } = view;
|
10
|
-
const toggleFormatMark = toggleMark(getMarkType(state, markName));
|
11
|
-
toggleFormatMark(state, view.dispatch, view);
|
12
|
-
view.focus();
|
13
|
-
});
|
14
|
-
useEffect(() => {
|
15
|
-
const isTextFormatActive = editorState.storedMarks
|
16
|
-
? getMarkType(editorState, markName).isInSet(editorState.storedMarks) // is next input going to be marked?
|
17
|
-
: getMarkType(editorState, markName).isInSet(editorState.selection.$to.marks()); // is current input marked?
|
18
|
-
setIsActive(!!isTextFormatActive);
|
19
|
-
}, [editorState]);
|
20
|
-
return (React.createElement("button", { onClick: onClick, style: { fontWeight: isActive ? 'bold' : 'normal' } }, displayName));
|
21
|
-
}
|
22
|
-
export default FormatButton;
|
23
|
-
//# sourceMappingURL=FormatButton.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FormatButton.js","sourceRoot":"","sources":["../../../../src/components/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AAkB,CAAC,CAAA;IACnC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IAEjB,OAAO,CACL,gCAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,IAC1E,WAAW,CACL,CACV,CAAA;AACH,CAAC;AAED,eAAe,YAAY,CAAA"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { Plugin } from 'prosemirror-state';
|
2
|
-
import { NodeSpec } from 'prosemirror-model';
|
3
|
-
import React from 'react';
|
4
|
-
export type FormulaEditorState = {
|
5
|
-
pos: number;
|
6
|
-
latex: string;
|
7
|
-
element: Element;
|
8
|
-
};
|
9
|
-
export declare const formulaSchema: NodeSpec;
|
10
|
-
export declare const formulaOutputSchema: NodeSpec;
|
11
|
-
export declare function FormulaButton(props: {
|
12
|
-
setFormulaState: (values: FormulaEditorState) => void;
|
13
|
-
}): React.JSX.Element;
|
14
|
-
export declare class FormulaPlugin extends Plugin {
|
15
|
-
constructor(updateFormulaState: (values: FormulaEditorState) => void);
|
16
|
-
}
|
17
|
-
//# sourceMappingURL=Formula.d.ts.map
|
@@ -1 +0,0 @@
|
|
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,QA6B3B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,QASjC,CAAA;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,eAAe,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAA;CAAE,qBAoB7F;AAED,qBAAa,aAAc,SAAQ,MAAM;gBAC3B,kBAAkB,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI;CAmBrE"}
|
@@ -1,81 +0,0 @@
|
|
1
|
-
import { Plugin, PluginKey } from 'prosemirror-state';
|
2
|
-
import { Fragment } from 'prosemirror-model';
|
3
|
-
import { useEditorEventCallback } from '@nytimes/react-prosemirror';
|
4
|
-
import React from 'react';
|
5
|
-
export const formulaSchema = {
|
6
|
-
formula: {
|
7
|
-
inline: true,
|
8
|
-
group: 'inline',
|
9
|
-
atom: true,
|
10
|
-
attrs: {
|
11
|
-
latex: {},
|
12
|
-
mode: { default: '' }
|
13
|
-
},
|
14
|
-
parseDOM: [
|
15
|
-
{
|
16
|
-
tag: '[data-editor-id=e-formula]',
|
17
|
-
getAttrs(dom) {
|
18
|
-
return {
|
19
|
-
latex: dom.textContent,
|
20
|
-
mode: dom.getAttribute('mode')
|
21
|
-
};
|
22
|
-
}
|
23
|
-
}
|
24
|
-
],
|
25
|
-
toDOM(node) {
|
26
|
-
const container = document.createElement('img');
|
27
|
-
if (node.attrs.latex) {
|
28
|
-
container.setAttribute('alt', node.attrs.latex);
|
29
|
-
container.setAttribute('src', `/math.svg?latex=${encodeURIComponent(node.attrs.latex)}`);
|
30
|
-
}
|
31
|
-
return container;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
};
|
35
|
-
export const formulaOutputSchema = {
|
36
|
-
formula: {
|
37
|
-
...formulaSchema.formula,
|
38
|
-
toDOM(node) {
|
39
|
-
const container = document.createElement('span');
|
40
|
-
container.innerHTML = `<e:formula ${node.attrs.mode ? `mode="${node.attrs.mode}"` : ''}>${node.attrs.latex}</e:formula>`;
|
41
|
-
return container.firstElementChild;
|
42
|
-
}
|
43
|
-
}
|
44
|
-
};
|
45
|
-
export function FormulaButton(props) {
|
46
|
-
const onClick = useEditorEventCallback(view => {
|
47
|
-
const transaction = view.state.tr;
|
48
|
-
const formula = view.state.schema.nodes.formula.create({ latex: '' }, Fragment.empty);
|
49
|
-
if (view.dispatch) {
|
50
|
-
view.dispatch(transaction.insert(view.state.selection.to, formula).scrollIntoView());
|
51
|
-
const pos = view.state.selection.to - formula.nodeSize;
|
52
|
-
const element = view.nodeDOM(pos);
|
53
|
-
if (element instanceof Element) {
|
54
|
-
props.setFormulaState({ pos, latex: '', element });
|
55
|
-
}
|
56
|
-
}
|
57
|
-
});
|
58
|
-
return (React.createElement("button", { onClick: onClick, "data-testid": "add-formula" }, "Lis\u00E4\u00E4 kaava"));
|
59
|
-
}
|
60
|
-
export class FormulaPlugin extends Plugin {
|
61
|
-
constructor(updateFormulaState) {
|
62
|
-
super({
|
63
|
-
key: new PluginKey('Formula'),
|
64
|
-
props: {
|
65
|
-
handleClick(view, pos) {
|
66
|
-
const { state } = view;
|
67
|
-
const node = state.doc.nodeAt(pos);
|
68
|
-
if (node && node.type.name === 'formula') {
|
69
|
-
const domNode = view.nodeDOM(pos);
|
70
|
-
if (domNode instanceof Element) {
|
71
|
-
updateFormulaState({ pos, element: domNode, latex: node.attrs.latex });
|
72
|
-
return true;
|
73
|
-
}
|
74
|
-
}
|
75
|
-
return false;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
});
|
79
|
-
}
|
80
|
-
}
|
81
|
-
//# sourceMappingURL=Formula.js.map
|
@@ -1 +0,0 @@
|
|
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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GAAG,IAAI,CAAA;oBACtB,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;oBAClC,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;wBACzC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;wBACjC,IAAI,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"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FormulaPopup.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/FormulaPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAG9C,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,kBAAkB,CAAC;IAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;CAAE,qBAmDpG"}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { useEditorEventCallback } from '@nytimes/react-prosemirror';
|
3
|
-
import { Popup } from '../../shared/Popup';
|
4
|
-
export function FormulaPopup({ state, onFinish }) {
|
5
|
-
const onValueChange = (text) => {
|
6
|
-
if (text.length && !containsOnlyOneImgTag(text)) {
|
7
|
-
return 'Ainoastaan yksi kaava sallittu';
|
8
|
-
}
|
9
|
-
return null;
|
10
|
-
};
|
11
|
-
const onContentChange = useEditorEventCallback((view, textField) => {
|
12
|
-
const node = view.state.doc.nodeAt(state.pos);
|
13
|
-
const latex = extractLatex(textField) || '';
|
14
|
-
const { schema } = view.state;
|
15
|
-
if (node) {
|
16
|
-
const tr = view.state.tr.replaceWith(state.pos, state.pos + node.nodeSize, schema.node('formula', { ...node.attrs, ...{ latex } }));
|
17
|
-
view.dispatch(tr);
|
18
|
-
}
|
19
|
-
onFinish();
|
20
|
-
});
|
21
|
-
const onDelete = useEditorEventCallback(view => {
|
22
|
-
const node = view.state.doc.nodeAt(state.pos);
|
23
|
-
if (node) {
|
24
|
-
const tr = view.state.tr.delete(state.pos, state.pos + node.nodeSize);
|
25
|
-
view.dispatch(tr);
|
26
|
-
}
|
27
|
-
onFinish();
|
28
|
-
});
|
29
|
-
return (React.createElement(Popup, { element: state.element, initialTextContent: state.latex.length ? `<img alt="${state.latex}" src="/math.svg?latex=${encodeURIComponent(state.latex)}">` : '', onValueChange: onValueChange, onValueSave: onContentChange, enableDelete: true, onDelete: onDelete, onCancel: () => {
|
30
|
-
if (!state.latex.length) {
|
31
|
-
onDelete();
|
32
|
-
}
|
33
|
-
onFinish();
|
34
|
-
} }));
|
35
|
-
}
|
36
|
-
function extractLatex(value) {
|
37
|
-
const latexPattern = /alt="([^&]+)" src=/;
|
38
|
-
const latexMatch = value.match(latexPattern);
|
39
|
-
if (!latexMatch || latexMatch.length < 2) {
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
return decodeURIComponent(latexMatch[1]);
|
43
|
-
}
|
44
|
-
function containsOnlyOneImgTag(htmlString) {
|
45
|
-
const imgTagPattern = /^<img\s+[^>]*>$/g;
|
46
|
-
const matches = htmlString.trim().match(imgTagPattern);
|
47
|
-
return matches && matches.length === 1;
|
48
|
-
}
|
49
|
-
//# sourceMappingURL=FormulaPopup.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"FormulaPopup.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/FormulaPopup.tsx"],"names":[],"mappings":"A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BAAkB,CAAA;IACxC,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IACtD,OAAO,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAA;AACxC,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"localization.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/localization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAElD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,CAiCxD"}
|