@digabi/exam-engine-core 22.1.0-alpha.0 → 22.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  2. package/dist/components/context/AttachmentContext.d.ts.map +1 -1
  3. package/dist/components/context/ExamContext.d.ts.map +1 -1
  4. package/dist/components/context/GradingInstructionContext.d.ts +6 -11
  5. package/dist/components/context/GradingInstructionContext.d.ts.map +1 -1
  6. package/dist/components/context/GradingInstructionContext.js.map +1 -1
  7. package/dist/components/context/QuestionContext.d.ts.map +1 -1
  8. package/dist/components/context/ResultsContext.d.ts.map +1 -1
  9. package/dist/components/context/SectionContext.d.ts.map +1 -1
  10. package/dist/components/grading-instructions/AnswerGradingInstruction.d.ts.map +1 -1
  11. package/dist/components/grading-instructions/AnswerGradingInstruction.js +4 -3
  12. package/dist/components/grading-instructions/AnswerGradingInstruction.js.map +1 -1
  13. package/dist/components/grading-instructions/ExamGradingInstruction.d.ts.map +1 -1
  14. package/dist/components/grading-instructions/ExamGradingInstruction.js +2 -7
  15. package/dist/components/grading-instructions/ExamGradingInstruction.js.map +1 -1
  16. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts +1 -1
  17. package/dist/components/grading-instructions/GradingInstructionProvider.d.ts.map +1 -1
  18. package/dist/components/grading-instructions/GradingInstructionProvider.js +1 -4
  19. package/dist/components/grading-instructions/GradingInstructionProvider.js.map +1 -1
  20. package/dist/components/grading-instructions/GradingInstructions.d.ts +6 -2
  21. package/dist/components/grading-instructions/GradingInstructions.d.ts.map +1 -1
  22. package/dist/components/grading-instructions/GradingInstructions.js +2 -3
  23. package/dist/components/grading-instructions/GradingInstructions.js.map +1 -1
  24. package/dist/components/shared/Popup.js +2 -2
  25. package/dist/components/shared/Popup.js.map +1 -1
  26. package/dist/dom-utils.d.ts.map +1 -1
  27. package/dist/dom-utils.js +4 -2
  28. package/dist/dom-utils.js.map +1 -1
  29. package/dist/main-bundle.js +1 -1
  30. package/dist/main-bundle.js.LICENSE.txt +1 -1
  31. package/dist/main.css +1 -1
  32. package/package.json +4 -11
  33. package/dist/__tests__/EditableGradingInsatruction.test.d.ts +0 -1
  34. package/dist/__tests__/EditableGradingInsatruction.test.d.ts.map +0 -1
  35. package/dist/__tests__/EditableGradingInsatruction.test.js +0 -2
  36. package/dist/__tests__/EditableGradingInsatruction.test.js.map +0 -1
  37. package/dist/__tests__/EditableGradingInstruction.test.d.ts +0 -2
  38. package/dist/__tests__/EditableGradingInstruction.test.d.ts.map +0 -1
  39. package/dist/__tests__/EditableGradingInstruction.test.js +0 -178
  40. package/dist/__tests__/EditableGradingInstruction.test.js.map +0 -1
  41. package/dist/__tests__/FormatButton.test.d.ts +0 -2
  42. package/dist/__tests__/FormatButton.test.d.ts.map +0 -1
  43. package/dist/__tests__/FormatButton.test.js +0 -94
  44. package/dist/__tests__/FormatButton.test.js.map +0 -1
  45. package/dist/__tests__/editor/Formula.test.d.ts +0 -2
  46. package/dist/__tests__/editor/Formula.test.d.ts.map +0 -1
  47. package/dist/__tests__/editor/Formula.test.js +0 -53
  48. package/dist/__tests__/editor/Formula.test.js.map +0 -1
  49. package/dist/__tests__/utils/ProseMirrorWrapper.d.ts +0 -8
  50. package/dist/__tests__/utils/ProseMirrorWrapper.d.ts.map +0 -1
  51. package/dist/__tests__/utils/ProseMirrorWrapper.js +0 -44
  52. package/dist/__tests__/utils/ProseMirrorWrapper.js.map +0 -1
  53. package/dist/__tests__/utils/prosemirror.d.ts +0 -3
  54. package/dist/__tests__/utils/prosemirror.d.ts.map +0 -1
  55. package/dist/__tests__/utils/prosemirror.js +0 -38
  56. package/dist/__tests__/utils/prosemirror.js.map +0 -1
  57. package/dist/components/LexicalEditor.d.ts +0 -3
  58. package/dist/components/LexicalEditor.d.ts.map +0 -1
  59. package/dist/components/LexicalEditor.js +0 -44
  60. package/dist/components/LexicalEditor.js.map +0 -1
  61. package/dist/components/RTE.d.ts +0 -3
  62. package/dist/components/RTE.d.ts.map +0 -1
  63. package/dist/components/RTE.js +0 -23
  64. package/dist/components/RTE.js.map +0 -1
  65. package/dist/components/TablePlugin.d.ts +0 -1
  66. package/dist/components/TablePlugin.d.ts.map +0 -1
  67. package/dist/components/TablePlugin.js +0 -2
  68. package/dist/components/TablePlugin.js.map +0 -1
  69. package/dist/components/ToolBarPlugin.d.ts +0 -10
  70. package/dist/components/ToolBarPlugin.d.ts.map +0 -1
  71. package/dist/components/ToolBarPlugin.js +0 -111
  72. package/dist/components/ToolBarPlugin.js.map +0 -1
  73. package/dist/components/context/AnnotationContext.d.ts +0 -8
  74. package/dist/components/context/AnnotationContext.d.ts.map +0 -1
  75. package/dist/components/context/AnnotationContext.js +0 -3
  76. package/dist/components/context/AnnotationContext.js.map +0 -1
  77. package/dist/components/exam/ExamineExam.d.ts +0 -5
  78. package/dist/components/exam/ExamineExam.d.ts.map +0 -1
  79. package/dist/components/exam/ExamineExam.js +0 -20
  80. package/dist/components/exam/ExamineExam.js.map +0 -1
  81. package/dist/components/exam/FinishExam.d.ts +0 -5
  82. package/dist/components/exam/FinishExam.d.ts.map +0 -1
  83. package/dist/components/exam/FinishExam.js +0 -17
  84. package/dist/components/exam/FinishExam.js.map +0 -1
  85. package/dist/components/grading/reactAnnotation.d.ts +0 -4
  86. package/dist/components/grading/reactAnnotation.d.ts.map +0 -1
  87. package/dist/components/grading/reactAnnotation.js +0 -54
  88. package/dist/components/grading/reactAnnotation.js.map +0 -1
  89. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts +0 -6
  90. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +0 -1
  91. package/dist/components/grading-instructions/EditableGradingInstruction.js +0 -53
  92. package/dist/components/grading-instructions/EditableGradingInstruction.js.map +0 -1
  93. package/dist/components/grading-instructions/SlateTableEditor.d.ts +0 -22
  94. package/dist/components/grading-instructions/SlateTableEditor.d.ts.map +0 -1
  95. package/dist/components/grading-instructions/SlateTableEditor.js +0 -44
  96. package/dist/components/grading-instructions/SlateTableEditor.js.map +0 -1
  97. package/dist/components/grading-instructions/SlateUtils.d.ts +0 -5
  98. package/dist/components/grading-instructions/SlateUtils.d.ts.map +0 -1
  99. package/dist/components/grading-instructions/SlateUtils.js +0 -28
  100. package/dist/components/grading-instructions/SlateUtils.js.map +0 -1
  101. package/dist/components/grading-instructions/editor/FormatButton.d.ts +0 -8
  102. package/dist/components/grading-instructions/editor/FormatButton.d.ts.map +0 -1
  103. package/dist/components/grading-instructions/editor/FormatButton.js +0 -23
  104. package/dist/components/grading-instructions/editor/FormatButton.js.map +0 -1
  105. package/dist/components/grading-instructions/editor/Formula.d.ts +0 -17
  106. package/dist/components/grading-instructions/editor/Formula.d.ts.map +0 -1
  107. package/dist/components/grading-instructions/editor/Formula.js +0 -81
  108. package/dist/components/grading-instructions/editor/Formula.js.map +0 -1
  109. package/dist/components/grading-instructions/editor/FormulaPopup.d.ts +0 -7
  110. package/dist/components/grading-instructions/editor/FormulaPopup.d.ts.map +0 -1
  111. package/dist/components/grading-instructions/editor/FormulaPopup.js +0 -49
  112. package/dist/components/grading-instructions/editor/FormulaPopup.js.map +0 -1
  113. package/dist/components/grading-instructions/editor/MathPopup.d.ts +0 -10
  114. package/dist/components/grading-instructions/editor/MathPopup.d.ts.map +0 -1
  115. package/dist/components/grading-instructions/editor/MathPopup.js +0 -94
  116. package/dist/components/grading-instructions/editor/MathPopup.js.map +0 -1
  117. package/dist/components/grading-instructions/editor/Table.d.ts +0 -5
  118. package/dist/components/grading-instructions/editor/Table.d.ts.map +0 -1
  119. package/dist/components/grading-instructions/editor/Table.js +0 -181
  120. package/dist/components/grading-instructions/editor/Table.js.map +0 -1
  121. package/dist/components/grading-instructions/editor/math-svg.d.ts +0 -2
  122. package/dist/components/grading-instructions/editor/math-svg.d.ts.map +0 -1
  123. package/dist/components/grading-instructions/editor/math-svg.js +0 -22
  124. package/dist/components/grading-instructions/editor/math-svg.js.map +0 -1
  125. package/dist/components/grading-instructions/editor/math.d.ts +0 -4
  126. package/dist/components/grading-instructions/editor/math.d.ts.map +0 -1
  127. package/dist/components/grading-instructions/editor/math.js +0 -55
  128. package/dist/components/grading-instructions/editor/math.js.map +0 -1
  129. package/dist/components/grading-instructions/prosemirror.d.ts +0 -8
  130. package/dist/components/grading-instructions/prosemirror.d.ts.map +0 -1
  131. package/dist/components/grading-instructions/prosemirror.js +0 -108
  132. package/dist/components/grading-instructions/prosemirror.js.map +0 -1
  133. package/dist/components/results/isExamFinishPageHook.d.ts +0 -2
  134. package/dist/components/results/isExamFinishPageHook.d.ts.map +0 -1
  135. package/dist/components/results/isExamFinishPageHook.js +0 -7
  136. package/dist/components/results/isExamFinishPageHook.js.map +0 -1
  137. package/dist/components/shared/CreateAnnotationPopup.d.ts +0 -6
  138. package/dist/components/shared/CreateAnnotationPopup.d.ts.map +0 -1
  139. package/dist/components/shared/CreateAnnotationPopup.js +0 -11
  140. package/dist/components/shared/CreateAnnotationPopup.js.map +0 -1
  141. package/dist/components/shared/PopupUtils.d.ts +0 -4
  142. package/dist/components/shared/PopupUtils.d.ts.map +0 -1
  143. package/dist/components/shared/PopupUtils.js +0 -26
  144. package/dist/components/shared/PopupUtils.js.map +0 -1
  145. package/dist/store/listenerMiddleware.d.ts +0 -89
  146. package/dist/store/listenerMiddleware.d.ts.map +0 -1
  147. package/dist/store/listenerMiddleware.js +0 -6
  148. package/dist/store/listenerMiddleware.js.map +0 -1
