@digabi/exam-engine-core 22.0.1 → 22.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/dist/__tests__/EditableGradingInstruction.test.js +26 -26
  2. package/dist/__tests__/EditableGradingInstruction.test.js.map +1 -1
  3. package/dist/__tests__/editor/no-wrap.test.d.ts +2 -0
  4. package/dist/__tests__/editor/no-wrap.test.d.ts.map +1 -0
  5. package/dist/__tests__/editor/no-wrap.test.js +43 -0
  6. package/dist/__tests__/editor/no-wrap.test.js.map +1 -0
  7. package/dist/__tests__/editor/noWrap.test.d.ts +2 -0
  8. package/dist/__tests__/editor/noWrap.test.d.ts.map +1 -0
  9. package/dist/__tests__/editor/noWrap.test.js +62 -0
  10. package/dist/__tests__/editor/noWrap.test.js.map +1 -0
  11. package/dist/components/grading-instructions/EditableGradingInstruction.d.ts.map +1 -1
  12. package/dist/components/grading-instructions/EditableGradingInstruction.js +36 -10
  13. package/dist/components/grading-instructions/EditableGradingInstruction.js.map +1 -1
  14. package/dist/components/grading-instructions/editor/FormatButton.d.ts +4 -2
  15. package/dist/components/grading-instructions/editor/FormatButton.d.ts.map +1 -1
  16. package/dist/components/grading-instructions/editor/FormatButton.js +5 -2
  17. package/dist/components/grading-instructions/editor/FormatButton.js.map +1 -1
  18. package/dist/components/grading-instructions/editor/Formula.js +1 -1
  19. package/dist/components/grading-instructions/editor/Formula.js.map +1 -1
  20. package/dist/components/grading-instructions/editor/Table.d.ts.map +1 -1
  21. package/dist/components/grading-instructions/editor/Table.js +25 -49
  22. package/dist/components/grading-instructions/editor/Table.js.map +1 -1
  23. package/dist/components/grading-instructions/editor/noWrap.d.ts +3 -0
  24. package/dist/components/grading-instructions/editor/noWrap.d.ts.map +1 -0
  25. package/dist/components/grading-instructions/editor/noWrap.js +13 -0
  26. package/dist/components/grading-instructions/editor/noWrap.js.map +1 -0
  27. package/dist/components/grading-instructions/editor/spanWithClass.d.ts +3 -0
  28. package/dist/components/grading-instructions/editor/spanWithClass.d.ts.map +1 -0
  29. package/dist/components/grading-instructions/editor/spanWithClass.js +19 -0
  30. package/dist/components/grading-instructions/editor/spanWithClass.js.map +1 -0
  31. package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts +3 -0
  32. package/dist/components/grading-instructions/editor/spanWithNowrap.d.ts.map +1 -0
  33. package/dist/components/grading-instructions/editor/spanWithNowrap.js +19 -0
  34. package/dist/components/grading-instructions/editor/spanWithNowrap.js.map +1 -0
  35. package/dist/main-bundle.js +1 -1
  36. package/dist/main.css +1 -1
  37. package/package.json +2 -2
@@ -21,16 +21,16 @@ describe('EditableGradingInstruction', () => {
21
21
  });
