strapi-plugin-comments 2.2.15 → 2.2.17

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 (73) hide show
  1. package/README.md +4 -4
  2. package/admin/src/components/CommentReviewModal/index.d.ts +0 -1
  3. package/admin/src/components/ConfirmationDialog/index.d.ts +0 -1
  4. package/admin/src/components/DiscussionStatus/index.d.ts +0 -1
  5. package/admin/src/components/DiscussionThread/index.d.ts +0 -1
  6. package/admin/src/components/DiscussionThreadItem/index.d.ts +0 -1
  7. package/admin/src/components/DiscussionThreadItemActions/index.d.ts +0 -1
  8. package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +0 -1
  9. package/admin/src/components/DiscussionThreadItemFooter/index.d.ts +0 -1
  10. package/admin/src/components/DiscussionThreadItemReviewAction/index.d.ts +0 -1
  11. package/admin/src/components/FormSwitch/index.d.ts +0 -1
  12. package/admin/src/components/LoadingIndicatorOverlay/index.d.ts +0 -1
  13. package/admin/src/components/ModeratorResponse/index.js +5 -8
  14. package/admin/src/components/ModeratorResponseModal/ModeratorResponseModal.js +5 -8
  15. package/admin/src/components/Nav/index.d.ts +0 -1
  16. package/admin/src/components/PluginIcon/index.d.ts +0 -1
  17. package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.d.ts +18 -1
  18. package/admin/src/components/ReportsActions/components/BlockMenu/index.d.ts +0 -1
  19. package/admin/src/components/ReportsActions/index.d.ts +0 -1
  20. package/admin/src/components/ReportsReviewModal/index.d.ts +0 -1
  21. package/admin/src/components/ReportsReviewTable/index.d.ts +0 -1
  22. package/admin/src/components/StatusBadge/index.d.ts +0 -1
  23. package/admin/src/components/TableFilters/index.d.ts +0 -1
  24. package/admin/src/components/TablePagination/index.d.ts +0 -1
  25. package/admin/src/components/Wysiwyg/Editor.d.ts +24 -12
  26. package/admin/src/components/Wysiwyg/Editor.js +375 -21
  27. package/admin/src/components/Wysiwyg/EditorLayout.d.ts +9 -8
  28. package/admin/src/components/Wysiwyg/EditorLayout.js +37 -51
  29. package/admin/src/components/Wysiwyg/Field.d.ts +15 -0
  30. package/admin/src/components/Wysiwyg/{index.js → Field.js} +48 -49
  31. package/admin/src/components/Wysiwyg/PreviewWysiwyg.d.ts +6 -0
  32. package/admin/src/components/Wysiwyg/PreviewWysiwyg.js +191 -0
  33. package/admin/src/components/Wysiwyg/WysiwygFooter.d.ts +7 -6
  34. package/admin/src/components/Wysiwyg/WysiwygFooter.js +32 -13
  35. package/admin/src/components/Wysiwyg/WysiwygNav.d.ts +12 -10
  36. package/admin/src/components/Wysiwyg/WysiwygNav.js +76 -58
  37. package/admin/src/components/Wysiwyg/WysiwygStyles.d.ts +0 -1
  38. package/admin/src/components/Wysiwyg/WysiwygStyles.js +8 -13
  39. package/admin/src/components/Wysiwyg/utils/continueList.d.ts +5 -2
  40. package/admin/src/components/Wysiwyg/utils/continueList.js +2 -1
  41. package/admin/src/components/Wysiwyg/utils/mdRenderer.d.ts +5 -0
  42. package/admin/src/components/Wysiwyg/utils/mdRenderer.js +63 -0
  43. package/admin/src/components/Wysiwyg/utils/utils.d.ts +11 -9
  44. package/admin/src/components/Wysiwyg/utils/utils.js +13 -12
  45. package/admin/src/components/icons/comments.d.ts +0 -1
  46. package/admin/src/components/icons/lock.d.ts +0 -1
  47. package/admin/src/components/icons/review.d.ts +0 -1
  48. package/admin/src/components/icons/strapiIcons.d.ts +0 -1
  49. package/admin/src/components/icons/unlock.d.ts +0 -1
  50. package/admin/src/custom-fields/comments/components/icon.d.ts +0 -1
  51. package/admin/src/index.d.ts +3 -1
  52. package/admin/src/index.js +1 -1
  53. package/admin/src/pages/App/index.d.ts +14 -2
  54. package/admin/src/pages/App/reducer/selectors.d.ts +5 -1
  55. package/admin/src/pages/Details/components/DetailsEntity/index.d.ts +0 -1
  56. package/admin/src/pages/Details/components/DetailsFilters/index.d.ts +0 -1
  57. package/admin/src/pages/Details/index.d.ts +9 -2
  58. package/admin/src/pages/Discover/components/DiscoverTableRow/index.d.ts +0 -1
  59. package/admin/src/pages/Discover/index.d.ts +9 -2
  60. package/admin/src/pages/NoAccessPage/index.d.ts +0 -1
  61. package/admin/src/pages/Reports/components/ReportsTableRow/index.d.ts +0 -1
  62. package/admin/src/pages/Reports/index.d.ts +9 -2
  63. package/admin/src/pages/Settings/index.d.ts +0 -1
  64. package/admin/src/pages/Settings/index.js +2 -5
  65. package/admin/src/permissions.js +0 -1
  66. package/package.json +9 -10
  67. package/server/services/common.js +3 -4
  68. package/tsconfig.tsbuildinfo +1 -1
  69. package/admin/src/components/Wysiwyg/EditorStylesContainer.d.ts +0 -2
  70. package/admin/src/components/Wysiwyg/EditorStylesContainer.js +0 -348
  71. package/admin/src/components/Wysiwyg/index.d.ts +0 -28
  72. package/admin/src/components/Wysiwyg/tests/index.test.d.ts +0 -2
  73. package/admin/src/components/Wysiwyg/tests/index.test.js +0 -1633