@@ -1,178 +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
- const react_1 = __importDefault(require("react"));
7
- const react_2 = require("@testing-library/react");
8
- const EditableGradingInstruction_1 = __importDefault(require("../src/components/grading-instructions/EditableGradingInstruction"));
9
- const GradingInstructionProvider_1 = require("../src/components/grading-instructions/GradingInstructionProvider");
10
- const user_event_1 = __importDefault(require("@testing-library/user-event"));
11
- const act = react_2.act;
12
- describe('EditableGradingInstruction', () => {
13
- let cleanup;
14
- let onContentChangeMock;
15
- beforeEach(() => {
16
- onContentChangeMock = jest.fn();
17
- });
18
- afterEach(() => {
19
- if (cleanup) {
20
- cleanup();
21
- }
22
- cleanup = null;
23
- });
24
- describe('table', () => {
25
- it('Table is rendered as expected', () => {
26
- const inputData = '<table class="e-table"><tr><td>foo</td></tr></table>';
27
- const expectedOutput = '<table class="e-table"><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
28
- const result = renderGradinginstruction(inputData);
29
- const table = result.container.querySelector('.ProseMirror');
30
- expect(table.innerHTML).toBe(expectedOutput);
31
- });
32
- it('Change in table is returned as expected', async () => {
33
- cleanup = mockCreateRange();
34
- const inputData = '<table class="e-table"><tr><td>foo</td></tr></table>';
35
- const expectedOutput = '<table class="e-table"><tbody><tr><td><p>bar</p></td></tr></tbody></table>';
36
- const result = renderGradinginstruction(inputData, onContentChangeMock);
37
- await act(async () => {
38
- insertText(await result.findByText('foo'), 'bar');
39
- });
40
- expect(onContentChangeMock).toHaveBeenCalledTimes(1);
41
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
42
- });
43
- it('Insert table adds expected table', async () => {
44
- const inputData = '';
45
- const expectedOutput = '<table class="e-table e-width-half"><tbody><tr><td><p></p></td><td><p></p></td></tr><tr><td><p></p></td><td><p></p></td></tr></tbody></table>';
46
- const result = renderGradinginstruction(inputData, onContentChangeMock);
47
- await act(async () => {
48
- await user_event_1.default.click(await result.findByText('Lisää taulukko'));
49
- });
50
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
51
- });
52
- it('Remove table removes table', async () => {
53
- const inputData = '<table><tr><td>foo</td></tr></table>';
54
- const expectedOutput = '<p></p>';
55
- const result = renderGradinginstruction(inputData, onContentChangeMock);
56
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista taulukko');
57
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
58
- });
59
- it('Insert column adds column', async () => {
60
- const inputData = '<table><tr><td>foo</td></tr></table>';
61
- const expectedOutput = '<table><tbody><tr><td><p>foo</p></td><td><p></p></td></tr></tbody></table>';
62
- const result = renderGradinginstruction(inputData, onContentChangeMock);
63
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää sarake');
64
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
65
- });
66
- it('Remove column removes column', async () => {
67
- const inputData = '<table><tr><td>foo</td><td>bar</td></tr></table>';
68
- const expectedOutput = '<table><tbody><tr><td><p>bar</p></td></tr></tbody></table>';
69
- const result = renderGradinginstruction(inputData, onContentChangeMock);
70
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista sarake');
71
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
72
- });
73
- it('Insert row adds row', async () => {
74
- const inputData = '<table><tr><td>foo</td></tr></table>';
75
- const expectedOutput = '<table><tbody><tr><td><p>foo</p></td></tr><tr><td><p></p></td></tr></tbody></table>';
76
- const result = renderGradinginstruction(inputData, onContentChangeMock);
77
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää rivi');
78
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
79
- });
80
- it('Remove row removes row', async () => {
81
- const inputData = '<table><tr><td>foo</td></tr><tr><td>bar</td></tr></table>';
82
- const expectedOutput = '<table><tbody><tr><td><p>bar</p></td></tr></tbody></table>';
83
- const result = renderGradinginstruction(inputData, onContentChangeMock);
84
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista rivi');
85
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
86
- });
87
- it('Full width changes full width class to table', async () => {
88
- const inputData = '<table class="e-width-half"><tr><td>foo</td></tr></table>';
89
- const expectedOutput = '<table class="e-width-full"><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
90
- const result = renderGradinginstruction(inputData, onContentChangeMock);
91
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Täysi leveys');
92
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
93
- });
94
- it('Half width changes half width class to table', async () => {
95
- const inputData = '<table class="e-width-full"><tr><td>foo</td></tr></table>';
96
- const expectedOutput = '<table class="e-width-half"><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
97
- const result = renderGradinginstruction(inputData, onContentChangeMock);
98
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Puolikas leveys');
99
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
100
- });
101
- it('Remove borders adds e-table--borderless class to table', async () => {
102
- const inputData = '<table><tr><td>foo</td></tr></table>';
103
- const expectedOutput = '<table class="e-table--borderless"><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
104
- const result = renderGradinginstruction(inputData, onContentChangeMock);
105
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista reunat');
106
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
107
- });
108
- it('Add borders removes e-table--borderless class from table', async () => {
109
- const inputData = '<table class="e-table--borderless"><tr><td>foo</td></tr></table>';
110
- const expectedOutput = '<table><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
111
- const result = renderGradinginstruction(inputData, onContentChangeMock);
112
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää reunat');
113
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
114
- });
115
- it('Remove zebra removes class from table', async () => {
116
- const inputData = '<table class="e-table--zebra"><tr><td>foo</td></tr></table>';
117
- const expectedOutput = '<table><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
118
- const result = renderGradinginstruction(inputData, onContentChangeMock);
119
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista kuviointi');
120
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
121
- });
122
- it('Add zebra adds e-table--zebra class to table', async () => {
123
- const inputData = '<table><tr><td>foo</td></tr></table>';
124
- const expectedOutput = '<table class="e-table--zebra"><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
125
- const result = renderGradinginstruction(inputData, onContentChangeMock);
126
- await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää kuviointi');
127
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
128
- });
129
- });
130
- });
131
- async function clickTableMenuButtonWithFocusOnCell(result, cellText, buttonText) {
132
- await act(async () => {
133
- await focusOnTablesCell(result, cellText);
134
- await user_event_1.default.click(await result.findByText(buttonText));
135
- });
136
- }
137
- async function focusOnTablesCell(result, text) {
138
- // Replace cell's text with same text
139
- // Hack to get focus on cell without need to mock createRange
140
- insertText(await result.findByText(text), text);
141
- }
142
- function insertText(element, text) {
143
- react_2.fireEvent.input(element, {
144
- target: { innerText: text, innerHTML: text }
145
- });
146
- }
147
- function renderGradinginstruction(inputData, onContentChangeMock = () => { }) {
148
- const doc = new DOMParser().parseFromString(inputData, 'text/html');
149
- return (0, react_2.render)(react_1.default.createElement(GradingInstructionProvider_1.GradingInstructionProvider, { editable: true, onContentChange: onContentChangeMock, saveScreenshot: () => Promise.resolve('') },
150
- react_1.default.createElement(EditableGradingInstruction_1.default, { element: doc.documentElement })));
151
- }
152
- function mockCreateRange() {
153
- const originalCreateRange = global.window.document.createRange;
154
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
155
- // @ts-expect-error
156
- global.Range = function Range() { };
157
- const createContextualFragment = (html) => {
158
- const div = document.createElement('div');
159
- div.innerHTML = html;
160
- return div.children[0];
161
- };
162
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
163
- // @ts-expect-error
164
- Range.prototype.createContextualFragment = (html) => createContextualFragment(html);
165
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
166
- // @ts-expect-error
167
- global.window.document.createRange = function createRange() {
168
- return {
169
- setEnd: () => { },
170
- setStart: () => { },
171
- getBoundingClientRect: () => ({ right: 0 }),
172
- getClientRects: () => [],
173
- createContextualFragment
174
- };
175
- };
176
- return () => (global.window.document.createRange = originalCreateRange);
177
- }
178
- //# sourceMappingURL=EditableGradingInstruction.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditableGradingInstruction.test.js","sourceRoot":"","sources":["../../__tests__/EditableGradingInstruction.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,kDAAwF;AACxF,mIAA0G;AAC1G,kHAA8G;AAC9G,6EAAmD;AAEnD,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,mBAAmB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,EAAE,CAAA;QACX,CAAC;QACD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;YACvC,MAAM,SAAS,GAAG,sDAAsD,CAAA;YACxE,MAAM,cAAc,GAAG,4EAA4E,CAAA;YACnG,MAAM,MAAM,GAAG,wBAAwB,CAAC,SAAS,CAAC,CAAA;YAClD,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;YAC5D,MAAM,CAAC,KAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QAC/C,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;YACvD,OAAO,GAAG,eAAe,EAAE,CAAA;YAC3B,MAAM,SAAS,GAAG,sDAAsD,CAAA;YACxE,MAAM,cAAc,GAAG,4EAA4E,CAAA;YACnG,MAAM,MAAM,GAAG,wBAAwB,CAAC,SAAS,EAAE,mBAAm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Q,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 +0,0 @@
1
- import '@testing-library/jest-dom';
2
- //# sourceMappingURL=FormatButton.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormatButton.test.d.ts","sourceRoot":"","sources":["../../__tests__/FormatButton.test.tsx"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAA"}
@@ -1,94 +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
- const react_1 = __importDefault(require("react"));
7
- require("@testing-library/jest-dom");
8
- const react_2 = require("@testing-library/react");
9
- const ProseMirrorWrapper_1 = __importDefault(require("./utils/ProseMirrorWrapper"));
10
- const prosemirror_1 = require("./utils/prosemirror");
11
- const FormatButton_1 = __importDefault(require("../src/components/grading-instructions/editor/FormatButton"));
12
- const user_event_1 = __importDefault(require("@testing-library/user-event"));
13
- const act = react_2.act;
14
- describe('FormatButton', () => {
15
- beforeAll(() => {
16
- (0, prosemirror_1.mockCreateRange)();
17
- });
18
- afterEach(() => {
19
- (0, react_2.cleanup)();
20
- });
21
- describe('Italics', () => {
22
- it('Renders italics button', () => {
23
- const props = { markName: 'em', displayName: 'Italic' };
24
- const { button } = renderEditorWithFormatButton(props);
25
- expect(button).toHaveTextContent(props.displayName);
26
- });
27
- it('Toggles button active state when clicked', async () => {
28
- const props = { markName: 'em', displayName: 'Italic' };
29
- const { button } = renderEditorWithFormatButton(props);
30
- expect(button).toHaveStyle('font-weight: normal');
31
- await user_event_1.default.click(button);
32
- expect(button).toHaveStyle('font-weight: bold');
33
- await user_event_1.default.click(button);
34
- expect(button).toHaveStyle('font-weight: normal');
35
- });
36
- it('formats text', async () => {
37
- const props = { markName: 'em', displayName: 'Italic' };
38
- const { button, paragraph } = renderEditorWithFormatButton(props);
39
- await user_event_1.default.click(button);
40
- await act(async () => await (0, prosemirror_1.promisifiedFireEventInput)(paragraph, { target: { innerHTML: 'hello' } }));
41
- expect((0, react_2.within)(paragraph).getByRole('emphasis')).toHaveTextContent('hello');
42
- });
43
- it('em tags are rendered as italic', () => {
44
- const props = { markName: 'em', displayName: 'Italic', innerHtml: '<em>Italic text</em>' };
45
- const { paragraph } = renderEditorWithFormatButton(props);
46
- expect((0, react_2.within)(paragraph).getByRole('emphasis')).toHaveTextContent('Italic text');
47
- });
48
- it('i tags are rendered as italic', () => {
49
- const props = { markName: 'em', displayName: 'Italic', innerHtml: '<i>Italic text</i>' };
50
- const { paragraph } = renderEditorWithFormatButton(props);
51
- expect((0, react_2.within)(paragraph).getByRole('emphasis')).toHaveTextContent('Italic text');
52
- });
53
- });
54
- describe('Bold', () => {
55
- it('Renders bold button', () => {
56
- const props = { markName: 'strong', displayName: 'Bold' };
57
- const { button } = renderEditorWithFormatButton(props);
58
- expect(button).toHaveTextContent(props.displayName);
59
- });
60
- it('Toggles button active state when clicked', async () => {
61
- const props = { markName: 'strong', displayName: 'Bold' };
62
- const { button } = renderEditorWithFormatButton(props);
63
- expect(button).toHaveStyle('font-weight: normal');
64
- await user_event_1.default.click(button);
65
- expect(button).toHaveStyle('font-weight: bold');
66
- await user_event_1.default.click(button);
67
- expect(button).toHaveStyle('font-weight: normal');
68
- });
69
- it('formats text', async () => {
70
- const props = { markName: 'strong', displayName: 'Bold' };
71
- const { button, paragraph } = renderEditorWithFormatButton(props);
72
- await user_event_1.default.click(button);
73
- await act(async () => await (0, prosemirror_1.promisifiedFireEventInput)(paragraph, { target: { innerHTML: 'hello' } }));
74
- expect((0, react_2.within)(paragraph).getByRole('strong')).toHaveTextContent('hello');
75
- });
76
- it('b tags are rendered as bold', () => {
77
- const props = { markName: 'strong', displayName: 'bold', innerHtml: '<b>Bold text</b>' };
78
- const { paragraph } = renderEditorWithFormatButton(props);
79
- expect((0, react_2.within)(paragraph).getByRole('strong')).toHaveTextContent('Bold text');
80
- });
81
- it('strong tags are rendered as bold', () => {
82
- const props = { markName: 'strong', displayName: 'bold', innerHtml: '<strong>Bold text</strong>' };
83
- const { paragraph } = renderEditorWithFormatButton(props);
84
- expect((0, react_2.within)(paragraph).getByRole('strong')).toHaveTextContent('Bold text');
85
- });
86
- });
87
- function renderEditorWithFormatButton(props) {
88
- const { markName, displayName, innerHtml = '' } = props;
89
- const { getByRole } = (0, react_2.render)(react_1.default.createElement(ProseMirrorWrapper_1.default, { innerHtml: innerHtml },
90
- react_1.default.createElement(FormatButton_1.default, { markName: markName, displayName: displayName })));
91
- return { button: getByRole('button'), paragraph: getByRole('paragraph') };
92
- }
93
- });
94
- //# sourceMappingURL=FormatButton.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormatButton.test.js","sourceRoot":"","sources":["../../__tests__/FormatButton.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,qCAAkC;AAClC,kDAAgF;AAChF,oFAA2D;AAC3D,qDAAgF;AAChF,8GAAqF;AACrF,6EAAmD;AAEnD,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,SAAS,CAAC,GAAG,EAAE;QACb,IAAA,6BAAe,GAAE,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAA,eAAO,GAAE,CAAA;IACX,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;QACvB,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;YAChC,MAAM,KAAK,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAA;YACvD,MAAM,EAAE,MAAM,EAAE,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAA;YACtD,MAAM,CAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QACrD,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,0CAA0C,EAAE,KAAK,IAAI,EAAE;YACxD,MAAM,KAAK,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAA;YACvD,MAAM,EAAE,MAAM,EAAE,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAA;YAEtD,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAA;YAEjD,MAAM,oBAAS,CAAC,KAAK,CAAC,MAA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A,cAAM,EAAC,SAAS,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAA;QAC9E,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,SAAS,4BAA4B,CAAC,KAAoE;QACxG,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,KAAK,CAAA;QACvD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,cAAM,EAC1B,8BAAC,4BAAkB,IAAC,SAAS,EAAE,SAAS;YACtC,8BAAC,sBAAY,IAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAI,CAC3C,CACtB,CAAA;QACD,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,CAAA;IAC3E,CAAC;AACH,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Formula.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Formula.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/Formula.test.tsx"],"names":[],"mappings":""}
@@ -1,53 +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
- const react_1 = __importDefault(require("react"));
7
- const react_2 = require("@testing-library/react");
8
- const EditableGradingInstruction_1 = __importDefault(require("../../src/components/grading-instructions/EditableGradingInstruction"));
9
- const GradingInstructionProvider_1 = require("../../src/components/grading-instructions/GradingInstructionProvider");
10
- const prosemirror_1 = require("../utils/prosemirror");
11
- const act = react_2.act;
12
- describe('Editor - Formula', () => {
13
- let cleanup;
14
- let onContentChangeMock;
15
- beforeEach(() => {
16
- onContentChangeMock = jest.fn();
17
- });
18
- afterEach(() => {
19
- if (cleanup) {
20
- cleanup();
21
- }
22
- cleanup = null;
23
- });
24
- it('Formula is rendered as expected', () => {
25
- const inputData = '<p>bar <e:formula data-editor-id="e-formula">foo</e:formula></p>';
26
- const expectedOutput = '<p>bar <img alt="foo" src="/math.svg?latex=foo"><img class="ProseMirror-separator" alt=""><br class="ProseMirror-trailingBreak"></p>';
27
- const result = renderGradinginstruction(inputData);
28
- const table = result.container.querySelector('.ProseMirror');
29
- expect(table.innerHTML).toBe(expectedOutput);
30
- });
31
- it('Change in content causes formula to be returned as expected', async () => {
32
- cleanup = (0, prosemirror_1.mockCreateRange)();
33
- const inputData = '<p>bar</p><p><e:formula data-editor-id="e-formula" mode="inline">foo</e:formula></p>';
34
- const expectedOutput = '<p>foo</p><p><e:formula mode="inline">foo</e:formula></p>';
35
- const result = renderGradinginstruction(inputData, onContentChangeMock);
36
- await act(async () => {
37
- insertText(await result.findByText('bar'), 'foo');
38
- });
39
- expect(onContentChangeMock).toHaveBeenCalledTimes(1);
40
- expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
41
- });
42
- });
43
- function insertText(element, text) {
44
- react_2.fireEvent.input(element, {
45
- target: { innerText: text, innerHTML: text }
46
- });
47
- }
48
- function renderGradinginstruction(inputData, onContentChangeMock = () => { }) {
49
- const doc = new DOMParser().parseFromString(inputData, 'text/html');
50
- return (0, react_2.render)(react_1.default.createElement(GradingInstructionProvider_1.GradingInstructionProvider, { editable: true, onContentChange: onContentChangeMock, saveScreenshot: () => Promise.resolve('') },
51
- react_1.default.createElement(EditableGradingInstruction_1.default, { element: doc.documentElement })));
52
- }
53
- //# sourceMappingURL=Formula.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Formula.test.js","sourceRoot":"","sources":["../../../__tests__/editor/Formula.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,kDAA0E;AAC1E,sIAA6G;AAC7G,qHAAiH;AACjH,sDAAsD;AAEtD,MAAM,GAAG,GAAG,WAA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AAC,cAAc,EAAE,EAAE,CAAC,CAAA;IACtE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,SAAS,UAAU,CAAC,OAAoB,EAAE,IAAY;IACpD,iBAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QACvB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;KAC7C,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,SAAiB,EAAE,mBAAmB,GAAG,GAAG,EAAE,GAAE,CAAC;IACjF,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,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":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAkD;AAClD,kEAAwD;AACxD,uEAAiD;AACjD,yDAA+D;AAC/D,yDAA+C;AAO/C,MAAM,kBAAkB,GAA2B,CAAC,EAAE,QAAQ,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE,EAAE;IAClF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAqB,IAAI,CAAC,CAAA;IAC5D,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IAC/C,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;IAC/B,MAAM,GAAG,GAAG,6BAAc,CAAC,UAAU,CAAC,iCAAM,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IAC9D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,+BAAW,CAAC,MAAM,CAAC,EAAE,MAAM,EAAN,iCAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;IAEvE,OAAO,CACL,8BAAC,+BAAW,IACV,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,mBAAmB,EAAE,EAAE,CAAC,EAAE;YACxB,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;QAC5B,CAAC;QAED,uCAAK,GAAG,EAAE,QAAQ,GAAI;QACrB,QAAQ,CACG,CACf,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,kBAAkB,CAAA"}
@@ -1,3 +0,0 @@
1
- export declare function mockCreateRange(): () => () => Range;
2
- export declare function promisifiedFireEventInput(element: Element, options: object): Promise<void>;
3
- //# sourceMappingURL=prosemirror.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prosemirror.d.ts","sourceRoot":"","sources":["../../../__tests__/utils/prosemirror.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,sBA2B9B;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAK1E"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- 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,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AACJ,CAAC"}
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare function LexicalEditor(): React.JSX.Element;
3
- //# sourceMappingURL=LexicalEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../src/components/LexicalEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAsCzB,wBAAgB,aAAa,sBAiB5B"}
@@ -1,44 +0,0 @@
1
- import React from 'react';
2
- import { LexicalComposer } from '@lexical/react/LexicalComposer';
3
- import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
4
- import { ContentEditable } from '@lexical/react/LexicalContentEditable';
5
- import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
6
- import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
7
- import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
8
- import { ToolbarPlugin } from './ToolBarPlugin';
9
- import { TablePlugin } from '@lexical/react/LexicalTablePlugin';
10
- import { ListPlugin } from '@lexical/react/LexicalListPlugin';
11
- import { TableCellNode, TableNode, TableRowNode } from '@lexical/table';
12
- import { ListNode, ListItemNode } from '@lexical/list';
13
- const theme = {
14
- // Add your custom styling here
15
- ltr: 'ltr',
16
- rtl: 'rtl',
17
- placeholder: 'editor-placeholder',
18
- paragraph: 'editor-paragraph'
19
- };
20
- function Placeholder() {
21
- return React.createElement("div", { className: "editor-placeholder" }, "Enter some text...");
22
- }
23
- function onChange(editorState) {
24
- console.log(editorState);
25
- }
26
- const initialConfig = {
27
- namespace: 'MyEditor',
28
- theme,
29
- onError(error) {
30
- throw error;
31
- },
32
- nodes: [TableCellNode, TableNode, TableRowNode, ListNode, ListItemNode]
33
- };
34
- export function LexicalEditor() {
35
- return (React.createElement(LexicalComposer, { initialConfig: initialConfig },
36
- React.createElement(ToolbarPlugin, null),
37
- React.createElement(TablePlugin, null),
38
- React.createElement(ListPlugin, null),
39
- React.createElement("div", { className: "editor-container" },
40
- React.createElement(RichTextPlugin, { contentEditable: React.createElement(ContentEditable, { className: "editor-input" }), placeholder: React.createElement(Placeholder, null), ErrorBoundary: LexicalErrorBoundary }),
41
- React.createElement(HistoryPlugin, null),
42
- React.createElement(OnChangePlugin, { onChange: onChange }))));
43
- }
44
- //# sourceMappingURL=LexicalEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LexicalEditor.js","sourceRoot":"","sources":["../../src/components/LexicalEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,KAAK,GAAG;IACZ,+BAA+B;IAC/B,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,WAAW,EAAE,oBAAoB;IACjC,SAAS,EAAE,kBAAkB;CAC9B,CAAA;AAED,SAAS,WAAW;IAClB,OAAO,6BAAK,SAAS,EAAC,oBAAoB,yBAAyB,CAAA;AACrE,CAAC;AAED,SAAS,QAAQ,CAAC,WAAmB;IACnC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AAC1B,CAAC;AAED,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,UAAU;IACrB,KAAK;IACL,OAAO,CAAC,KAAY;QAClB,MAAM,KAAK,CAAA;IACb,CAAC;IACD,KAAK,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,CAAC;CACxE,CAAA;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,CACL,oBAAC,eAAe,IAAC,aAAa,EAAE,aAAa;QAC3C,oBAAC,aAAa,OAAG;QACjB,oBAAC,WAAW,OAAG;QACf,oBAAC,UAAU,OAAG;QACd,6BAAK,SAAS,EAAC,kBAAkB;YAC/B,oBAAC,cAAc,IACb,eAAe,EAAE,oBAAC,eAAe,IAAC,SAAS,EAAC,cAAc,GAAG,EAC7D,WAAW,EAAE,oBAAC,WAAW,OAAG,EAC5B,aAAa,EAAE,oBAAoB,GACnC;YACF,oBAAC,aAAa,OAAG;YACjB,oBAAC,cAAc,IAAC,QAAQ,EAAE,QAAQ,GAAI,CAClC,CACU,CACnB,CAAA;AACH,CAAC"}
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const RichTextEditor: () => React.JSX.Element;
3
- //# sourceMappingURL=RTE.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RTE.d.ts","sourceRoot":"","sources":["../../src/components/RTE.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAA;AAErC,eAAO,MAAM,cAAc,yBAmC1B,CAAA"}
@@ -1,23 +0,0 @@
1
- import React, { useRef } from 'react';
2
- export const RichTextEditor = () => {
3
- const editorRef = useRef(null);
4
- const handleBoldText = () => {
5
- document.queryCommandState('bold');
6
- const selection = window.getSelection();
7
- console.log(selection);
8
- if (editorRef.current) {
9
- editorRef.current.focus();
10
- }
11
- };
12
- return (React.createElement("div", null,
13
- React.createElement("div", { style: { marginBottom: '10px' } },
14
- React.createElement("button", { onClick: handleBoldText },
15
- React.createElement("b", null, "B"))),
16
- React.createElement("div", { ref: editorRef, contentEditable: true, style: {
17
- border: '1px solid #ccc',
18
- minHeight: '200px',
19
- padding: '10px',
20
- fontFamily: 'Arial'
21
- } }, "Start editing this text...")));
22
- };
23
- //# sourceMappingURL=RTE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RTE.js","sourceRoot":"","sources":["../../src/components/RTE.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAErC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAE9C,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,QAAQ,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;QAClC,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,EAAE,CAAA;QACvC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QACtB,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;QAC3B,CAAC;IACH,CAAC,CAAA;IAED,OAAO,CACL;QACE,6BAAK,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE;YAClC,gCAAQ,OAAO,EAAE,cAAc;gBAC7B,mCAAQ,CACD,CAEL;QACN,6BACE,GAAG,EAAE,SAAS,EACd,eAAe,EAAE,IAAI,EACrB,KAAK,EAAE;gBACL,MAAM,EAAE,gBAAgB;gBACxB,SAAS,EAAE,OAAO;gBAClB,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,OAAO;aACpB,iCAIG,CACF,CACP,CAAA;AACH,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=TablePlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TablePlugin.d.ts","sourceRoot":"","sources":["../../src/components/TablePlugin.tsx"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=TablePlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TablePlugin.js","sourceRoot":"","sources":["../../src/components/TablePlugin.tsx"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- import React from 'react';
9
- export declare function ToolbarPlugin(): React.JSX.Element;
10
- //# sourceMappingURL=ToolBarPlugin.d.ts.map