22
22
  describe('table', () => {
23
23
  it('Table is rendered as expected', () => {
24
- const inputData = '<table class="e-table"><tr><td>foo</td></tr></table>';
25
- const expectedOutput = '<table class="e-table"><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
24
+ const inputData = '<table class="e-table"><tbody><tr><td>foo</td></tr></tbody></table>';
25
+ const expectedOutput = '<table class="e-table"><tbody><tr><td>foo</td></tr></tbody></table>';
26
26
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
27
27
  const table = result.container.querySelector('.ProseMirror');
28
28
  expect(table.innerHTML).toBe(expectedOutput);
29
29
  });
30
30
  it('Change in table is returned as expected', async () => {
31
31
  cleanup = mockCreateRange();
32
- const inputData = '<table class="e-table"><tr><td>foo</td></tr></table>';
33
- const expectedOutput = '<table class="e-table"><tbody><tr><td><p>bar</p></td></tr></tbody></table>';
32
+ const inputData = '<table class="e-table"><tbody><tr><td>foo</td></tr></tbody></table>';
33
+ const expectedOutput = '<table class="e-table"><tbody><tr><td>bar</td></tr></tbody></table>';
34
34
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
35
35
  await act(async () => {
36
36
  insertText(await result.findByText('foo'), 'bar');
@@ -40,7 +40,7 @@ describe('EditableGradingInstruction', () => {
40
40
  });
41
41
  it('Insert table adds expected table', async () => {
42
42
  const inputData = '';
43
- 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>';
43
+ const expectedOutput = '<table class="e-table e-width-half"><tbody><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table>';
44
44
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
45
45
  await act(async () => {
46
46
  await user_event_1.default.click(await result.findByText('Lisää taulukko'));
@@ -48,78 +48,78 @@ describe('EditableGradingInstruction', () => {
48
48
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
49
49
  });
50
50
  it('Remove table removes table', async () => {
51
- const inputData = '<table><tr><td>foo</td></tr></table>';
51
+ const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
52
52
  const expectedOutput = '<p></p>';
53
53
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
54
54
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista taulukko');
55
55
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
56
56
  });
57
57
  it('Insert column adds column', async () => {
58
- const inputData = '<table><tr><td>foo</td></tr></table>';
59
- const expectedOutput = '<table><tbody><tr><td><p>foo</p></td><td><p></p></td></tr></tbody></table>';
58
+ const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
59
+ const expectedOutput = '<table><tbody><tr><td>foo</td><td></td></tr></tbody></table>';
60
60
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
61
61
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää sarake');
62
62
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
63
63
  });
64
64
  it('Remove column removes column', async () => {
65
- const inputData = '<table><tr><td>foo</td><td>bar</td></tr></table>';
66
- const expectedOutput = '<table><tbody><tr><td><p>bar</p></td></tr></tbody></table>';
65
+ const inputData = '<table><tbody><tr><td>foo</td><td>bar</td></tr></tbody></table>';
66
+ const expectedOutput = '<table><tbody><tr><td>bar</td></tr></tbody></table>';
67
67
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
68
68
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista sarake');
69
69
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
70
70
  });
71
71
  it('Insert row adds row', async () => {
72
- const inputData = '<table><tr><td>foo</td></tr></table>';
73
- const expectedOutput = '<table><tbody><tr><td><p>foo</p></td></tr><tr><td><p></p></td></tr></tbody></table>';
72
+ const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
73
+ const expectedOutput = '<table><tbody><tr><td>foo</td></tr><tr><td></td></tr></tbody></table>';
74
74
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
75
75
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää rivi');
76
76
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
77
77
  });
78
78
  it('Remove row removes row', async () => {
79
- const inputData = '<table><tr><td>foo</td></tr><tr><td>bar</td></tr></table>';
80
- const expectedOutput = '<table><tbody><tr><td><p>bar</p></td></tr></tbody></table>';
79
+ const inputData = '<table><tbody><tr><td>foo</td></tr><tr><td>bar</td></tr></tbody></table>';
80
+ const expectedOutput = '<table><tbody><tr><td>bar</td></tr></tbody></table>';
81
81
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
82
82
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista rivi');
83
83
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
84
84
  });
85
85
  it('Full width changes full width class to table', async () => {
86
- const inputData = '<table class="e-width-half"><tr><td>foo</td></tr></table>';
87
- const expectedOutput = '<table class="e-width-full"><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
86
+ const inputData = '<table class="e-width-half"><tbody><tr><td>foo</td></tr></tbody></table>';
87
+ const expectedOutput = '<table class="e-width-full"><tbody><tr><td>foo</td></tr></tbody></table>';
88
88
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
89
89
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Täysi leveys');
90
90
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
91
91
  });
92
92
  it('Half width changes half width class to table', async () => {
93
- const inputData = '<table class="e-width-full"><tr><td>foo</td></tr></table>';
94
- const expectedOutput = '<table class="e-width-half"><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
93
+ const inputData = '<table class="e-width-full"><tbody><tr><td>foo</td></tr></tbody></table>';
94
+ const expectedOutput = '<table class="e-width-half"><tbody><tr><td>foo</td></tr></tbody></table>';
95
95
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
96
96
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Puolikas leveys');
97
97
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
98
98
  });
99
99
  it('Remove borders adds e-table--borderless class to table', async () => {
100
- const inputData = '<table><tr><td>foo</td></tr></table>';
101
- const expectedOutput = '<table class="e-table--borderless"><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
100
+ const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
101
+ const expectedOutput = '<table class="e-table--borderless"><tbody><tr><td>foo</td></tr></tbody></table>';
102
102
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
103
103
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista reunat');
104
104
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
105
105
  });
106
106
  it('Add borders removes e-table--borderless class from table', async () => {
107
- const inputData = '<table class="e-table--borderless"><tr><td>foo</td></tr></table>';
108
- const expectedOutput = '<table><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
107
+ const inputData = '<table class="e-table--borderless"><tbody><tr><td>foo</td></tr></tbody></table>';
108
+ const expectedOutput = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
109
109
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
110
110
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää reunat');
111
111
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
112
112
  });
113
113
  it('Remove zebra removes class from table', async () => {
114
- const inputData = '<table class="e-table--zebra"><tr><td>foo</td></tr></table>';
115
- const expectedOutput = '<table><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
114
+ const inputData = '<table class="e-table--zebra"><tbody><tr><td>foo</td></tr></tbody></table>';
115
+ const expectedOutput = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
116
116
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
117
117
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Poista kuviointi');
118
118
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
119
119
  });
120
120
  it('Add zebra adds e-table--zebra class to table', async () => {
121
- const inputData = '<table><tr><td>foo</td></tr></table>';
122
- const expectedOutput = '<table class="e-table--zebra"><tbody><tr><td><p>foo</p></td></tr></tbody></table>';
121
+ const inputData = '<table><tbody><tr><td>foo</td></tr></tbody></table>';
122
+ const expectedOutput = '<table class="e-table--zebra"><tbody><tr><td>foo</td></tr></tbody></table>';
123
123
  const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
124
124
  await clickTableMenuButtonWithFocusOnCell(result, 'foo', 'Lisää kuviointi');
125
125
  expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
@@ -1 +1 @@
1
- {"version":3,"file":"EditableGradingInstruction.test.js","sourceRoot":"","sources":["../../__tests__/EditableGradingInstruction.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAgF;AAChF,6EAAmD;AACnD,+FAAmF;AAEnF,M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AS,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
+ {"version":3,"file":"EditableGradingInstruction.test.js","sourceRoot":"","sources":["../../__tests__/EditableGradingInstruction.test.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAgF;AAChF,6EAAmD;AACnD,+FAAmF;AAEnF,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,qEAAqE,CAAA;YACvF,MAAM,cAAc,GAAG,qEAAqE,CAAA;YAC5F,MAAM,MAAM,GAAG,IAAA,2DAAwB,EAAC,SAAS,CAAC,CAAA;YAClD,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;YA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9D,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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=no-wrap.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-wrap.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/no-wrap.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const prosemirror_1 = require("../utils/prosemirror");
5
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
6
+ const act = react_1.act;
7
+ describe('Editor - e-no-wrap', () => {
8
+ let cleanup;
9
+ let onContentChangeMock;
10
+ beforeEach(() => {
11
+ onContentChangeMock = jest.fn();
12
+ });
13
+ afterEach(() => {
14
+ if (cleanup) {
15
+ cleanup();
16
+ }
17
+ cleanup = null;
18
+ });
19
+ it('HR is rendered as expected', () => {
20
+ const inputData = '<p>bar</p><hr/>';
21
+ const expectedOutput = '<p>bar</p><hr>';
22
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData);
23
+ const table = result.container.querySelector('.ProseMirror');
24
+ expect(table.innerHTML).toBe(expectedOutput);
25
+ });
26
+ it('Change in content causes HR to be returned as expected', async () => {
27
+ cleanup = (0, prosemirror_1.mockCreateRange)();
28
+ const inputData = '<p>foo</p><hr/><p>bar</p>';
29
+ const expectedOutput = '<p>foo</p><hr/><p>foo</p>';
30
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
31
+ await act(async () => {
32
+ insertText(await result.findByText('bar'), 'foo');
33
+ });
34
+ expect(onContentChangeMock).toHaveBeenCalledTimes(1);
35
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
36
+ });
37
+ });
38
+ function insertText(element, text) {
39
+ react_1.fireEvent.input(element, {
40
+ target: { innerText: text, innerHTML: text }
41
+ });
42
+ }
43
+ //# sourceMappingURL=no-wrap.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-wrap.test.js","sourceRoot":"","sources":["../../../__tests__/editor/no-wrap.test.tsx"],"names":[],"mappings":";;AAAA,kDAAkE;AAClE,sDAAsD;AACtD,gGAAoF;AAEpF,MAAM,GAAG,GAAG,WAAuD,CAAA;AAEnE,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAI,OAA4B,CAAA;IAChC,IAAI,mBAA8B,CAAA;IAElC,UAAU,CAAC,G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AAE,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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=noWrap.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noWrap.test.d.ts","sourceRoot":"","sources":["../../../__tests__/editor/noWrap.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("@testing-library/react");
4
+ const prosemirror_1 = require("../utils/prosemirror");
5
+ const renderEditableGradingInstruction_1 = require("../utils/renderEditableGradingInstruction");
6
+ const act = react_1.act;
7
+ describe('Editor - e-nowrap', () => {
8
+ let cleanup;
9
+ let onContentChangeMock;
10
+ beforeEach(() => {
11
+ onContentChangeMock = jest.fn();
12
+ cleanup = (0, prosemirror_1.mockCreateRange)();
13
+ });
14
+ afterEach(() => {
15
+ if (cleanup) {
16
+ cleanup();
17
+ }
18
+ cleanup = null;
19
+ });
20
+ it('e-nowrap is rendered and returned as expected outside paragraph', async () => {
21
+ const inputData = '<p>bar</p><span class="e-nowrap">foo</span>';
22
+ const expectedDom = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
23
+ const expectedOutput = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
24
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
25
+ await act(async () => {
26
+ insertText(await result.findByText('bar'), 'foo');
27
+ });
28
+ const element = result.container.querySelector('.ProseMirror');
29
+ expect(element.innerHTML).toBe(expectedDom);
30
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
31
+ });
32
+ it('e:formula is rendered as expected when wrapped inside e-nowrap', async () => {
33
+ const inputData = '<p>bar</p><span class="e-nowrap"><e:formula data-editor-id=e-formula>foo</e:formula></span>';
34
+ const expectedDom = '<p>foo</p><p><span class="e-nowrap"><img alt="foo" src="/math.svg?latex=foo"><img class="ProseMirror-separator" alt=""></span><br class="ProseMirror-trailingBreak"></p>';
35
+ const expectedOutput = '<p>foo</p><p><span class="e-nowrap"><e:formula>foo</e:formula></span></p>';
36
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
37
+ await act(async () => {
38
+ insertText(await result.findByText('bar'), 'foo');
39
+ });
40
+ const element = result.container.querySelector('.ProseMirror');
41
+ expect(element.innerHTML).toBe(expectedDom);
42
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
43
+ });
44
+ it('e-nowrap is rendered as expected inside paragraph', async () => {
45
+ const inputData = '<p>bar</p><p><span class="e-nowrap">foo</span></p>';
46
+ const expectedDom = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
47
+ const expectedOutput = '<p>foo</p><p><span class="e-nowrap">foo</span></p>';
48
+ const result = (0, renderEditableGradingInstruction_1.renderGradingInstruction)(inputData, onContentChangeMock);
49
+ await act(async () => {
50
+ insertText(await result.findByText('bar'), 'foo');
51
+ });
52
+ const element = result.container.querySelector('.ProseMirror');
53
+ expect(element.innerHTML).toBe(expectedDom);
54
+ expect(onContentChangeMock).toHaveBeenCalledWith(expectedOutput, '');
55
+ });
56
+ });
57
+ function insertText(element, text) {
58
+ react_1.fireEvent.input(element, {
59
+ target: { innerText: text, innerHTML: text }
60
+ });
61
+ }
62
+ //# sourceMappingURL=noWrap.test.js.map
@@ -0,0 +1 @@
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,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,IAAI,OAA4B,CAAA;IAChC,IAAI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AE,IAAI,EAAE;KAC7C,CAAC,CAAA;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAoCnD,iBAAS,0BAA0B,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,qBA0CpE;AAED,eAAe,0BAA0B,CAAA"}
1
+ {"version":3,"file":"EditableGradingInstruction.d.ts","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAA;AAkE9D,iBAAS,0BAA0B,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,qBA0CpE;AAED,eAAe,0BAA0B,CAAA"}
@@ -1,4 +1,4 @@
1
- import React, { useContext, useState } from 'react';
1
+ import React, { useContext, useEffect, useState } from 'react';
2
2
  import { schema as baseSchema } from 'prosemirror-schema-basic';
3
3
  import { EditorState } from 'prosemirror-state';
4
4
  import { baseKeymap } from 'prosemirror-commands';
@@ -11,21 +11,47 @@ import { TableMenu, tableSchema } from './editor/Table';
11
11
  import { FormulaPopup } from './editor/FormulaPopup';
12
12
  import FormatButton from './editor/FormatButton';
13
13
  import { NbspButton, nbspPlugin } from './editor/NBSP';
14
+ import { spanWithNowrap } from './editor/spanWithNowrap';
15
+ import { faBold, faItalic } from '@fortawesome/free-solid-svg-icons';
14
16
  const schema = new Schema({
15
17
  nodes: baseSchema.spec.nodes.append(formulaSchema).append(tableSchema),
16
- marks: baseSchema.spec.marks
18
+ marks: baseSchema.spec.marks.append(spanWithNowrap)
17
19
  });
18
20
  const outputSchema = new Schema({
19
21
  nodes: baseSchema.spec.nodes.append(formulaOutputSchema).append(tableSchema),
20
- marks: baseSchema.spec.marks
22
+ marks: baseSchema.spec.marks.append(spanWithNowrap)
21
23
  });
22
24
  function Menu(props) {
25
+ const [isFixed, setIsFixed] = useState(false);
26
+ useEffect(() => {
27
+ const handleScroll = () => {
28
+ if (!props.textAreaElement) {
29
+ return;
30
+ }
31
+ const rect = props.textAreaElement.getBoundingClientRect();
32
+ if (rect.top < 25 && rect.bottom > 100) {
33
+ setIsFixed(true);
34
+ }
35
+ else {
36
+ setIsFixed(false);
37
+ }
38
+ };
39
+ window.addEventListener('scroll', handleScroll);
40
+ return () => {
41
+ window.removeEventListener('scroll', handleScroll);
42
+ };
43
+ }, [props.textAreaElement]);
23
44
  return (React.createElement(React.Fragment, null,
24
- React.createElement(FormatButton, { markName: "strong", displayName: "Bold" }),
25
- React.createElement(FormatButton, { markName: "em", displayName: "Italic" }),
26
- React.createElement(TableMenu, null),
27
- React.createElement(FormulaButton, { setFormulaState: props.setFormulaState }),
28
- React.createElement(NbspButton, null)));
45
+ React.createElement("div", { className: "editor-menu-placeholder" },
46
+ React.createElement("div", { className: `editor-menu ${isFixed ? 'fixed' : ''}` },
47
+ React.createElement(FormatButton, { markName: "strong", icon: faBold }),
48
+ React.createElement(FormatButton, { markName: "em", icon: faItalic }),
49
+ React.createElement("span", { className: "editor-menu-separator" }),
50
+ React.createElement(FormulaButton, { setFormulaState: props.setFormulaState }),
51
+ React.createElement("span", { className: "editor-menu-separator" }),
52
+ React.createElement(TableMenu, null),
53
+ React.createElement("span", { className: "editor-menu-separator" }),
54
+ React.createElement(NbspButton, null)))));
29
55
  }
30
56
  function EditableGradingInstruction({ element }) {
31
57
  const { onContentChange } = useContext(GradingInstructionContext);
@@ -49,8 +75,8 @@ function EditableGradingInstruction({ element }) {
49
75
  onContentChange(nbspFixed, path);
50
76
  }
51
77
  } },
52
- React.createElement(Menu, { setFormulaState: setFormulaState }),
53
- React.createElement("div", { ref: setMount }),
78
+ React.createElement(Menu, { setFormulaState: setFormulaState, textAreaElement: mount }),
79
+ React.createElement("div", { className: "ProseMirror-focused", ref: setMount }),
54
80
  formulaState && (React.createElement(FormulaPopup, { state: formulaState, onFinish: () => {
55
81
  setFormulaState(null);
56
82
  } }))));
@@ -1 +1 @@
1
- {"version":3,"file":"EditableGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AACtF,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;AAEtD,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,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK;CAC7B,CAAC,CAAA;AAEF,MAAM,YAAY,GAAG,I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AK,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;YAC1B,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACzF,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;YACzC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;YACzB,MAAM,IAAI,GAAG,MAAA,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAA;YAC/C,IAAI,eAAe,EAAE,CAAC;gBACpB,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS;qBAC5B,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC;qBAC5B,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;qBACzB,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;gBAC5B,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;YAClC,CAAC;QACH,CAAC;QAED,oBAAC,IAAI,IAAC,eAAe,EAAE,eAAe,GAAI;QAC1C,6BAAK,GAAG,EAAE,QAAQ,GAAI;QAErB,YAAY,IAAI,CACf,oBAAC,YAAY,IACX,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,GAAG,EAAE;gBACb,eAAe,CAAC,IAAI,CAAC,CAAA;YACvB,CAAC,GACD,CACH,CACW,CACf,CAAA;AACH,CAAC;AAED,eAAe,0BAA0B,CAAA"}
1
+ {"version":3,"file":"EditableGradingInstruction.js","sourceRoot":"","sources":["../../../src/components/grading-instructions/EditableGradingInstruction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAA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aAAa,CAAC,KAAK,CAAC,CAAA;YACzC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;YACzB,MAAM,IAAI,GAAG,MAAA,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAA;YAC/C,IAAI,eAAe,EAAE,CAAC;gBACpB,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS;qBAC5B,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC;qBAC5B,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;qBACzB,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;gBAC5B,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;YAClC,CAAC;QACH,CAAC;QAED,oBAAC,IAAI,IAAC,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,GAAI;QAClE,6BAAK,SAAS,EAAC,qBAAqB,EAAC,GAAG,EAAE,QAAQ,GAAI;QAErD,YAAY,IAAI,CACf,oBAAC,YAAY,IACX,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,GAAG,EAAE;gBACb,eAAe,CAAC,IAAI,CAAC,CAAA;YACvB,CAAC,GACD,CACH,CACW,CACf,CAAA;AACH,CAAC;AAED,eAAe,0BAA0B,CAAA"}
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
+ import { IconDefinition } from '@fortawesome/free-solid-svg-icons';
2
3
  interface Props {
3
4
  markName: string;
4
- displayName: string;
5
+ displayName?: string;
6
+ icon?: IconDefinition;
5
7
  }
6
- declare function FormatButton({ markName, displayName }: Props): React.JSX.Element;
8
+ declare function FormatButton({ markName, icon }: Props): React.JSX.Element;
7
9
  export default FormatButton;
8
10
  //# sourceMappingURL=FormatButton.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"FormatButton.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/FormatButton.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAGlE,UAAU,KAAK;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,cAAc,CAAA;CACtB;AAID,iBAAS,YAAY,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,KAAK,qBAuB9C;AAED,eAAe,YAAY,CAAA"}
@@ -1,8 +1,10 @@
1
1
  import { useEditorEventCallback, useEditorState } from '@nytimes/react-prosemirror';
2
2
  import { toggleMark } from 'prosemirror-commands';
3
3
  import React, { useEffect, useState } from 'react';
4
+ import classNames from 'classnames';
5
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4
6
  const getMarkType = (state, markName) => state.schema.marks[markName];
5
- function FormatButton({ markName, displayName }) {
7
+ function FormatButton({ markName, icon }) {
6
8
  const editorState = useEditorState();
7
9
  const [isActive, setIsActive] = useState(false);
8
10
  const onClick = useEditorEventCallback(view => {
@@ -17,7 +19,8 @@ function FormatButton({ markName, displayName }) {
17
19
  : getMarkType(editorState, markName).isInSet(editorState.selection.$to.marks()); // is current input marked?
18
20
  setIsActive(!!isTextFormatActive);
19
21
  }, [editorState]);
20
- return (React.createElement("button", { onClick: onClick, style: { fontWeight: isActive ? 'bold' : 'normal' } }, displayName));
22
+ return (React.createElement("button", { onClick: onClick, className: classNames({ active: isActive }) },
23
+ React.createElement(FontAwesomeIcon, { size: "lg", icon: icon })));
21
24
  }
22
25
  export default FormatButton;
23
26
  //# sourceMappingURL=FormatButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatButton.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/FormatButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGjD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAOlD,MAAM,WAAW,GAAG,CAAC,KAAkB,EAAE,QAAgB,EAAY,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;AAEpG,SAAS,YAAY,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAS;IACpD,MAAM,WAAW,GAAG,cAAc,EAAE,CAAA;IACpC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE/C,MAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,CAAC,EAAE;QAC5C,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;QACtB,MAAM,gBAAgB,GAAG,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;QACjE,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAC5C,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,kBAAkB,GAAG,WAAW,CAAC,WAAW;YAChD,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,oCAAoC;YAC1G,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,QAAQ,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CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;QACjE,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QAC5C,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,kBAAkB,GAAG,WAAW,CAAC,WAAW;YAChD,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,oCAAoC;YAC1G,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA,CAAC,2BAA2B;QAC7G,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAA;IACnC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IAEjB,OAAO,CACL,gCAAQ,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;QACnE,oBAAC,eAAe,IAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAE,IAAK,GAAI,CACnC,CACV,CAAA;AACH,CAAC;AAED,eAAe,YAAY,CAAA"}
@@ -55,7 +55,7 @@ export function FormulaButton(props) {
55
55
  }
56
56
  }
57
57
  });
58
- return (React.createElement("button", { onClick: onClick, "data-testid": "add-formula" }, "Lis\u00E4\u00E4 kaava"));
58
+ return (React.createElement("button", { onClick: onClick, "data-testid": "add-formula", className: "editor-menu-text-button" }, "Lis\u00E4\u00E4 kaava"));
59
59
  }
60
60
  export class FormulaPlugin extends Plugin {
61
61
  constructor(updateFormulaState) {
@@ -1 +1 @@
1
- {"version":3,"file":"Formula.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/Formula.tsx"],"names":[],"mappings":"AAAA,OA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AQ,MAAM;IACvC,YAAY,kBAAwD;QAClE,KAAK,CAAC;YACJ,GAAG,EAAE,IAAI,SAAS,CAAC,SAAS,CAAC;YAC7B,KAAK,EAAE;gBACL,WAAW,CAAC,IAAgB,EAAE,GAAW;oBACvC,MAAM,EAAE,KAAK,EAAE,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
+ {"version":3,"file":"Formula.js","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/Formula.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAe,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAiB,QAAQ,EAAkB,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,CAAC,MAAM,aAAa,GAAa;IACrC,OAAO,EAAE;QACP,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,IAAI;QACV,KAAK,EAAE;YACL,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;SAC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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 +1 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/Table.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAAmB,MAAM,OAAO,CAAA;AAgCvC,eAAO,MAAM,WAAW,EAAE,QAyDzB,CAAA;AAED,wBAAgB,SAAS,sBAqHxB"}
1
+ {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/grading-instructions/editor/Table.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5D,OAAO,KAA8B,MAAM,OAAO,CAAA;AAclD,eAAO,MAAM,WAAW,EAAE,QAmCzB,CAAA;AAED,wBAAgB,SAAS,sBA6IxB"}
@@ -1,35 +1,15 @@
1
1
  import { addColumnAfter, addRowAfter, deleteColumn, deleteRow, deleteTable, tableNodes } from 'prosemirror-tables';
2
2
  import { Fragment } from 'prosemirror-model';
3
- import React, { useState } from 'react';
4
- import { useEditorEventCallback } from '@nytimes/react-prosemirror';
3
+ import React, { useEffect, useState } from 'react';
4
+ import { useEditorEventCallback, useEditorState } from '@nytimes/react-prosemirror';
5
5
  import { TextSelection } from 'prosemirror-state';
6
6
  import { faTable } from '@fortawesome/free-solid-svg-icons';
7
7
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
+ import classNames from 'classnames';
8
9
  const defaultSchema = tableNodes({
9
10
  tableGroup: 'block',
10
11
  cellContent: 'inline*',
11
- cellAttributes: {
12
- class: {
13
- default: null,
14
- getFromDOM(dom) {
15
- return dom.getAttribute('class') || null;
16
- },
17
- setDOMAttr(value, attrs) {
18
- if (value)
19
- attrs.class = value;
20
- }
21
- },
22
- xmlns: {
23
- default: null,
24
- getFromDOM(dom) {
25
- return dom.getAttribute('xmlns') || null;
26
- },
27
- setDOMAttr(value, attrs) {
28
- if (value)
29
- attrs.xmlns = value;
30
- }
31
- }
32
- }
12
+ cellAttributes: { class: { default: '' } }
33
13
  });
34
14
  export const tableSchema = {
35
15
  ...defaultSchema,
@@ -58,38 +38,31 @@ export const tableSchema = {
58
38
  parseDOM: [
59
39
  {
60
40
  tag: 'td',
61
- getAttrs: (dom) => {
62
- console.log(dom);
63
- return { class: dom.getAttribute('class') };
64
- }
41
+ getAttrs: (dom) => ({ class: dom.getAttribute('class') })
65
42
  }
66
43
  ],
67
44
  toDOM(node) {
68
45
  const classNames = node.attrs.class || undefined;
69
46
  return ['td', { class: classNames }, 0];
70
47
  }
71
- },
72
- span: {
73
- inline: true,
74
- group: 'inline',
75
- selectable: false,
76
- attrs: { class: {} },
77
- parseDOM: [
78
- {
79
- tag: 'span[class="e-nowrap"]',
80
- getAttrs(dom) {
81
- console.log('span', dom);
82
- return { class: dom.getAttribute('class') };
83
- }
84
- }
85
- ],
86
- toDOM: (node) => {
87
- console.log('dsads', node.attrs);
88
- return ['span', { class: 'e-nowrap' }, 0];
89
- }
90
48
  }
91
49
  };
92
50
  export function TableMenu() {
51
+ const [isActive, setIsActive] = useState(false);
52
+ const editorState = useEditorState();
53
+ const isCursorInTable = (state) => {
54
+ const { $from } = state.selection;
55
+ for (let d = $from.depth; d > 0; d--) {
56
+ const node = $from.node(d);
57
+ if (node.type.name === 'table') {
58
+ return true;
59
+ }
60
+ }
61
+ return false;
62
+ };
63
+ useEffect(() => {
64
+ setIsActive(isCursorInTable(editorState));
65
+ }, [editorState]);
93
66
  const withFocus = (view, action) => {
94
67
  const result = action(view.state, view.dispatch);
95
68
  view.focus();
@@ -165,9 +138,12 @@ export function TableMenu() {
165
138
  setIsOpen(false);
166
139
  } }, title));
167
140
  return (React.createElement(React.Fragment, null,
141
+ React.createElement("button", { onClick: () => menuOptions.addTable.onClick(), className: classNames({ active: isActive }) },
142
+ React.createElement(FontAwesomeIcon, { size: "lg", icon: faTable, fixedWidth: true })),
143
+ isActive && (React.createElement(React.Fragment, null,
144
+ React.createElement("button", { onClick: () => setIsOpen(!isOpen) }, "Lis\u00E4\u00E4"),
145
+ React.createElement("button", { onClick: () => setIsOpen(!isOpen) }, "Poista"))),
168
146
  React.createElement("span", { className: "e-menu-dropdown" },
169
- React.createElement("button", { onClick: () => setIsOpen(!isOpen) },
170
- React.createElement(FontAwesomeIcon, { size: "sm", icon: faTable, fixedWidth: true })),
171
147
  React.createElement("ul", { className: "e-menu-dropdown-menu", style: { display: isOpen ? 'block' : 'none' } },
172
148
  React.createElement(Option, { ...menuOptions.addTable }),
173
149
  React.createElement(Option, { ...menuOptions.addRowAfter }),