@pie-lib/editable-html-tip-tap 2.1.19 → 2.1.20-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +0 -130
  2. package/lib/components/EditableHtml.js +0 -56
  3. package/lib/components/EditableHtml.js.map +1 -1
  4. package/lib/components/MenuBar.js +12 -81
  5. package/lib/components/MenuBar.js.map +1 -1
  6. package/lib/components/TiptapContainer.js +2 -2
  7. package/lib/components/TiptapContainer.js.map +1 -1
  8. package/lib/components/common/toolbar-buttons.js +5 -6
  9. package/lib/components/common/toolbar-buttons.js.map +1 -1
  10. package/lib/components/icons/TableIcons.js +1 -3
  11. package/lib/components/icons/TableIcons.js.map +1 -1
  12. package/lib/components/icons/TextAlign.js +5 -14
  13. package/lib/components/icons/TextAlign.js.map +1 -1
  14. package/lib/components/respArea/MathTemplated.js +8 -14
  15. package/lib/components/respArea/MathTemplated.js.map +1 -1
  16. package/lib/extensions/math.js +37 -19
  17. package/lib/extensions/math.js.map +1 -1
  18. package/lib/styles/editorContainerStyles.js +2 -2
  19. package/lib/styles/editorContainerStyles.js.map +1 -1
  20. package/package.json +9 -9
  21. package/src/components/EditableHtml.jsx +0 -52
  22. package/src/components/MenuBar.jsx +9 -91
  23. package/src/components/TiptapContainer.jsx +2 -2
  24. package/src/components/common/toolbar-buttons.jsx +4 -6
  25. package/src/components/icons/TableIcons.jsx +1 -9
  26. package/src/components/icons/TextAlign.jsx +5 -39
  27. package/src/components/respArea/MathTemplated.jsx +6 -13
  28. package/src/extensions/math.js +19 -11
  29. package/src/styles/editorContainerStyles.js +2 -2
  30. package/LICENSE.md +0 -5
  31. package/src/__tests__/EditableHtml.test.jsx +0 -668
  32. package/src/__tests__/constants.test.js +0 -19
  33. package/src/__tests__/div-to-paragraph-conversion.test.jsx +0 -125
  34. package/src/__tests__/editor-attributes.test.jsx +0 -77
  35. package/src/__tests__/extensions.test.js +0 -208
  36. package/src/__tests__/index.test.jsx +0 -154
  37. package/src/__tests__/size-utils.test.js +0 -64
  38. package/src/__tests__/spellcheck.test.jsx +0 -63
  39. package/src/__tests__/theme.test.js +0 -17
  40. package/src/components/__tests__/AltDialog.test.jsx +0 -147
  41. package/src/components/__tests__/CharacterPicker.test.jsx +0 -270
  42. package/src/components/__tests__/CssIcon.test.jsx +0 -46
  43. package/src/components/__tests__/DragInTheBlank.test.jsx +0 -255
  44. package/src/components/__tests__/ExplicitConstructedResponse.test.jsx +0 -209
  45. package/src/components/__tests__/ImageToolbar.test.jsx +0 -128
  46. package/src/components/__tests__/InlineDropdown.test.jsx +0 -557
  47. package/src/components/__tests__/InsertImageHandler.test.js +0 -161
  48. package/src/components/__tests__/MediaDialog.test.jsx +0 -293
  49. package/src/components/__tests__/MediaToolbar.test.jsx +0 -74
  50. package/src/components/__tests__/MediaWrapper.test.jsx +0 -81
  51. package/src/components/__tests__/MenuBar.test.jsx +0 -338
  52. package/src/components/__tests__/RespArea.test.jsx +0 -122
  53. package/src/components/__tests__/TableIcons.test.jsx +0 -149
  54. package/src/components/__tests__/TextAlign.test.jsx +0 -167
  55. package/src/components/__tests__/TiptapContainer.test.jsx +0 -138
  56. package/src/components/__tests__/characterUtils.test.js +0 -166
  57. package/src/components/__tests__/choice.test.jsx +0 -171
  58. package/src/components/__tests__/custom-popper.test.jsx +0 -82
  59. package/src/components/__tests__/done-button.test.jsx +0 -54
  60. package/src/components/__tests__/toolbar-buttons.test.jsx +0 -247
  61. package/src/components/respArea/DragInTheBlank/__tests__/choice.test.jsx +0 -72
  62. package/src/components/respArea/__tests__/MathTemplated.test.jsx +0 -210
  63. package/src/extensions/__tests__/css.test.js +0 -196
  64. package/src/extensions/__tests__/custom-toolbar-wrapper.test.jsx +0 -180
  65. package/src/extensions/__tests__/divNode.test.js +0 -87
  66. package/src/extensions/__tests__/ensure-empty-root-div.test.js +0 -57
  67. package/src/extensions/__tests__/ensure-list-item-content-is-div.test.js +0 -44
  68. package/src/extensions/__tests__/extended-list-item.test.js +0 -13
  69. package/src/extensions/__tests__/extended-table-cell.test.js +0 -22
  70. package/src/extensions/__tests__/extended-table.test.js +0 -183
  71. package/src/extensions/__tests__/image-component.test.jsx +0 -346
  72. package/src/extensions/__tests__/image.test.js +0 -237
  73. package/src/extensions/__tests__/math.test.js +0 -898
  74. package/src/extensions/__tests__/media-node-view.test.jsx +0 -298
  75. package/src/extensions/__tests__/media.test.js +0 -271
  76. package/src/extensions/__tests__/responseArea.test.js +0 -655
  77. package/src/utils/__tests__/helper.test.js +0 -126
  78. package/src/utils/__tests__/toolbar.test.js +0 -43