@@ -1,1633 +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
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const React = __importStar(require("react"));
30
- const react_intl_1 = require("react-intl");
31
- const react_1 = require("@testing-library/react");
32
- const ThemeProvider_1 = require("@strapi/design-system/ThemeProvider");
33
- const themes_1 = require("@strapi/design-system/themes");
34
- const index_1 = __importDefault(require("../index"));
35
- jest.mock('@strapi/helper-plugin', () => ({
36
- ...jest.requireActual('@strapi/helper-plugin'),
37
- useLibrary: () => ({ components: {} }),
38
- }));
39
- document.createRange = () => {
40
- const range = new Range();
41
- range.getBoundingClientRect = jest.fn();
42
- range.getClientRects = jest.fn(() => ({
43
- item: () => null,
44
- length: 0,
45
- }));
46
- return range;
47
- };
48
- window.focus = jest.fn();
49
- describe('Wysiwyg render and actions buttons', () => {
50
- let renderedContainer;
51
- let getContainerByText;
52
- let containerQueryByText;
53
- let returnedValue;
54
- beforeEach(() => {
55
- const onChange = jest.fn(e => {
56
- returnedValue = e.target.value;
57
- });
58
- const { container, getByText, queryByText } = (0, react_1.render)(React.createElement(ThemeProvider_1.ThemeProvider, { theme: themes_1.lightTheme },
59
- React.createElement(react_intl_1.IntlProvider, { messages: {}, locale: "en" },
60
- React.createElement(index_1.default, { name: "rich-text", intlLabel: { id: 'hello world', defaultMessage: 'hello world' }, onChange: onChange, disabled: false }))));
61
- renderedContainer = container;
62
- getContainerByText = getByText;
63
- containerQueryByText = queryByText;
64
- });
65
- it('should render the Wysiwyg', async () => {
66
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
67
- expect(getContainerByText('hello world')).toBeInTheDocument();
68
- expect(renderedContainer.firstChild).toMatchInlineSnapshot(`
69
- .c4 {
70
- font-weight: 600;
71
- color: #32324d;
72
- font-size: 0.75rem;
73
- line-height: 1.33;
74
- }
75
-
76
- .c39 {
77
- color: #32324d;
78
- font-size: 0.875rem;
79
- line-height: 1.43;
80
- }
81
-
82
- .c5 {
83
- border-radius: 4px;
84
- border-style: solid;
85
- border-width: 1px;
86
- border-color: #dcdce4;
87
- }
88
-
89
- .c6 {
90
- background: #f6f6f9;
91
- padding: 8px;
92
- }
93
-
94
- .c35 {
95
- background: #f6f6f9;
96
- padding: 8px;
97
- border-radius: 4px;
98
- }
99
-
100
- .c0 {
101
- -webkit-align-items: stretch;
102
- -webkit-box-align: stretch;
103
- -ms-flex-align: stretch;
104
- align-items: stretch;
105
- display: -webkit-box;
106
- display: -webkit-flex;
107
- display: -ms-flexbox;
108
- display: flex;
109
- -webkit-flex-direction: column;
110
- -ms-flex-direction: column;
111
- flex-direction: column;
112
- }
113
-
114
- .c2 {
115
- -webkit-align-items: center;
116
- -webkit-box-align: center;
117
- -ms-flex-align: center;
118
- align-items: center;
119
- display: -webkit-box;
120
- display: -webkit-flex;
121
- display: -ms-flexbox;
122
- display: flex;
123
- -webkit-flex-direction: row;
124
- -ms-flex-direction: row;
125
- flex-direction: row;
126
- }
127
-
128
- .c1 > * {
129
- margin-top: 0;
130
- margin-bottom: 0;
131
- }
132
-
133
- .c1 > * + * {
134
- margin-top: 4px;
135
- }
136
-
137
- .c3 > * {
138
- margin-left: 0;
139
- margin-right: 0;
140
- }
141
-
142
- .c3 > * + * {
143
- margin-left: 4px;
144
- }
145
-
146
- .c32 {
147
- font-weight: 600;
148
- color: #32324d;
149
- font-size: 0.75rem;
150
- line-height: 1.33;
151
- }
152
-
153
- .c29 {
154
- display: -webkit-box;
155
- display: -webkit-flex;
156
- display: -ms-flexbox;
157
- display: flex;
158
- cursor: pointer;
159
- padding: 8px;
160
- border-radius: 4px;
161
- background: #ffffff;
162
- border: 1px solid #dcdce4;
163
- position: relative;
164
- outline: none;
165
- }
166
-
167
- .c29 svg {
168
- height: 12px;
169
- width: 12px;
170
- }
171
-
172
- .c29 svg > g,
173
- .c29 svg path {
174
- fill: #ffffff;
175
- }
176
-
177
- .c29[aria-disabled='true'] {
178
- pointer-events: none;
179
- }
180
-
181
- .c29:after {
182
- -webkit-transition-property: all;
183
- transition-property: all;
184
- -webkit-transition-duration: 0.2s;
185
- transition-duration: 0.2s;
186
- border-radius: 8px;
187
- content: '';
188
- position: absolute;
189
- top: -4px;
190
- bottom: -4px;
191
- left: -4px;
192
- right: -4px;
193
- border: 2px solid transparent;
194
- }
195
-
196
- .c29:focus-visible {
197
- outline: none;
198
- }
199
-
200
- .c29:focus-visible:after {
201
- border-radius: 8px;
202
- content: '';
203
- position: absolute;
204
- top: -5px;
205
- bottom: -5px;
206
- left: -5px;
207
- right: -5px;
208
- border: 2px solid #4945ff;
209
- }
210
-
211
- .c30 {
212
- -webkit-align-items: center;
213
- -webkit-box-align: center;
214
- -ms-flex-align: center;
215
- align-items: center;
216
- padding: 8px 16px;
217
- background: #4945ff;
218
- border: 1px solid #4945ff;
219
- border: 1px solid #dcdce4;
220
- background: #ffffff;
221
- }
222
-
223
- .c30 .sc-pVTFL {
224
- display: -webkit-box;
225
- display: -webkit-flex;
226
- display: -ms-flexbox;
227
- display: flex;
228
- -webkit-align-items: center;
229
- -webkit-box-align: center;
230
- -ms-flex-align: center;
231
- align-items: center;
232
- }
233
-
234
- .c30 .c31 {
235
- color: #ffffff;
236
- }
237
-
238
- .c30[aria-disabled='true'] {
239
- border: 1px solid #dcdce4;
240
- background: #eaeaef;
241
- }
242
-
243
- .c30[aria-disabled='true'] .c31 {
244
- color: #666687;
245
- }
246
-
247
- .c30[aria-disabled='true'] svg > g,
248
- .c30[aria-disabled='true'] svg path {
249
- fill: #666687;
250
- }
251
-
252
- .c30[aria-disabled='true']:active {
253
- border: 1px solid #dcdce4;
254
- background: #eaeaef;
255
- }
256
-
257
- .c30[aria-disabled='true']:active .c31 {
258
- color: #666687;
259
- }
260
-
261
- .c30[aria-disabled='true']:active svg > g,
262
- .c30[aria-disabled='true']:active svg path {
263
- fill: #666687;
264
- }
265
-
266
- .c30:hover {
267
- background-color: #f6f6f9;
268
- }
269
-
270
- .c30:active {
271
- background-color: #eaeaef;
272
- }
273
-
274
- .c30 .c31 {
275
- color: #32324d;
276
- }
277
-
278
- .c30 svg > g,
279
- .c30 svg path {
280
- fill: #32324d;
281
- }
282
-
283
- .c7 {
284
- -webkit-align-items: center;
285
- -webkit-box-align: center;
286
- -ms-flex-align: center;
287
- align-items: center;
288
- display: -webkit-box;
289
- display: -webkit-flex;
290
- display: -ms-flexbox;
291
- display: flex;
292
- -webkit-flex-direction: row;
293
- -ms-flex-direction: row;
294
- flex-direction: row;
295
- -webkit-box-pack: justify;
296
- -webkit-justify-content: space-between;
297
- -ms-flex-pack: justify;
298
- justify-content: space-between;
299
- }
300
-
301
- .c8 {
302
- -webkit-align-items: center;
303
- -webkit-box-align: center;
304
- -ms-flex-align: center;
305
- align-items: center;
306
- display: -webkit-box;
307
- display: -webkit-flex;
308
- display: -ms-flexbox;
309
- display: flex;
310
- -webkit-flex-direction: row;
311
- -ms-flex-direction: row;
312
- flex-direction: row;
313
- }
314
-
315
- .c36 {
316
- -webkit-align-items: flex-end;
317
- -webkit-box-align: flex-end;
318
- -ms-flex-align: flex-end;
319
- align-items: flex-end;
320
- display: -webkit-box;
321
- display: -webkit-flex;
322
- display: -ms-flexbox;
323
- display: flex;
324
- -webkit-flex-direction: row;
325
- -ms-flex-direction: row;
326
- flex-direction: row;
327
- -webkit-box-pack: end;
328
- -webkit-justify-content: flex-end;
329
- -ms-flex-pack: end;
330
- justify-content: flex-end;
331
- }
332
-
333
- .c24 {
334
- display: -webkit-box;
335
- display: -webkit-flex;
336
- display: -ms-flexbox;
337
- display: flex;
338
- cursor: pointer;
339
- padding: 8px;
340
- border-radius: 4px;
341
- background: #ffffff;
342
- border: 1px solid #dcdce4;
343
- position: relative;
344
- outline: none;
345
- }
346
-
347
- .c24 svg {
348
- height: 12px;
349
- width: 12px;
350
- }
351
-
352
- .c24 svg > g,
353
- .c24 svg path {
354
- fill: #ffffff;
355
- }
356
-
357
- .c24[aria-disabled='true'] {
358
- pointer-events: none;
359
- }
360
-
361
- .c24:after {
362
- -webkit-transition-property: all;
363
- transition-property: all;
364
- -webkit-transition-duration: 0.2s;
365
- transition-duration: 0.2s;
366
- border-radius: 8px;
367
- content: '';
368
- position: absolute;
369
- top: -4px;
370
- bottom: -4px;
371
- left: -4px;
372
- right: -4px;
373
- border: 2px solid transparent;
374
- }
375
-
376
- .c24:focus-visible {
377
- outline: none;
378
- }
379
-
380
- .c24:focus-visible:after {
381
- border-radius: 8px;
382
- content: '';
383
- position: absolute;
384
- top: -5px;
385
- bottom: -5px;
386
- left: -5px;
387
- right: -5px;
388
- border: 2px solid #4945ff;
389
- }
390
-
391
- .c21 {
392
- -webkit-align-items: center;
393
- -webkit-box-align: center;
394
- -ms-flex-align: center;
395
- align-items: center;
396
- display: -webkit-box;
397
- display: -webkit-flex;
398
- display: -ms-flexbox;
399
- display: flex;
400
- -webkit-flex-direction: row;
401
- -ms-flex-direction: row;
402
- flex-direction: row;
403
- }
404
-
405
- .c26 {
406
- display: -webkit-box;
407
- display: -webkit-flex;
408
- display: -ms-flexbox;
409
- display: flex;
410
- -webkit-align-items: center;
411
- -webkit-box-align: center;
412
- -ms-flex-align: center;
413
- align-items: center;
414
- -webkit-box-pack: center;
415
- -webkit-justify-content: center;
416
- -ms-flex-pack: center;
417
- justify-content: center;
418
- height: 2rem;
419
- width: 2rem;
420
- }
421
-
422
- .c26 svg > g,
423
- .c26 svg path {
424
- fill: #8e8ea9;
425
- }
426
-
427
- .c26:hover svg > g,
428
- .c26:hover svg path {
429
- fill: #666687;
430
- }
431
-
432
- .c26:active svg > g,
433
- .c26:active svg path {
434
- fill: #a5a5ba;
435
- }
436
-
437
- .c26[aria-disabled='true'] {
438
- background-color: #eaeaef;
439
- }
440
-
441
- .c26[aria-disabled='true'] svg path {
442
- fill: #666687;
443
- }
444
-
445
- .c22 span:first-child button {
446
- border-left: 1px solid #dcdce4;
447
- border-radius: 4px 0 0 4px;
448
- }
449
-
450
- .c22 span:last-child button {
451
- border-radius: 0 4px 4px 0;
452
- }
453
-
454
- .c22 .c25 {
455
- border-radius: 0;
456
- border-left: none;
457
- }
458
-
459
- .c22 .c25 svg path {
460
- fill: #4a4a6a;
461
- }
462
-
463
- .c22 .c25:hover {
464
- background-color: #f6f6f9;
465
- }
466
-
467
- .c22 .c25:hover svg path {
468
- fill: #32324d;
469
- }
470
-
471
- .c22 .c25:active {
472
- background-color: #eaeaef;
473
- }
474
-
475
- .c22 .c25:active svg path {
476
- fill: #212134;
477
- }
478
-
479
- .c22 .c25[aria-disabled='true'] svg path {
480
- fill: #666687;
481
- }
482
-
483
- .c13 {
484
- position: absolute;
485
- left: 0;
486
- right: 0;
487
- bottom: 0;
488
- top: 0;
489
- width: 100%;
490
- background: transparent;
491
- border: none;
492
- }
493
-
494
- .c13:focus {
495
- outline: none;
496
- }
497
-
498
- .c13[aria-disabled='true'] {
499
- cursor: not-allowed;
500
- }
501
-
502
- .c16 {
503
- padding-right: 16px;
504
- padding-left: 16px;
505
- }
506
-
507
- .c18 {
508
- padding-left: 12px;
509
- }
510
-
511
- .c9 {
512
- -webkit-align-items: stretch;
513
- -webkit-box-align: stretch;
514
- -ms-flex-align: stretch;
515
- align-items: stretch;
516
- display: -webkit-box;
517
- display: -webkit-flex;
518
- display: -ms-flexbox;
519
- display: flex;
520
- -webkit-flex-direction: column;
521
- -ms-flex-direction: column;
522
- flex-direction: column;
523
- }
524
-
525
- .c11 {
526
- -webkit-align-items: center;
527
- -webkit-box-align: center;
528
- -ms-flex-align: center;
529
- align-items: center;
530
- display: -webkit-box;
531
- display: -webkit-flex;
532
- display: -ms-flexbox;
533
- display: flex;
534
- -webkit-flex-direction: row;
535
- -ms-flex-direction: row;
536
- flex-direction: row;
537
- }
538
-
539
- .c14 {
540
- -webkit-align-items: center;
541
- -webkit-box-align: center;
542
- -ms-flex-align: center;
543
- align-items: center;
544
- display: -webkit-box;
545
- display: -webkit-flex;
546
- display: -ms-flexbox;
547
- display: flex;
548
- -webkit-flex-direction: row;
549
- -ms-flex-direction: row;
550
- flex-direction: row;
551
- -webkit-box-pack: justify;
552
- -webkit-justify-content: space-between;
553
- -ms-flex-pack: justify;
554
- justify-content: space-between;
555
- }
556
-
557
- .c17 {
558
- color: #666687;
559
- display: block;
560
- white-space: nowrap;
561
- overflow: hidden;
562
- text-overflow: ellipsis;
563
- font-size: 0.875rem;
564
- line-height: 1.43;
565
- }
566
-
567
- .c10 > * {
568
- margin-top: 0;
569
- margin-bottom: 0;
570
- }
571
-
572
- .c12 {
573
- position: relative;
574
- border: 1px solid #dcdce4;
575
- padding-right: 12px;
576
- border-radius: 4px;
577
- background: #ffffff;
578
- overflow: hidden;
579
- min-height: 2rem;
580
- outline: none;
581
- box-shadow: 0;
582
- -webkit-transition-property: border-color,box-shadow,fill;
583
- transition-property: border-color,box-shadow,fill;
584
- -webkit-transition-duration: 0.2s;
585
- transition-duration: 0.2s;
586
- }
587
-
588
- .c12:focus-within {
589
- border: 1px solid #4945ff;
590
- box-shadow: #4945ff 0px 0px 0px 2px;
591
- }
592
-
593
- .c19 {
594
- background: transparent;
595
- border: none;
596
- position: relative;
597
- z-index: 1;
598
- }
599
-
600
- .c19 svg {
601
- height: 0.6875rem;
602
- width: 0.6875rem;
603
- }
604
-
605
- .c19 svg path {
606
- fill: #666687;
607
- }
608
-
609
- .c20 {
610
- display: -webkit-box;
611
- display: -webkit-flex;
612
- display: -ms-flexbox;
613
- display: flex;
614
- background: none;
615
- border: none;
616
- }
617
-
618
- .c20 svg {
619
- width: 0.375rem;
620
- }
621
-
622
- .c15 {
623
- width: 100%;
624
- }
625
-
626
- .c34 {
627
- cursor: auto;
628
- height: 100%;
629
- }
630
-
631
- .c34 .CodeMirror-placeholder {
632
- color: #666687 !important;
633
- }
634
-
635
- .c34 .CodeMirror {
636
- font-size: 0.875rem;
637
- height: 290px;
638
- color: #32324d;
639
- direction: ltr;
640
- font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell, 'Open Sans','Helvetica Neue',sans-serif;
641
- }
642
-
643
- .c34 .CodeMirror-lines {
644
- padding: 12px 16px;
645
- }
646
-
647
- .c34 .CodeMirror-scrollbar-filler,
648
- .c34 .CodeMirror-gutter-filler {
649
- background-color: #ffffff;
650
- }
651
-
652
- .c34 .CodeMirror-gutters {
653
- border-right: 1px solid #ddd;
654
- background-color: #f7f7f7;
655
- white-space: nowrap;
656
- }
657
-
658
- .c34 .CodeMirror-linenumber {
659
- padding: 0 3px 0 5px;
660
- min-width: 20px;
661
- text-align: right;
662
- color: #999;
663
- white-space: nowrap;
664
- }
665
-
666
- .c34 .CodeMirror-guttermarker {
667
- color: black;
668
- }
669
-
670
- .c34 .CodeMirror-guttermarker-subtle {
671
- color: #999;
672
- }
673
-
674
- .c34 .CodeMirror-cursor {
675
- border-left: 1px solid black;
676
- border-right: none;
677
- width: 0;
678
- }
679
-
680
- .c34 .CodeMirror div.CodeMirror-secondarycursor {
681
- border-left: 1px solid silver;
682
- }
683
-
684
- .c34 .cm-fat-cursor .CodeMirror-cursor {
685
- width: auto;
686
- border: 0 !important;
687
- background: #7e7;
688
- }
689
-
690
- .c34 .cm-fat-cursor-mark {
691
- background-color: rgba(20,255,20,0.5);
692
- -webkit-animation: blink 1.06s steps(1) infinite;
693
- -moz-animation: blink 1.06s steps(1) infinite;
694
- -webkit-animation: blink 1.06s steps(1) infinite;
695
- animation: blink 1.06s steps(1) infinite;
696
- }
697
-
698
- .c34 .cm-animate-fat-cursor {
699
- width: auto;
700
- border: 0;
701
- -webkit-animation: blink 1.06s steps(1) infinite;
702
- -moz-animation: blink 1.06s steps(1) infinite;
703
- -webkit-animation: blink 1.06s steps(1) infinite;
704
- animation: blink 1.06s steps(1) infinite;
705
- background-color: #7e7;
706
- }
707
-
708
- .c34 .cm-tab {
709
- display: inline-block;
710
- -webkit-text-decoration: inherit;
711
- text-decoration: inherit;
712
- }
713
-
714
- .c34 .CodeMirror-rulers {
715
- position: absolute;
716
- left: 0;
717
- right: 0;
718
- top: -50px;
719
- bottom: 0;
720
- overflow: hidden;
721
- }
722
-
723
- .c34 .CodeMirror-ruler {
724
- border-left: 1px solid #ccc;
725
- top: 0;
726
- bottom: 0;
727
- position: absolute;
728
- }
729
-
730
- .c34 .cm-header,
731
- .c34 .cm-strong {
732
- font-weight: bold;
733
- }
734
-
735
- .c34 .cm-em {
736
- font-style: italic;
737
- }
738
-
739
- .c34 .cm-link {
740
- -webkit-text-decoration: underline;
741
- text-decoration: underline;
742
- }
743
-
744
- .c34 .cm-strikethrough {
745
- -webkit-text-decoration: line-through;
746
- text-decoration: line-through;
747
- }
748
-
749
- .c34 .CodeMirror-composing {
750
- border-bottom: 2px solid;
751
- }
752
-
753
- .c34 div.CodeMirror span.CodeMirror-matchingbracket {
754
- color: #0b0;
755
- }
756
-
757
- .c34 div.CodeMirror span.CodeMirror-nonmatchingbracket {
758
- color: #a22;
759
- }
760
-
761
- .c34 .CodeMirror-matchingtag {
762
- background: rgba(255,150,0,0.3);
763
- }
764
-
765
- .c34 .CodeMirror-activeline-background {
766
- background: #e8f2ff;
767
- }
768
-
769
- .c34 .CodeMirror {
770
- position: relative;
771
- overflow: hidden;
772
- background: #ffffff;
773
- }
774
-
775
- .c34 .CodeMirror-scroll {
776
- overflow: scroll !important;
777
- margin-bottom: -50px;
778
- margin-right: -50px;
779
- padding-bottom: 50px;
780
- height: 100%;
781
- outline: none;
782
- position: relative;
783
- }
784
-
785
- .c34 .CodeMirror-sizer {
786
- position: relative;
787
- border-right: 50px solid transparent;
788
- }
789
-
790
- .c34 .CodeMirror-vscrollbar,
791
- .c34 .CodeMirror-hscrollbar,
792
- .c34 .CodeMirror-scrollbar-filler,
793
- .c34 .CodeMirror-gutter-filler {
794
- position: absolute;
795
- z-index: 1;
796
- display: none;
797
- outline: none;
798
- }
799
-
800
- .c34 .CodeMirror-vscrollbar {
801
- right: 0;
802
- top: 0;
803
- overflow-x: hidden;
804
- overflow-y: scroll;
805
- }
806
-
807
- .c34 .CodeMirror-hscrollbar {
808
- bottom: 0;
809
- left: 0;
810
- overflow-y: hidden;
811
- overflow-x: scroll;
812
- }
813
-
814
- .c34 .CodeMirror-scrollbar-filler {
815
- right: 0;
816
- bottom: 0;
817
- }
818
-
819
- .c34 .CodeMirror-lines {
820
- cursor: text;
821
- min-height: 1px;
822
- }
823
-
824
- .c34 .CodeMirror pre.CodeMirror-line,
825
- .c34 .CodeMirror pre.CodeMirror-line-like {
826
- -moz-border-radius: 0;
827
- -webkit-border-radius: 0;
828
- border-radius: 0;
829
- border-width: 0;
830
- background: transparent;
831
- font-family: inherit;
832
- font-size: inherit;
833
- margin: 0;
834
- white-space: pre;
835
- word-wrap: normal;
836
- line-height: 1.5;
837
- color: inherit;
838
- position: relative;
839
- overflow: visible;
840
- -webkit-tap-highlight-color: transparent;
841
- -webkit-font-variant-ligatures: contextual;
842
- font-variant-ligatures: contextual;
843
- }
844
-
845
- .c34 .CodeMirror pre.CodeMirror-line-like {
846
- z-index: 2;
847
- }
848
-
849
- .c34 .CodeMirror-wrap pre.CodeMirror-line,
850
- .c34 .CodeMirror-wrap pre.CodeMirror-line-like {
851
- word-wrap: break-word;
852
- white-space: pre-wrap;
853
- word-break: normal;
854
- }
855
-
856
- .c34 .CodeMirror-linebackground {
857
- position: absolute;
858
- left: 0;
859
- right: 0;
860
- top: 0;
861
- bottom: 0;
862
- z-index: 0;
863
- }
864
-
865
- .c34 .CodeMirror-linewidget {
866
- position: relative;
867
- padding: 0.1px;
868
- }
869
-
870
- .c34 .CodeMirror-rtl pre {
871
- direction: rtl;
872
- }
873
-
874
- .c34 .CodeMirror-code {
875
- outline: none;
876
- }
877
-
878
- .c34 .CodeMirror-scroll,
879
- .c34 .CodeMirror-sizer,
880
- .c34 .CodeMirror-gutter,
881
- .c34 .CodeMirror-gutters,
882
- .c34 .CodeMirror-linenumber {
883
- -moz-box-sizing: content-box;
884
- box-sizing: content-box;
885
- }
886
-
887
- .c34 .CodeMirror-measure {
888
- position: absolute;
889
- width: 100%;
890
- height: 0;
891
- overflow: hidden;
892
- visibility: hidden;
893
- }
894
-
895
- .c34 .CodeMirror-cursor {
896
- position: absolute;
897
- pointer-events: none;
898
- border-color: #32324d;
899
- }
900
-
901
- .c34 .CodeMirror-measure pre {
902
- position: static;
903
- }
904
-
905
- .c34 div.CodeMirror-cursors {
906
- visibility: hidden;
907
- position: relative;
908
- }
909
-
910
- .c34 div.CodeMirror-cursors + div {
911
- z-index: 0 !important;
912
- }
913
-
914
- .c34 div.CodeMirror-dragcursors {
915
- visibility: visible;
916
- }
917
-
918
- .c34 .CodeMirror-focused div.CodeMirror-cursors {
919
- visibility: visible;
920
- }
921
-
922
- .c34 .CodeMirror-selected {
923
- background: #dcdce4;
924
- }
925
-
926
- .c34 .CodeMirror-crosshair {
927
- cursor: crosshair;
928
- }
929
-
930
- .c34 .cm-force-border {
931
- padding-right: 0.1px;
932
- }
933
-
934
- .c34 .cm-tab-wrap-hack:after {
935
- content: '';
936
- }
937
-
938
- .c34 span.CodeMirror-selectedtext {
939
- background: none;
940
- }
941
-
942
- .c34 span {
943
- color: #32324d !important;
944
- }
945
-
946
- .c37 {
947
- display: -webkit-box;
948
- display: -webkit-flex;
949
- display: -ms-flexbox;
950
- display: flex;
951
- cursor: pointer;
952
- padding: 8px;
953
- border-radius: 4px;
954
- background: #ffffff;
955
- border: 1px solid #dcdce4;
956
- position: relative;
957
- outline: none;
958
- }
959
-
960
- .c37 svg {
961
- height: 12px;
962
- width: 12px;
963
- }
964
-
965
- .c37 svg > g,
966
- .c37 svg path {
967
- fill: #ffffff;
968
- }
969
-
970
- .c37[aria-disabled='true'] {
971
- pointer-events: none;
972
- }
973
-
974
- .c37:after {
975
- -webkit-transition-property: all;
976
- transition-property: all;
977
- -webkit-transition-duration: 0.2s;
978
- transition-duration: 0.2s;
979
- border-radius: 8px;
980
- content: '';
981
- position: absolute;
982
- top: -4px;
983
- bottom: -4px;
984
- left: -4px;
985
- right: -4px;
986
- border: 2px solid transparent;
987
- }
988
-
989
- .c37:focus-visible {
990
- outline: none;
991
- }
992
-
993
- .c37:focus-visible:after {
994
- border-radius: 8px;
995
- content: '';
996
- position: absolute;
997
- top: -5px;
998
- bottom: -5px;
999
- left: -5px;
1000
- right: -5px;
1001
- border: 2px solid #4945ff;
1002
- }
1003
-
1004
- .c27 {
1005
- padding: 8px;
1006
- outline-offset: -2px !important;
1007
- }
1008
-
1009
- .c27 svg {
1010
- width: 1.125rem;
1011
- height: 1.125rem;
1012
- }
1013
-
1014
- .c23 {
1015
- margin-left: 16px;
1016
- }
1017
-
1018
- .c28 {
1019
- margin: 0 8px;
1020
- padding: 8px;
1021
- }
1022
-
1023
- .c28 svg {
1024
- width: 1.125rem;
1025
- height: 1.125rem;
1026
- }
1027
-
1028
- .c33 {
1029
- position: relative;
1030
- height: calc(100% - 48px);
1031
- }
1032
-
1033
- .c38 {
1034
- background-color: transparent;
1035
- border: none;
1036
- -webkit-align-items: center;
1037
- -webkit-box-align: center;
1038
- -ms-flex-align: center;
1039
- align-items: center;
1040
- }
1041
-
1042
- .c38 svg {
1043
- margin-left: 8px;
1044
- }
1045
-
1046
- .c38 svg path {
1047
- fill: #4a4a6a;
1048
- width: 0.75rem;
1049
- height: 0.75rem;
1050
- }
1051
-
1052
- <div
1053
- class="c0 c1"
1054
- spacing="1"
1055
- >
1056
- <div
1057
- class="c2 c3"
1058
- spacing="1"
1059
- >
1060
- <span
1061
- class="c4"
1062
- >
1063
- hello world
1064
- </span>
1065
- </div>
1066
- <div
1067
- class="c5"
1068
- >
1069
- <div
1070
- class="c6"
1071
- >
1072
- <div
1073
- class="c7"
1074
- >
1075
- <div
1076
- class="c8"
1077
- >
1078
- <div>
1079
- <div
1080
- class="c9 c10"
1081
- >
1082
- <div
1083
- class="c11 c12"
1084
- >
1085
- <button
1086
- aria-disabled="false"
1087
- aria-expanded="false"
1088
- aria-haspopup="listbox"
1089
- aria-labelledby="selectTitle-label selectTitle-content"
1090
- class="c13"
1091
- id="selectTitle"
1092
- type="button"
1093
- />
1094
- <div
1095
- class="c14 c15"
1096
- >
1097
- <div
1098
- class="c11"
1099
- >
1100
- <div
1101
- class="c16"
1102
- >
1103
- <span
1104
- class="c17"
1105
- id="selectTitle-content"
1106
- >
1107
- Add a title
1108
- </span>
1109
- </div>
1110
- </div>
1111
- <div
1112
- class="c11"
1113
- >
1114
- <button
1115
- aria-hidden="true"
1116
- class="c18 c19 c20"
1117
- tabindex="-1"
1118
- type="button"
1119
- >
1120
- <svg
1121
- fill="none"
1122
- height="1em"
1123
- viewBox="0 0 14 8"
1124
- width="1em"
1125
- xmlns="http://www.w3.org/2000/svg"
1126
- >
1127
- <path
1128
- clip-rule="evenodd"
1129
- d="M14 .889a.86.86 0 01-.26.625L7.615 7.736A.834.834 0 017 8a.834.834 0 01-.615-.264L.26 1.514A.861.861 0 010 .889c0-.24.087-.45.26-.625A.834.834 0 01.875 0h12.25c.237 0 .442.088.615.264a.86.86 0 01.26.625z"
1130
- fill="#32324D"
1131
- fill-rule="evenodd"
1132
- />
1133
- </svg>
1134
- </button>
1135
- </div>
1136
- </div>
1137
- </div>
1138
- </div>
1139
- </div>
1140
- <div
1141
- class="c21 c22 c23"
1142
- >
1143
- <span>
1144
- <button
1145
- aria-disabled="false"
1146
- aria-labelledby="tooltip-1"
1147
- class="c24 c25 c26 c27"
1148
- id="Bold"
1149
- name="Bold"
1150
- tabindex="0"
1151
- type="button"
1152
- >
1153
- <svg
1154
- fill="none"
1155
- height="1em"
1156
- viewBox="0 0 24 24"
1157
- width="1em"
1158
- xmlns="http://www.w3.org/2000/svg"
1159
- >
1160
- <path
1161
- clip-rule="evenodd"
1162
- d="M9.778 6H8v12h1.778V6zm6.444 3.333a3.32 3.32 0 01-.85 2.222 3.533 3.533 0 011.517 2.89c0 1.96-1.627 3.555-3.627 3.555H9.778v-1.777h3.484c1.02 0 1.85-.798 1.85-1.778s-.83-1.778-1.85-1.778H9.778v-1.778h3.111c.858 0 1.556-.698 1.556-1.556 0-.857-.698-1.555-1.556-1.555H9.778V6h3.111a3.337 3.337 0 013.333 3.333z"
1163
- fill="#32324D"
1164
- fill-rule="evenodd"
1165
- />
1166
- </svg>
1167
- </button>
1168
- </span>
1169
- <span>
1170
- <button
1171
- aria-disabled="false"
1172
- aria-labelledby="tooltip-3"
1173
- class="c24 c25 c26 c27"
1174
- id="Italic"
1175
- name="Italic"
1176
- tabindex="0"
1177
- type="button"
1178
- >
1179
- <svg
1180
- fill="none"
1181
- height="1em"
1182
- viewBox="0 0 24 24"
1183
- width="1em"
1184
- xmlns="http://www.w3.org/2000/svg"
1185
- >
1186
- <path
1187
- clip-rule="evenodd"
1188
- d="M16.4 6h-5.6v1.6h1.693l-2.253 8.8H8V18h5.6v-1.6h-1.76l2.253-8.8H16.4V6z"
1189
- fill="#32324D"
1190
- fill-rule="evenodd"
1191
- />
1192
- </svg>
1193
- </button>
1194
- </span>
1195
- <span>
1196
- <button
1197
- aria-disabled="false"
1198
- aria-labelledby="tooltip-5"
1199
- class="c24 c25 c26 c27"
1200
- id="Underline"
1201
- name="Underline"
1202
- tabindex="0"
1203
- type="button"
1204
- >
1205
- <svg
1206
- fill="none"
1207
- height="1em"
1208
- viewBox="0 0 24 24"
1209
- width="1em"
1210
- xmlns="http://www.w3.org/2000/svg"
1211
- >
1212
- <path
1213
- d="M12 15.2a4.358 4.358 0 002.992-1.172A3.892 3.892 0 0016.23 11.2V6h-1.693v5.2c0 .636-.267 1.247-.743 1.697A2.615 2.615 0 0112 13.6a2.615 2.615 0 01-1.795-.703 2.336 2.336 0 01-.743-1.697V6H7.769v5.2c0 1.06.446 2.078 1.24 2.828A4.358 4.358 0 0012 15.2zM17.5 16.4h-11V18h11v-1.6z"
1214
- fill="#32324D"
1215
- />
1216
- </svg>
1217
- </button>
1218
- </span>
1219
- </div>
1220
- <span>
1221
- <button
1222
- aria-disabled="false"
1223
- aria-labelledby="tooltip-7"
1224
- class="c24 c25 c26 c28"
1225
- id="more"
1226
- tabindex="0"
1227
- type="button"
1228
- >
1229
- <svg
1230
- fill="none"
1231
- height="1em"
1232
- viewBox="0 0 24 24"
1233
- width="1em"
1234
- xmlns="http://www.w3.org/2000/svg"
1235
- >
1236
- <path
1237
- d="M7.3 13.8a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM12.3 13.8a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM17.3 13.8a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"
1238
- fill="#32324D"
1239
- />
1240
- </svg>
1241
- </button>
1242
- </span>
1243
- </div>
1244
- <button
1245
- aria-disabled="false"
1246
- class="c29 c30"
1247
- id="preview"
1248
- type="button"
1249
- >
1250
- <span
1251
- class="c31 c32"
1252
- >
1253
- Preview mode
1254
- </span>
1255
- </button>
1256
- </div>
1257
- </div>
1258
- <div
1259
- class="c33"
1260
- >
1261
- <div
1262
- class="c34"
1263
- >
1264
- <textarea
1265
- style="display: none;"
1266
- />
1267
- <div
1268
- class="CodeMirror cm-s-default CodeMirror-wrap"
1269
- translate="no"
1270
- >
1271
- <div
1272
- class="CodeMirror-vscrollbar"
1273
- cm-not-content="true"
1274
- tabindex="-1"
1275
- >
1276
- <div
1277
- style="min-width: 1px;"
1278
- />
1279
- </div>
1280
- <div
1281
- class="CodeMirror-hscrollbar"
1282
- cm-not-content="true"
1283
- tabindex="-1"
1284
- >
1285
- <div
1286
- style="height: 100%; min-height: 1px;"
1287
- />
1288
- </div>
1289
- <div
1290
- class="CodeMirror-scrollbar-filler"
1291
- cm-not-content="true"
1292
- />
1293
- <div
1294
- class="CodeMirror-gutter-filler"
1295
- cm-not-content="true"
1296
- />
1297
- <div
1298
- class="CodeMirror-scroll"
1299
- tabindex="-1"
1300
- >
1301
- <div
1302
- class="CodeMirror-sizer"
1303
- style="margin-left: 0px;"
1304
- >
1305
- <div
1306
- style="position: relative;"
1307
- >
1308
- <div
1309
- class="CodeMirror-lines"
1310
- role="presentation"
1311
- >
1312
- <div
1313
- role="presentation"
1314
- style="position: relative; outline: none;"
1315
- >
1316
- <div
1317
- class="CodeMirror-measure"
1318
- >
1319
- <pre
1320
- class="CodeMirror-line-like"
1321
- >
1322
- <span>
1323
- xxxxxxxxxx
1324
- </span>
1325
- </pre>
1326
- </div>
1327
- <div
1328
- class="CodeMirror-measure"
1329
- />
1330
- <div
1331
- style="position: relative; z-index: 1;"
1332
- />
1333
- <div
1334
- class="CodeMirror-cursors"
1335
- />
1336
- <div
1337
- aria-label="Editor"
1338
- autocapitalize="off"
1339
- autocorrect="off"
1340
- class="CodeMirror-code"
1341
- role="presentation"
1342
- spellcheck="true"
1343
- tabindex="0"
1344
- />
1345
- </div>
1346
- </div>
1347
- </div>
1348
- </div>
1349
- <div
1350
- style="position: absolute; height: 50px; width: 1px;"
1351
- />
1352
- <div
1353
- class="CodeMirror-gutters"
1354
- style="display: none;"
1355
- />
1356
- </div>
1357
- </div>
1358
- </div>
1359
- </div>
1360
- <div
1361
- class="c35"
1362
- >
1363
- <div
1364
- class="c36"
1365
- >
1366
- <button
1367
- aria-disabled="false"
1368
- class="c37 c38"
1369
- id="expand"
1370
- type="button"
1371
- >
1372
- <span
1373
- class="c39"
1374
- >
1375
- Expand
1376
- </span>
1377
- <svg
1378
- fill="none"
1379
- height="1em"
1380
- viewBox="0 0 12 12"
1381
- width="1em"
1382
- xmlns="http://www.w3.org/2000/svg"
1383
- >
1384
- <path
1385
- d="M1.371 1.371h2.743V0H0v4.114h1.371V1.371zM7.886 1.371h2.743v2.743H12V0H7.886v1.371zM0 12h4.114v-1.372H1.371V7.885H0v4.114zM10.629 10.628H7.886v1.371H12V7.885h-1.371v2.743z"
1386
- fill="#32324D"
1387
- />
1388
- </svg>
1389
- </button>
1390
- </div>
1391
- </div>
1392
- </div>
1393
- </div>
1394
- `);
1395
- });
1396
- it('should render bold markdown when clicking the bold button', async () => {
1397
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1398
- react_1.fireEvent.click(renderedContainer.querySelector('#Bold'));
1399
- expect(getContainerByText('**Bold**')).toBeInTheDocument();
1400
- });
1401
- it('should render italic markdown when clicking the italic button', async () => {
1402
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1403
- react_1.fireEvent.click(renderedContainer.querySelector('#Italic'));
1404
- expect(getContainerByText('_Italic_')).toBeInTheDocument();
1405
- });
1406
- it('should render underline markdown when clicking the underline button', async () => {
1407
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1408
- react_1.fireEvent.click(renderedContainer.querySelector('#Underline'));
1409
- const hasUnderlineMarkdown = getContainerByText((content, node) => {
1410
- const hasText = node => node.textContent === '<u>Underline</u>';
1411
- const nodeHasText = hasText(node);
1412
- const childrenDontHaveText = Array.from(node.children).every(child => !hasText(child));
1413
- return nodeHasText && childrenDontHaveText;
1414
- });
1415
- expect(hasUnderlineMarkdown).toBeInTheDocument();
1416
- });
1417
- it('should render strikethrough markdown when clicking the strikethrough button', async () => {
1418
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1419
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1420
- react_1.fireEvent.click(document.getElementById('Strikethrough'));
1421
- expect(getContainerByText('~~Strikethrough~~')).toBeInTheDocument();
1422
- });
1423
- it('should render bullet list markdown when clicking the bullet list button', async () => {
1424
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1425
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1426
- react_1.fireEvent.click(document.getElementById('BulletList'));
1427
- expect(getContainerByText('-')).toBeInTheDocument();
1428
- });
1429
- it('should render number list markdown when clicking the number list button', async () => {
1430
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1431
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1432
- react_1.fireEvent.click(document.getElementById('NumberList'));
1433
- expect(getContainerByText('1.')).toBeInTheDocument();
1434
- });
1435
- it('should render code markdown when clicking the code button', async () => {
1436
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1437
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1438
- react_1.fireEvent.click(document.getElementById('Code'));
1439
- const expected = `
1440
- \`\`\`
1441
- Code
1442
- \`\`\``;
1443
- expect(returnedValue).toEqual(expected);
1444
- });
1445
- it('should render link markdown when clicking the link button', async () => {
1446
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1447
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1448
- react_1.fireEvent.click(document.getElementById('Link'));
1449
- expect(getContainerByText('[Link](link)')).toBeInTheDocument();
1450
- });
1451
- it('should render quote markdown when clicking the quote button', async () => {
1452
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1453
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1454
- react_1.fireEvent.click(document.getElementById('Quote'));
1455
- expect(getContainerByText('>Quote')).toBeInTheDocument();
1456
- });
1457
- it('should render h1 markdown when clicking the h1 button', async () => {
1458
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1459
- react_1.fireEvent.mouseDown(renderedContainer.querySelector('#selectTitle'));
1460
- react_1.fireEvent.click(getContainerByText('h1'));
1461
- expect(getContainerByText('#')).toBeInTheDocument();
1462
- });
1463
- it('should render h2 markdown when clicking the h2 button', async () => {
1464
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1465
- react_1.fireEvent.mouseDown(renderedContainer.querySelector('#selectTitle'));
1466
- react_1.fireEvent.click(getContainerByText('h2'));
1467
- expect(getContainerByText('##')).toBeInTheDocument();
1468
- });
1469
- it('should render h3 markdown when clicking the h3 button', async () => {
1470
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1471
- react_1.fireEvent.mouseDown(renderedContainer.querySelector('#selectTitle'));
1472
- react_1.fireEvent.click(getContainerByText('h3'));
1473
- expect(getContainerByText('###')).toBeInTheDocument();
1474
- });
1475
- it('should render h4 markdown when clicking the h4 button', async () => {
1476
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1477
- react_1.fireEvent.mouseDown(renderedContainer.querySelector('#selectTitle'));
1478
- react_1.fireEvent.click(getContainerByText('h4'));
1479
- expect(getContainerByText('####')).toBeInTheDocument();
1480
- });
1481
- it('should render h5 markdown when clicking the h5 button', async () => {
1482
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1483
- react_1.fireEvent.mouseDown(renderedContainer.querySelector('#selectTitle'));
1484
- react_1.fireEvent.click(getContainerByText('h5'));
1485
- expect(getContainerByText('#####')).toBeInTheDocument();
1486
- });
1487
- it('should render h6 markdown when clicking the h6 button', async () => {
1488
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1489
- react_1.fireEvent.mouseDown(renderedContainer.querySelector('#selectTitle'));
1490
- react_1.fireEvent.click(getContainerByText('h6'));
1491
- expect(getContainerByText('######')).toBeInTheDocument();
1492
- });
1493
- it('should render h1 markdown when clicking the h4 button then clicking on the h1 button', async () => {
1494
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1495
- react_1.fireEvent.mouseDown(renderedContainer.querySelector('#selectTitle'));
1496
- react_1.fireEvent.click(getContainerByText('h1'));
1497
- react_1.fireEvent.mouseDown(renderedContainer.querySelector('#selectTitle'));
1498
- react_1.fireEvent.click(getContainerByText('h4'));
1499
- react_1.fireEvent.mouseDown(renderedContainer.querySelector('#selectTitle'));
1500
- react_1.fireEvent.click(getContainerByText('h1'));
1501
- expect(containerQueryByText('####')).not.toBeInTheDocument();
1502
- expect(getContainerByText('#')).toBeInTheDocument();
1503
- });
1504
- it('should disable bold button when editor is on preview mode', async () => {
1505
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1506
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1507
- react_1.fireEvent.click(renderedContainer.querySelector('#Bold'));
1508
- expect(containerQueryByText('**Bold**')).not.toBeInTheDocument();
1509
- });
1510
- it('should disable italic button when editor is on preview mode', async () => {
1511
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1512
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1513
- react_1.fireEvent.click(renderedContainer.querySelector('#Italic'));
1514
- expect(containerQueryByText('_Italic_')).not.toBeInTheDocument();
1515
- });
1516
- it('should disable underline button when editor is on preview mode', async () => {
1517
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1518
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1519
- react_1.fireEvent.click(renderedContainer.querySelector('#Underline'));
1520
- const hasUnderlineMarkdown = containerQueryByText((content, node) => {
1521
- const hasText = node => node.textContent === '<u>Underline</u>';
1522
- const nodeHasText = hasText(node);
1523
- const childrenDontHaveText = Array.from(node.children).every(child => !hasText(child));
1524
- return nodeHasText && childrenDontHaveText;
1525
- });
1526
- expect(hasUnderlineMarkdown).not.toBeInTheDocument();
1527
- });
1528
- it('should disable strikethrough button when editor is on preview mode', async () => {
1529
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1530
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1531
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1532
- expect(document.getElementById('Strikethrough')).not.toBeInTheDocument();
1533
- });
1534
- it('should disable bullet list button when editor is on preview mode', async () => {
1535
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1536
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1537
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1538
- expect(document.getElementById('BulletList')).not.toBeInTheDocument();
1539
- });
1540
- it('should disable number list button when editor is on preview mode', async () => {
1541
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1542
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1543
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1544
- expect(document.getElementById('NumbertList')).not.toBeInTheDocument();
1545
- });
1546
- it('should disable code button when editor is on preview mode', async () => {
1547
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1548
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1549
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1550
- expect(document.getElementById('BulletList')).not.toBeInTheDocument();
1551
- });
1552
- it('should disable image button when editor is on preview mode', async () => {
1553
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1554
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1555
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1556
- expect(document.getElementById('Image')).not.toBeInTheDocument();
1557
- });
1558
- it('should disable link button when editor is on preview mode', async () => {
1559
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1560
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1561
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1562
- expect(document.getElementById('Link')).not.toBeInTheDocument();
1563
- });
1564
- it('should disable quote button when editor is on preview mode', async () => {
1565
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1566
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1567
- react_1.fireEvent.click(renderedContainer.querySelector('#more'));
1568
- expect(document.getElementById('Quote')).not.toBeInTheDocument();
1569
- });
1570
- it('should disable titles buttons when editor is on preview mode', async () => {
1571
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1572
- react_1.fireEvent.click(renderedContainer.querySelector('#preview'));
1573
- react_1.fireEvent.mouseDown(renderedContainer.querySelector('#selectTitle'));
1574
- expect(document.getElementById('h1')).not.toBeInTheDocument();
1575
- expect(document.getElementById('h2')).not.toBeInTheDocument();
1576
- expect(document.getElementById('h2')).not.toBeInTheDocument();
1577
- expect(document.getElementById('h3')).not.toBeInTheDocument();
1578
- expect(document.getElementById('h4')).not.toBeInTheDocument();
1579
- expect(document.getElementById('h5')).not.toBeInTheDocument();
1580
- expect(document.getElementById('h6')).not.toBeInTheDocument();
1581
- });
1582
- });
1583
- describe('Wysiwyg render actions with initial value', () => {
1584
- let renderedContainer;
1585
- let returnedValue = 'hello world';
1586
- beforeEach(() => {
1587
- const onChange = jest.fn(e => {
1588
- returnedValue += e.target.value;
1589
- });
1590
- const { container } = (0, react_1.render)(React.createElement(ThemeProvider_1.ThemeProvider, { theme: themes_1.lightTheme },
1591
- React.createElement(react_intl_1.IntlProvider, { messages: {}, locale: "en" },
1592
- React.createElement(index_1.default, { intlLabel: { id: 'hello world', defaultMessage: 'hello world' }, name: "rich-text", onChange: onChange }))));
1593
- renderedContainer = container;
1594
- });
1595
- it('should add markdown with initial value', async () => {
1596
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1597
- expect(returnedValue).toEqual('hello world');
1598
- const expected = `${returnedValue}**Bold**`;
1599
- react_1.fireEvent.click(renderedContainer.querySelector('#Bold'));
1600
- expect(returnedValue).toEqual(expected);
1601
- });
1602
- });
1603
- describe('Wysiwyg expand mode', () => {
1604
- let renderedContainer;
1605
- beforeEach(() => {
1606
- const { container } = (0, react_1.render)(React.createElement(ThemeProvider_1.ThemeProvider, { theme: themes_1.lightTheme },
1607
- React.createElement(react_intl_1.IntlProvider, { messages: {}, locale: "en" },
1608
- React.createElement(index_1.default, { intlLabel: { id: 'hello world', defaultMessage: 'hello world' }, name: "rich-text", onChange: jest.fn() }))));
1609
- renderedContainer = container;
1610
- });
1611
- it('should open wysiwyg expand portal when clicking on expand button', async () => {
1612
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1613
- expect(document.getElementById('wysiwyg-expand')).not.toBeInTheDocument();
1614
- react_1.fireEvent.click(renderedContainer.querySelector('#expand'));
1615
- expect(document.getElementById('wysiwyg-expand')).toBeInTheDocument();
1616
- });
1617
- it('should close wysiwyg expand portal when clicking on collapse button', async () => {
1618
- await (0, react_1.waitFor)(() => renderedContainer.querySelector('.CodeMirror-cursor'));
1619
- react_1.fireEvent.click(renderedContainer.querySelector('#expand'));
1620
- react_1.fireEvent.click(document.getElementById('collapse'));
1621
- expect(document.getElementById('wysiwyg-expand')).not.toBeInTheDocument();
1622
- });
1623
- });
1624
- describe('Wysiwyg error state', () => {
1625
- it('should show error message', async () => {
1626
- const { container, getByText } = (0, react_1.render)(React.createElement(ThemeProvider_1.ThemeProvider, { theme: themes_1.lightTheme },
1627
- React.createElement(react_intl_1.IntlProvider, { messages: {}, locale: "en" },
1628
- React.createElement(index_1.default, { intlLabel: { id: 'richtext', defaultMessage: 'richtext' }, name: "rich-text", onChange: jest.fn(), error: "This is a required field" }))));
1629
- await (0, react_1.waitFor)(() => container.querySelector('.CodeMirror-cursor'));
1630
- expect(getByText('This is a required field')).toBeInTheDocument();
1631
- });
1632
- });
1633
- //# sourceMappingURL=index.test.js.map