@digabi/exam-engine-core 22.0.1-alpha.6 → 22.1.0-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/EditableGradingInsatruction.test.d.ts +1 -0
- package/dist/__tests__/EditableGradingInsatruction.test.d.ts.map +1 -0
- package/dist/__tests__/EditableGradingInsatruction.test.js +2 -0
- package/dist/__tests__/EditableGradingInsatruction.test.js.map +1 -0
- package/dist/__tests__/EditableGradingInstruction.test.d.ts +2 -0
- package/dist/__tests__/EditableGradingInstruction.test.d.ts.map +1 -0
- package/dist/__tests__/EditableGradingInstruction.test.js +178 -0
- package/dist/__tests__/EditableGradingInstruction.test.js.map +1 -0
- package/dist/__tests__/FormatButton.test.d.ts +2 -0
- package/dist/__tests__/FormatButton.test.d.ts.map +1 -0
- package/dist/__tests__/FormatButton.test.js +94 -0
- package/dist/__tests__/FormatButton.test.js.map +1 -0
- package/dist/__tests__/annotations.test.js +7 -7
- package/dist/__tests__/annotations.test.js.map +1 -1
- package/dist/__tests__/editor/Formula.test.d.ts +2 -0
- package/dist/__tests__/editor/Formula.test.d.ts.map +1 -0
- package/dist/__tests__/editor/Formula.test.js +53 -0
- package/dist/__tests__/editor/Formula.test.js.map +1 -0
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/__tests__/utils/ProseMirrorWrapper.d.ts +8 -0
- package/dist/__tests__/utils/ProseMirrorWrapper.d.ts.map +1 -0
- package/dist/__tests__/utils/ProseMirrorWrapper.js +44 -0
- package/dist/__tests__/utils/ProseMirrorWrapper.js.map +1 -0
- package/dist/__tests__/utils/prosemirror.d.ts +3 -0
- package/dist/__tests__/utils/prosemirror.d.ts.map +1 -0
- package/dist/__tests__/utils/prosemirror.js +38 -0
- package/dist/__tests__/utils/prosemirror.js.map +1 -0
- package/dist/components/LexicalEditor.d.ts +3 -0
- package/dist/components/LexicalEditor.d.ts.map +1 -0
- package/dist/components/LexicalEditor.js +44 -0
- package/dist/components/LexicalEditor.js.map +1 -0
- package/dist/components/RTE.d.ts +3 -0
- package/dist/components/RTE.d.ts.map +1 -0
- package/dist/components/RTE.js +23 -0
- package/dist/components/RTE.js.map +1 -0
- package/dist/components/TablePlugin.d.ts +1 -0
- package/dist/components/TablePlugin.d.ts.map +1 -0
- package/dist/components/TablePlugin.js +2 -0
- package/dist/components/TablePlugin.js.map +1 -0
- package/dist/components/ToolBarPlugin.d.ts +10 -0
- package/dist/components/ToolBarPlugin.d.ts.map +1 -0
- package/dist/components/ToolBarPlugin.js +111 -0
- package/dist/components/ToolBarPlugin.js.map +1 -0
- package/dist/components/context/AnnotationContext.d.ts +8 -0
- package/dist/components/context/AnnotationContext.d.ts.map +1 -0
- package/dist/components/context/AnnotationContext.js +3 -0
- package/dist/components/context/AnnotationContext.js.map +1 -0
- package/dist/components/context/AnnotationProvider.d.ts +2 -2
- package/dist/components/context/AnnotationProvider.d.ts.map +1 -1
- package/dist/components/context/AnnotationProvider.js +3 -2
- package/dist/components/context/AnnotationProvider.js.map +1 -1
- package/dist/components/exam/ExamineExam.d.ts +5 -0
- package/dist/components/exam/ExamineExam.d.ts.map +1 -0
- package/dist/components/exam/ExamineExam.js +20 -0
- package/dist/components/exam/ExamineExam.js.map +1 -0
- package/dist/components/exam/FinishExam.d.ts +5 -0
- package/dist/components/exam/FinishExam.d.ts.map +1 -0
- package/dist/components/exam/FinishExam.js +17 -0
- package/dist/components/exam/FinishExam.js.map +1 -0
- package/dist/components/grading/reactAnnotation.d.ts +4 -0
- package/dist/components/grading/reactAnnotation.d.ts.map +1 -0
- package/dist/components/grading/reactAnnotation.js +54 -0
- package/dist/components/grading/reactAnnotation.js.map +1 -0
- package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -1
- package/dist/components/grading-instructions/EditableGradingInstruction.js +31 -22
- package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
- package/dist/components/grading-instructions/SlateTableEditor.d.ts +22 -0
- package/dist/components/grading-instructions/SlateTableEditor.d.ts.map +1 -0
- package/dist/components/grading-instructions/SlateTableEditor.js +44 -0
- package/dist/components/grading-instructions/SlateTableEditor.js.map +1 -0
- package/dist/components/grading-instructions/SlateUtils.d.ts +5 -0
- package/dist/components/grading-instructions/SlateUtils.d.ts.map +1 -0
- package/dist/components/grading-instructions/SlateUtils.js +28 -0
- package/dist/components/grading-instructions/SlateUtils.js.map +1 -0
- package/dist/components/grading-instructions/editor/FormatButton.d.ts +8 -0
- package/dist/components/grading-instructions/editor/FormatButton.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/FormatButton.js +23 -0
- package/dist/components/grading-instructions/editor/FormatButton.js.map +1 -0
- package/dist/components/grading-instructions/editor/Formula.d.ts +17 -0
- package/dist/components/grading-instructions/editor/Formula.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/Formula.js +81 -0
- package/dist/components/grading-instructions/editor/Formula.js.map +1 -0
- package/dist/components/grading-instructions/editor/FormulaPopup.d.ts +7 -0
- package/dist/components/grading-instructions/editor/FormulaPopup.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/FormulaPopup.js +49 -0
- package/dist/components/grading-instructions/editor/FormulaPopup.js.map +1 -0
- package/dist/components/grading-instructions/editor/MathPopup.d.ts +10 -0
- package/dist/components/grading-instructions/editor/MathPopup.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/MathPopup.js +94 -0
- package/dist/components/grading-instructions/editor/MathPopup.js.map +1 -0
- package/dist/components/grading-instructions/editor/Table.d.ts +5 -0
- package/dist/components/grading-instructions/editor/Table.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/Table.js +181 -0
- package/dist/components/grading-instructions/editor/Table.js.map +1 -0
- package/dist/components/grading-instructions/editor/math-svg.d.ts +2 -0
- package/dist/components/grading-instructions/editor/math-svg.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/math-svg.js +22 -0
- package/dist/components/grading-instructions/editor/math-svg.js.map +1 -0
- package/dist/components/grading-instructions/editor/math.d.ts +4 -0
- package/dist/components/grading-instructions/editor/math.d.ts.map +1 -0
- package/dist/components/grading-instructions/editor/math.js +55 -0
- package/dist/components/grading-instructions/editor/math.js.map +1 -0
- package/dist/components/grading-instructions/prosemirror.d.ts +8 -0
- package/dist/components/grading-instructions/prosemirror.d.ts.map +1 -0
- package/dist/components/grading-instructions/prosemirror.js +108 -0
- package/dist/components/grading-instructions/prosemirror.js.map +1 -0
- package/dist/components/results/isExamFinishPageHook.d.ts +2 -0
- package/dist/components/results/isExamFinishPageHook.d.ts.map +1 -0
- package/dist/components/results/isExamFinishPageHook.js +7 -0
- package/dist/components/results/isExamFinishPageHook.js.map +1 -0
- package/dist/components/shared/AnnotationMark.d.ts +1 -1
- package/dist/components/shared/AnnotationMark.d.ts.map +1 -1
- package/dist/components/shared/AnnotationPopup.d.ts +1 -1
- package/dist/components/shared/AnnotationPopup.d.ts.map +1 -1
- package/dist/components/shared/AnnotationPopup.js +11 -70
- package/dist/components/shared/AnnotationPopup.js.map +1 -1
- package/dist/components/shared/CreateAnnotationPopup.d.ts +6 -0
- package/dist/components/shared/CreateAnnotationPopup.d.ts.map +1 -0
- package/dist/components/shared/CreateAnnotationPopup.js +11 -0
- package/dist/components/shared/CreateAnnotationPopup.js.map +1 -0
- package/dist/components/shared/Popup.d.ts +15 -0
- package/dist/components/shared/Popup.d.ts.map +1 -0
- package/dist/components/shared/Popup.js +90 -0
- package/dist/components/shared/Popup.js.map +1 -0
- package/dist/components/shared/PopupUtils.d.ts +4 -0
- package/dist/components/shared/PopupUtils.d.ts.map +1 -0
- package/dist/components/shared/PopupUtils.js +26 -0
- package/dist/components/shared/PopupUtils.js.map +1 -0
- package/dist/components/shared/markText.d.ts +1 -1
- package/dist/components/shared/markText.d.ts.map +1 -1
- package/dist/components/shared/markText.js.map +1 -1
- package/dist/main-bundle.js +1 -1
- package/dist/main.css +1 -1
- package/dist/store/listenerMiddleware.d.ts +89 -0
- package/dist/store/listenerMiddleware.d.ts.map +1 -0
- package/dist/store/listenerMiddleware.js +6 -0
- package/dist/store/listenerMiddleware.js.map +1 -0
- package/package.json +3 -2
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../src/components/shared/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAMlD,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAA;IACvB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;IAC/C,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,YAAY,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,4BA6FtC;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,QAkBlG;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,QAKtD"}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
2
|
+
import { makeRichText } from 'rich-text-editor';
|
3
|
+
import classNames from 'classnames';
|
4
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
5
|
+
import { faTrashCan } from '@fortawesome/free-solid-svg-icons';
|
6
|
+
export function Popup(props) {
|
7
|
+
const popupRef = React.createRef();
|
8
|
+
const textAreaRef = React.createRef();
|
9
|
+
const [textContent, setTextContent] = useState(props.initialTextContent || '');
|
10
|
+
const [saveEnabled, setSaveEnabled] = useState(false);
|
11
|
+
const [verifyDelete, setVerifyDelete] = useState(false);
|
12
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
13
|
+
useEffect(() => {
|
14
|
+
if (props.element && textAreaRef.current) {
|
15
|
+
showAndPositionElement(props.element, popupRef);
|
16
|
+
textAreaRef.current.innerHTML = textContent;
|
17
|
+
makeRichText(textAreaRef.current, {
|
18
|
+
locale: 'FI',
|
19
|
+
screenshotSaver: () => Promise.resolve('')
|
20
|
+
}, value => {
|
21
|
+
if (props.onValueChange) {
|
22
|
+
const error = props.onValueChange(value.answerHTML);
|
23
|
+
setErrorMessage(error);
|
24
|
+
}
|
25
|
+
setTextContent(value.answerHTML);
|
26
|
+
setSaveEnabled(value.answerHTML.trim().length > 0);
|
27
|
+
});
|
28
|
+
textAreaRef.current.focus();
|
29
|
+
}
|
30
|
+
setTextContent('');
|
31
|
+
setSaveEnabled(props.initialTextContent.length > 0);
|
32
|
+
}, [props.element]);
|
33
|
+
if (!props.element) {
|
34
|
+
return null;
|
35
|
+
}
|
36
|
+
return (React.createElement("div", { className: "e-popup", style: { position: 'absolute', opacity: 0 }, ref: popupRef, "data-testid": "e-popup" },
|
37
|
+
React.createElement("div", { className: "e-popup-content", "data-testid": "e-popup-content", role: "textbox", "aria-multiline": "true", ref: textAreaRef }),
|
38
|
+
errorMessage && React.createElement("span", { className: "e-popup-error" }, errorMessage),
|
39
|
+
React.createElement("span", { className: "e-popup-button-area" },
|
40
|
+
React.createElement("span", null,
|
41
|
+
React.createElement("button", { className: "button", onClick: e => {
|
42
|
+
e.stopPropagation();
|
43
|
+
closeMathEditor(textAreaRef.current);
|
44
|
+
props.onValueSave(textContent);
|
45
|
+
}, "data-testid": "e-popup-save", disabled: !saveEnabled || !!errorMessage }, "Tallenna"),
|
46
|
+
React.createElement("button", { className: "button text-button", "data-testid": "e-popup-cancel", onClick: () => {
|
47
|
+
closeMathEditor(textAreaRef.current);
|
48
|
+
props.onCancel();
|
49
|
+
} }, "Peru")),
|
50
|
+
props.enableDelete && (React.createElement("button", { className: classNames('button', 'e-popup-delete', 'round', { confirm: verifyDelete }), "data-testid": "e-popup-delete", onClick: () => {
|
51
|
+
if (!verifyDelete) {
|
52
|
+
setVerifyDelete(true);
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
if (props.onDelete) {
|
56
|
+
closeMathEditor(textAreaRef.current);
|
57
|
+
props.onDelete();
|
58
|
+
}
|
59
|
+
}
|
60
|
+
} },
|
61
|
+
React.createElement(FontAwesomeIcon, { size: "lg", icon: faTrashCan, fixedWidth: true }),
|
62
|
+
" ",
|
63
|
+
verifyDelete && 'Vahvista?')))));
|
64
|
+
}
|
65
|
+
export function showAndPositionElement(mark, popupRef) {
|
66
|
+
const popup = popupRef.current;
|
67
|
+
if (mark && popup) {
|
68
|
+
const style = popup.style;
|
69
|
+
const markRect = mark === null || mark === void 0 ? void 0 : mark.getBoundingClientRect();
|
70
|
+
const popupRect = popup.getBoundingClientRect();
|
71
|
+
const top = markRect.height + markRect.top + window.scrollY;
|
72
|
+
const windowWidth = window.innerWidth;
|
73
|
+
style.top = `${String(top)}px`;
|
74
|
+
style.opacity = '1';
|
75
|
+
const popupHitsWindowRight = markRect.left + popupRect.width > windowWidth;
|
76
|
+
if (popupHitsWindowRight) {
|
77
|
+
style.left = `${markRect.right - popupRect.width}px`;
|
78
|
+
}
|
79
|
+
else {
|
80
|
+
style.left = `${markRect.left}px`;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
export function closeMathEditor(element) {
|
85
|
+
// rich-text-editor does not properly support several rich-text-editor instances created at different times.
|
86
|
+
// In order to close math editor that is open, we need to dispatch events like this.
|
87
|
+
element.dispatchEvent(new Event('focus', { bubbles: true, cancelable: true }));
|
88
|
+
element.dispatchEvent(new Event('blur', { bubbles: true, cancelable: true }));
|
89
|
+
}
|
90
|
+
//# sourceMappingURL=Popup.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Popup.js","sourceRoot":"","sources":["../../../src/components/shared/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,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AM,CAAC,GAAG,CAAC,IAAI,CAAA;QAC9B,KAAK,CAAC,OAAO,GAAG,GAAG,CAAA;QACnB,MAAM,oBAAoB,GAAG,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,KAAK,GAAG,WAAW,CAAA;QAE1E,IAAI,oBAAoB,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,GAAG,GAAG,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,CAAA;QACtD,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,IAAI,CAAA;QACnC,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAuB;IACrD,4GAA4G;IAC5G,oFAAoF;IACpF,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC9E,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAC/E,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"PopupUtils.d.ts","sourceRoot":"","sources":["../../../src/components/shared/PopupUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,QAkBlG;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,QAKtD"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
export function showAndPositionElement(mark, popupRef) {
|
2
|
+
const popup = popupRef.current;
|
3
|
+
if (mark && popup) {
|
4
|
+
const style = popup.style;
|
5
|
+
const markRect = mark === null || mark === void 0 ? void 0 : mark.getBoundingClientRect();
|
6
|
+
const popupRect = popup.getBoundingClientRect();
|
7
|
+
const top = markRect.height + markRect.top + window.scrollY;
|
8
|
+
const windowWidth = window.innerWidth;
|
9
|
+
style.top = `${String(top)}px`;
|
10
|
+
style.opacity = '1';
|
11
|
+
const popupHitsWindowRight = markRect.left + popupRect.width > windowWidth;
|
12
|
+
if (popupHitsWindowRight) {
|
13
|
+
style.left = `${markRect.right - popupRect.width}px`;
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
style.left = `${markRect.left}px`;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
export function closeMathEditor(element) {
|
21
|
+
// rich-text-editor does not properly support several rich-text-editor instances created at different times.
|
22
|
+
// In order to close math editor that is open, we need to dispatch events like this.
|
23
|
+
element.dispatchEvent(new Event('focus', { bubbles: true, cancelable: true }));
|
24
|
+
element.dispatchEvent(new Event('blur', { bubbles: true, cancelable: true }));
|
25
|
+
}
|
26
|
+
//# sourceMappingURL=PopupUtils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"PopupUtils.js","sourceRoot":"","sources":["../../../src/components/shared/PopupUtils.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,sBAAsB,CAAC,IAAoB,EAAE,QAAsC;IACjG,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAA;IAC9B,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;QAClB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAA;QACzB,MAAM,QAAQ,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,qBAAqB,EAAE,CAAA;QAC9C,MAAM,SAAS,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC/C,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,GAAG,MAAM,CAAC,OAAO,CAAA;QAC3D,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAA;QACrC,KAAK,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAA;QAC9B,KAAK,CAAC,OAAO,GAAG,GAAG,CAAA;QACnB,MAAM,oBAAoB,GAAG,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,KAAK,GAAG,WAAW,CAAA;QAE1E,IAAI,oBAAoB,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,GAAG,GAAG,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,CAAA;QACtD,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,IAAI,CAAA;QACnC,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAuB;IACrD,4GAA4G;IAC5G,oFAAoF;IACpF,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAC9E,OAAO,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AAC/E,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { NewRenderableAnnotation, RenderableAnnotation } from '../../types/Score';
|
3
3
|
export declare function isExistingAnnotation(annotation: NewRenderableAnnotation | RenderableAnnotation): annotation is RenderableAnnotation;
|
4
|
-
export declare function markText(text: string, annotations: (RenderableAnnotation | NewRenderableAnnotation)[], onClickAnnotation: (e: React.MouseEvent<HTMLElement, MouseEvent>, a: RenderableAnnotation) => void, setNewAnnotationRef: (ref: HTMLElement |
|
4
|
+
export declare function markText(text: string, annotations: (RenderableAnnotation | NewRenderableAnnotation)[], onClickAnnotation: (e: React.MouseEvent<HTMLElement, MouseEvent>, a: RenderableAnnotation) => void, setNewAnnotationRef: (ref: HTMLElement | null) => void): React.ReactNode[];
|
5
5
|
//# sourceMappingURL=markText.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"markText.d.ts","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAOjF,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,uBAAuB,GAAG,oBAAoB,GACzD,UAAU,IAAI,oBAAoB,CAEpC;AAMD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,CAAC,oBAAoB,GAAG,uBAAuB,CAAC,EAAE,EAC/D,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE,oBAAoB,KAAK,IAAI,EAClG,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,
|
1
|
+
{"version":3,"file":"markText.d.ts","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAOjF,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,uBAAuB,GAAG,oBAAoB,GACzD,UAAU,IAAI,oBAAoB,CAEpC;AAMD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,CAAC,oBAAoB,GAAG,uBAAuB,CAAC,EAAE,EAC/D,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,CAAC,EAAE,oBAAoB,KAAK,IAAI,EAClG,mBAAmB,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,qBA4GvD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"markText.js","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,SAAS,MAAM,CAAC,UAA0D;IACxE,OAAO,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAA;AACnH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,UAA0D;IAE1D,OAAO,cAAc,IAAI,UAAU,CAAA;AACrC,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,UAAkB,EAAE,MAAc;IACrE,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC,CAAA;AACxD,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,IAAY,EACZ,WAA+D,EAC/D,iBAAkG,EAClG,
|
1
|
+
{"version":3,"file":"markText.js","sourceRoot":"","sources":["../../../src/components/shared/markText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,SAAS,MAAM,CAAC,UAA0D;IACxE,OAAO,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAA;AACnH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,UAA0D;IAE1D,OAAO,cAAc,IAAI,UAAU,CAAA;AACrC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