@@ -1,126 +0,0 @@
1
- import { normalizeInitialMarkup } from '../helper';
2
-
3
- describe('normalizeInitialMarkup', () => {
4
- describe('basic normalization', () => {
5
- it('returns empty div for empty string', () => {
6
- expect(normalizeInitialMarkup('')).toBe('<div></div>');
7
- });
8
-
9
- it('returns empty div for null', () => {
10
- expect(normalizeInitialMarkup(null)).toBe('<div></div>');
11
- });
12
-
13
- it('returns empty div for undefined', () => {
14
- expect(normalizeInitialMarkup(undefined)).toBe('<div></div>');
15
- });
16
-
17
- it('wraps plain text in div', () => {
18
- expect(normalizeInitialMarkup('Hello')).toBe('<div>Hello</div>');
19
- });
20
-
21
- it('returns HTML tags as-is when detected as HTML', () => {
22
- // Since '<script>' matches the HTML pattern, it's returned as-is
23
- // To be escaped, it would need to not match the HTML pattern
24
- expect(normalizeInitialMarkup('<script>')).toBe('<script>');
25
- });
26
-
27
- it('escapes HTML entities in plain text', () => {
28
- // Plain text without angle brackets gets escaped
29
- expect(normalizeInitialMarkup('Hello & World')).toBe('<div>Hello &amp; World</div>');
30
- });
31
-
32
- it('returns single div as-is', () => {
33
- const html = '<div>Hello</div>';
34
- expect(normalizeInitialMarkup(html)).toBe(html);
35
- });
36
-
37
- it('returns paragraph as-is', () => {
38
- const html = '<p>Hello</p>';
39
- expect(normalizeInitialMarkup(html)).toBe(html);
40
- });
41
- });
42
-
43
- describe('consecutive divs to paragraph conversion', () => {
44
- it('converts two consecutive divs to paragraph with br', () => {
45
- const input = '<div>A</div><div>B</div>';
46
- const expected = '<p>A<br>B</p>';
47
- expect(normalizeInitialMarkup(input)).toBe(expected);
48
- });
49
-
50
- it('converts three consecutive divs to paragraph with br tags', () => {
51
- const input = '<div>A</div><div>B</div><div>C</div>';
52
- const expected = '<p>A<br>B<br>C</p>';
53
- expect(normalizeInitialMarkup(input)).toBe(expected);
54
- });
55
-
56
- it('handles divs with whitespace', () => {
57
- const input = '<div> A </div><div> B </div>';
58
- const expected = '<p> A <br> B </p>';
59
- expect(normalizeInitialMarkup(input)).toBe(expected);
60
- });
61
-
62
- it('handles divs with inline elements', () => {
63
- const input = '<div><strong>A</strong></div><div><em>B</em></div>';
64
- const expected = '<p><strong>A</strong><br><em>B</em></p>';
65
- expect(normalizeInitialMarkup(input)).toBe(expected);
66
- });
67
-
68
- it('handles empty divs', () => {
69
- const input = '<div></div><div>B</div>';
70
- const expected = '<p><br>B</p>';
71
- expect(normalizeInitialMarkup(input)).toBe(expected);
72
- });
73
-
74
- it('preserves existing br tags within divs', () => {
75
- const input = '<div>A<br>A2</div><div>B</div>';
76
- const expected = '<p>A<br>A2<br>B</p>';
77
- expect(normalizeInitialMarkup(input)).toBe(expected);
78
- });
79
- });
80
-
81
- describe('cases that should NOT convert', () => {
82
- it('does not convert single div', () => {
83
- const input = '<div>Hello</div>';
84
- expect(normalizeInitialMarkup(input)).toBe(input);
85
- });
86
-
87
- it('does not convert divs with nested block elements', () => {
88
- const input = '<div><div>Nested</div></div><div>B</div>';
89
- expect(normalizeInitialMarkup(input)).toBe(input);
90
- });
91
-
92
- it('does not convert divs containing tables', () => {
93
- const input = '<div><table><tr><td>A</td></tr></table></div><div>B</div>';
94
- expect(normalizeInitialMarkup(input)).toBe(input);
95
- });
96
-
97
- it('does not convert divs containing lists', () => {
98
- const input = '<div><ul><li>Item</li></ul></div><div>B</div>';
99
- expect(normalizeInitialMarkup(input)).toBe(input);
100
- });
101
-
102
- it('does not convert mixed element types', () => {
103
- const input = '<div>A</div><p>B</p>';
104
- expect(normalizeInitialMarkup(input)).toBe(input);
105
- });
106
-
107
- it('does not convert paragraphs', () => {
108
- const input = '<p>A</p><p>B</p>';
109
- expect(normalizeInitialMarkup(input)).toBe(input);
110
- });
111
- });
112
-
113
- describe('edge cases', () => {
114
- it('handles divs with attributes', () => {
115
- const input = '<div class="test">A</div><div>B</div>';
116
- // Should not convert since we only want simple divs
117
- expect(normalizeInitialMarkup(input)).toBe(input);
118
- });
119
-
120
- it('handles complex inline formatting', () => {
121
- const input = '<div><strong><em>A</em></strong></div><div><u>B</u></div>';
122
- const expected = '<p><strong><em>A</em></strong><br><u>B</u></p>';
123
- expect(normalizeInitialMarkup(input)).toBe(expected);
124
- });
125
- });
126
- });
@@ -1,43 +0,0 @@
1
- import { setToolbarOpened, TOOLBAR_OPENED_META_KEY } from '../toolbar';
2
-
3
- describe('setToolbarOpened', () => {
4
- const createEditor = (toolbarOpened = false) => {
5
- const tr = {
6
- setMeta: jest.fn().mockReturnThis(),
7
- };
8
-
9
- return {
10
- _toolbarOpened: toolbarOpened,
11
- state: { tr },
12
- view: {
13
- dispatch: jest.fn(),
14
- },
15
- };
16
- };
17
-
18
- it('sets editor._toolbarOpened and dispatches a meta transaction', () => {
19
- const editor = createEditor(false);
20
-
21
- setToolbarOpened(editor, true);
22
-
23
- expect(editor._toolbarOpened).toBe(true);
24
- expect(editor.state.tr.setMeta).toHaveBeenCalledWith(TOOLBAR_OPENED_META_KEY, true);
25
- expect(editor.view.dispatch).toHaveBeenCalledWith(editor.state.tr);
26
- });
27
-
28
- it('does nothing when the value is unchanged', () => {
29
- const editor = createEditor(true);
30
-
31
- setToolbarOpened(editor, true);
32
-
33
- expect(editor.view.dispatch).not.toHaveBeenCalled();
34
- });
35
-
36
- it('coerces the opened value to a boolean', () => {
37
- const editor = createEditor(false);
38
-
39
- setToolbarOpened(editor, 1);
40
-
41
- expect(editor._toolbarOpened).toBe(true);
42
- });
43
- });