@instructure/canvas-rce 6.0.0 → 7.2.0

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 (120) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/__tests__/common/indicate.test.js +5 -6
  3. package/es/bridge/Bridge.js +2 -4
  4. package/es/canvasFileBrowser/FileBrowser.js +2 -4
  5. package/es/common/browser.js +2 -2
  6. package/es/common/fileUrl.js +13 -3
  7. package/es/defaultTinymceConfig.d.ts +1 -1
  8. package/es/defaultTinymceConfig.js +149 -114
  9. package/es/enhance-user-content/enhance_user_content.js +7 -1
  10. package/es/enhance-user-content/instructure_helper.js +4 -0
  11. package/es/enhance-user-content/youtube_overlay.d.ts +1 -0
  12. package/es/enhance-user-content/youtube_overlay.js +87 -0
  13. package/es/format-message.d.js +1 -0
  14. package/es/format-message.js +5 -0
  15. package/es/index.d.ts +1 -1
  16. package/es/rce/RCE.d.ts +0 -1
  17. package/es/rce/RCE.js +5 -10
  18. package/es/rce/RCEGlobals.d.ts +0 -2
  19. package/es/rce/RCEGlobals.js +0 -1
  20. package/es/rce/RCEVariants.d.ts +8 -3
  21. package/es/rce/RCEVariants.js +36 -10
  22. package/es/rce/RCEWrapper.d.ts +3 -5
  23. package/es/rce/RCEWrapper.js +68 -83
  24. package/es/rce/RCEWrapperProps.d.ts +1 -1
  25. package/es/rce/ShowOnFocusButton/index.js +4 -2
  26. package/es/rce/StatusBar.js +61 -15
  27. package/es/rce/alertHandler.js +6 -7
  28. package/es/rce/plugins/instructure-ui-icons/plugin.js +2 -2
  29. package/es/rce/plugins/instructure_equation/EquationEditorModal/index.d.ts +1 -1
  30. package/es/rce/plugins/instructure_equation/EquationEditorModal/index.js +6 -10
  31. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.d.ts +5 -15
  32. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.js +4 -10
  33. package/es/rce/plugins/instructure_image/ImageEmbedOptions.d.ts +7 -0
  34. package/es/rce/plugins/instructure_image/ImageEmbedOptions.js +49 -9
  35. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.d.ts +1 -8
  36. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +13 -33
  37. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.d.ts +1 -2
  38. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.js +2 -1
  39. package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.js +1 -2
  40. package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +2 -4
  41. package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +10 -7
  42. package/es/rce/plugins/shared/ContentSelection.js +4 -7
  43. package/es/rce/plugins/shared/DimensionsInput/index.js +3 -3
  44. package/es/rce/plugins/shared/FixedContentTray.d.ts +7 -23
  45. package/es/rce/plugins/shared/FixedContentTray.js +7 -16
  46. package/es/rce/plugins/shared/ImageCropper/constants.d.ts +1 -1
  47. package/es/rce/plugins/shared/ImageCropper/constants.js +1 -1
  48. package/es/rce/plugins/shared/ImageCropper/controls/CustomNumberInput.js +1 -1
  49. package/es/rce/plugins/shared/PreviewIcon.js +1 -1
  50. package/es/rce/plugins/shared/ai_tools/aiicons.d.ts +3 -3
  51. package/es/rce/plugins/shared/ai_tools/aiicons.js +11 -11
  52. package/es/rce/plugins/shared/fileTypeUtils.js +1 -1
  53. package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +7 -1
  54. package/es/rce/plugins/tinymce-a11y-checker/plugin.js +50 -52
  55. package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.d.ts +1 -1
  56. package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.js +1 -1
  57. package/es/rce/style.js +47 -45
  58. package/es/rcs/api.d.ts +4 -1
  59. package/es/rcs/api.js +9 -13
  60. package/es/translations/locales/ar.js +29 -5
  61. package/es/translations/locales/ca.js +32 -8
  62. package/es/translations/locales/cy.js +29 -5
  63. package/es/translations/locales/da-x-k12.js +29 -5
  64. package/es/translations/locales/da.js +29 -5
  65. package/es/translations/locales/de.js +29 -5
  66. package/es/translations/locales/en-AU-x-unimelb.js +29 -5
  67. package/es/translations/locales/en-GB-x-ukhe.js +29 -5
  68. package/es/translations/locales/en.js +20 -5
  69. package/es/translations/locales/en_AU.js +29 -5
  70. package/es/translations/locales/en_CA.js +29 -5
  71. package/es/translations/locales/en_CY.js +29 -5
  72. package/es/translations/locales/en_GB.js +29 -5
  73. package/es/translations/locales/es.js +29 -5
  74. package/es/translations/locales/es_ES.js +29 -5
  75. package/es/translations/locales/fa_IR.js +0 -3
  76. package/es/translations/locales/fi.js +29 -5
  77. package/es/translations/locales/fr.js +29 -5
  78. package/es/translations/locales/fr_CA.js +30 -6
  79. package/es/translations/locales/ga.js +46 -22
  80. package/es/translations/locales/hi.js +29 -5
  81. package/es/translations/locales/ht.js +29 -5
  82. package/es/translations/locales/hu.js +0 -6
  83. package/es/translations/locales/id.js +29 -5
  84. package/es/translations/locales/is.js +23 -5
  85. package/es/translations/locales/it.js +29 -5
  86. package/es/translations/locales/ja.js +29 -5
  87. package/es/translations/locales/mi.js +29 -5
  88. package/es/translations/locales/ms.js +29 -5
  89. package/es/translations/locales/nb-x-k12.js +29 -5
  90. package/es/translations/locales/nb.js +29 -5
  91. package/es/translations/locales/nl.js +29 -5
  92. package/es/translations/locales/nn.js +0 -6
  93. package/es/translations/locales/pl.js +29 -5
  94. package/es/translations/locales/pt.js +29 -5
  95. package/es/translations/locales/pt_BR.js +29 -5
  96. package/es/translations/locales/ru.js +29 -5
  97. package/es/translations/locales/sl.js +29 -5
  98. package/es/translations/locales/sv-x-k12.js +29 -5
  99. package/es/translations/locales/sv.js +29 -5
  100. package/es/translations/locales/th.js +29 -5
  101. package/es/translations/locales/uk_UA.js +0 -6
  102. package/es/translations/locales/vi.js +29 -5
  103. package/es/translations/locales/zh-Hans.js +29 -5
  104. package/es/translations/locales/zh-Hant.js +29 -5
  105. package/es/translations/locales/zh.js +29 -5
  106. package/es/translations/locales/zh_HK.js +29 -5
  107. package/es/util/contextHelper.d.ts +7 -0
  108. package/{testcafe/axe.test.js → es/util/contextHelper.js} +10 -21
  109. package/es/util/loadingPlaceholder.js +11 -11
  110. package/eslint.config.js +3 -25
  111. package/jest/jest-setup.js +27 -2
  112. package/jest.config.js +5 -1
  113. package/package.json +62 -85
  114. package/testcafe/RCEWrapper.test.js +0 -319
  115. package/testcafe/StatusBar.test.js +0 -108
  116. package/testcafe/enhanceUserContent.html +0 -58
  117. package/testcafe/enhanceUserContent.test.js +0 -44
  118. package/testcafe/entry.jsx +0 -77
  119. package/testcafe/testcafe.html +0 -14
  120. package/webpack.testcafe.config.js +0 -61
@@ -400,6 +400,9 @@ const locale = {
400
400
  "content_type_2cf90d95": {
401
401
  "message": "内容类型"
402
402
  },
403
+ "continue_to_youtube_content_a34f0f85": {
404
+ "message": "继续前往 YouTube 内容"
405
+ },
403
406
  "coproduct_e7838082": {
404
407
  "message": "余积"
405
408
  },
@@ -499,6 +502,9 @@ const locale = {
499
502
  "decrease_indent_d9cf469d": {
500
503
  "message": "减少缩进"
501
504
  },
505
+ "decrease_rich_content_area_82068f64": {
506
+ "message": "减小富内容区域"
507
+ },
502
508
  "deep_purple_bb3e2907": {
503
509
  "message": "深紫色"
504
510
  },
@@ -1081,6 +1087,9 @@ const locale = {
1081
1087
  "increase_indent_6af90f7c": {
1082
1088
  "message": "增加缩进"
1083
1089
  },
1090
+ "increase_rich_content_area_340b775": {
1091
+ "message": "增大富内容区域"
1092
+ },
1084
1093
  "indefinite_integral_6623307e": {
1085
1094
  "message": "不定积分"
1086
1095
  },
@@ -1123,6 +1132,9 @@ const locale = {
1123
1132
  "intersection_cd4590e4": {
1124
1133
  "message": "相交"
1125
1134
  },
1135
+ "invalid_description_991e23bb": {
1136
+ "message": "无效的描述"
1137
+ },
1126
1138
  "invalid_entry_f7d2a0f5": {
1127
1139
  "message": "无效的输入。"
1128
1140
  },
@@ -1690,9 +1702,18 @@ const locale = {
1690
1702
  "please_allow_canvas_to_access_your_microphone_and__dc2c3079": {
1691
1703
  "message": "请允许 Canvas 访问您的麦克风和网络摄像头。"
1692
1704
  },
1705
+ "please_choose_a_file_c2449cc": {
1706
+ "message": "请选择文件"
1707
+ },
1693
1708
  "please_decribe_what_you_would_like_to_compose_27a51be5": {
1694
1709
  "message": "请描述您要撰写的内容。"
1695
1710
  },
1711
+ "please_enter_a_file_name_f159edc1": {
1712
+ "message": "请输入一个文件名"
1713
+ },
1714
+ "please_select_a_file_of_a_supported_type_1fc578f2": {
1715
+ "message": "请选择支持类型的文件"
1716
+ },
1696
1717
  "plus_d43cd4ec": {
1697
1718
  "message": "加号"
1698
1719
  },
@@ -2242,8 +2263,11 @@ const locale = {
2242
2263
  "the_first_heading_on_a_page_should_be_an_h2_859089f2": {
2243
2264
  "message": "页面上的第一个标题应该是H2。"
2244
2265
  },
2245
- "the_following_content_is_partner_provided_ed1da756": {
2246
- "message": "以下内容由合作伙伴提供"
2266
+ "the_height_of_rich_content_area_is_decreased_36920e0": {
2267
+ "message": "富内容区域的高度减小。"
2268
+ },
2269
+ "the_height_of_rich_content_area_is_increased_74c2358d": {
2270
+ "message": "富内容区域的高度增大。"
2247
2271
  },
2248
2272
  "the_material_is_in_the_public_domain_279c39a3": {
2249
2273
  "message": "材料在公开域中"
@@ -2254,9 +2278,6 @@ const locale = {
2254
2278
  "the_material_is_subject_to_an_exception_e_g_fair_u_a39c8ca2": {
2255
2279
  "message": "材料有例外情况——例如,合理使用、引用权,或版权法规定的其他适用的情况"
2256
2280
  },
2257
- "the_preceding_content_is_partner_provided_d753928c": {
2258
- "message": "以上内容由合作伙伴提供"
2259
- },
2260
2281
  "the_pretty_html_editor_is_not_keyboard_accessible__d6d5d2b": {
2261
2282
  "message": "无法通过键盘访问精美 HTML 编辑器。按 Shift O 打开原始 HTML 编辑器。"
2262
2283
  },
@@ -2296,6 +2317,9 @@ const locale = {
2296
2317
  "this_image_is_currently_unavailable_25c68857": {
2297
2318
  "message": "该图像目前不可用"
2298
2319
  },
2320
+ "this_video_may_display_youtube_ads_4d19d590": {
2321
+ "message": "此视频可能展示 YouTube 广告。"
2322
+ },
2299
2323
  "though_your_video_will_have_the_correct_title_in_t_90e427f3": {
2300
2324
  "message": "虽然您的视频在浏览器里会有正确标题,但我们无法在数据库里更新。"
2301
2325
  },
@@ -400,6 +400,9 @@ const locale = {
400
400
  "content_type_2cf90d95": {
401
401
  "message": "內容類型"
402
402
  },
403
+ "continue_to_youtube_content_a34f0f85": {
404
+ "message": "繼續觀看 YouTube 內容"
405
+ },
403
406
  "coproduct_e7838082": {
404
407
  "message": "副產品"
405
408
  },
@@ -499,6 +502,9 @@ const locale = {
499
502
  "decrease_indent_d9cf469d": {
500
503
  "message": "減少縮排"
501
504
  },
505
+ "decrease_rich_content_area_82068f64": {
506
+ "message": "減少多種格式的內容區域"
507
+ },
502
508
  "deep_purple_bb3e2907": {
503
509
  "message": "深紫色"
504
510
  },
@@ -1081,6 +1087,9 @@ const locale = {
1081
1087
  "increase_indent_6af90f7c": {
1082
1088
  "message": "增加縮進"
1083
1089
  },
1090
+ "increase_rich_content_area_340b775": {
1091
+ "message": "增加多種格式的內容區域"
1092
+ },
1084
1093
  "indefinite_integral_6623307e": {
1085
1094
  "message": "無限積分"
1086
1095
  },
@@ -1123,6 +1132,9 @@ const locale = {
1123
1132
  "intersection_cd4590e4": {
1124
1133
  "message": "交集"
1125
1134
  },
1135
+ "invalid_description_991e23bb": {
1136
+ "message": "無效的描述"
1137
+ },
1126
1138
  "invalid_entry_f7d2a0f5": {
1127
1139
  "message": "無效的輸入項目。"
1128
1140
  },
@@ -1690,9 +1702,18 @@ const locale = {
1690
1702
  "please_allow_canvas_to_access_your_microphone_and__dc2c3079": {
1691
1703
  "message": "請允許 Canvas 存取您的麥克風和網路攝影機。"
1692
1704
  },
1705
+ "please_choose_a_file_c2449cc": {
1706
+ "message": "請選擇一個檔案"
1707
+ },
1693
1708
  "please_decribe_what_you_would_like_to_compose_27a51be5": {
1694
1709
  "message": "請描述您想創作什麼。"
1695
1710
  },
1711
+ "please_enter_a_file_name_f159edc1": {
1712
+ "message": "請輸入一個檔案名稱"
1713
+ },
1714
+ "please_select_a_file_of_a_supported_type_1fc578f2": {
1715
+ "message": "請選取支援類型的檔案"
1716
+ },
1696
1717
  "plus_d43cd4ec": {
1697
1718
  "message": "+"
1698
1719
  },
@@ -2242,8 +2263,11 @@ const locale = {
2242
2263
  "the_first_heading_on_a_page_should_be_an_h2_859089f2": {
2243
2264
  "message": "頁面的第一個標題應該是 H2。"
2244
2265
  },
2245
- "the_following_content_is_partner_provided_ed1da756": {
2246
- "message": "以下內容由合作夥伴提供"
2266
+ "the_height_of_rich_content_area_is_decreased_36920e0": {
2267
+ "message": "多種格式的內容區域的高度已減少。"
2268
+ },
2269
+ "the_height_of_rich_content_area_is_increased_74c2358d": {
2270
+ "message": "多種格式的內容區域的高度已增加。"
2247
2271
  },
2248
2272
  "the_material_is_in_the_public_domain_279c39a3": {
2249
2273
  "message": "該材料位於公用網域中。"
@@ -2254,9 +2278,6 @@ const locale = {
2254
2278
  "the_material_is_subject_to_an_exception_e_g_fair_u_a39c8ca2": {
2255
2279
  "message": "可能有適用於此資料的例外情況 - 如:合理使用、引用權,或適用版權法下的其他情況"
2256
2280
  },
2257
- "the_preceding_content_is_partner_provided_d753928c": {
2258
- "message": "上述內容由合作夥伴提供"
2259
- },
2260
2281
  "the_pretty_html_editor_is_not_keyboard_accessible__d6d5d2b": {
2261
2282
  "message": "美觀 HTML 編輯器無法用鍵盤存取。按 ShiftO 開啟原始 HTML 編輯器。"
2262
2283
  },
@@ -2296,6 +2317,9 @@ const locale = {
2296
2317
  "this_image_is_currently_unavailable_25c68857": {
2297
2318
  "message": "此圖像目前不可用"
2298
2319
  },
2320
+ "this_video_may_display_youtube_ads_4d19d590": {
2321
+ "message": "此影片可能會顯示 YouTube 廣告。"
2322
+ },
2299
2323
  "though_your_video_will_have_the_correct_title_in_t_90e427f3": {
2300
2324
  "message": "雖然您的影片在瀏覽器中有正確的標題,但我們無法在資料庫中將其更新。"
2301
2325
  },
@@ -0,0 +1,7 @@
1
+ type ContainingContext = {
2
+ contextType: string;
3
+ contextId: string;
4
+ userId: string;
5
+ };
6
+ export declare const normalizeContainingContext: (context?: ContainingContext) => ContainingContext | undefined;
7
+ export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2019 - present Instructure, Inc.
2
+ * Copyright (C) 2025 - present Instructure, Inc.
3
3
  *
4
4
  * This file is part of Canvas.
5
5
  *
@@ -15,25 +15,14 @@
15
15
  * You should have received a copy of the GNU Affero General Public License along
16
16
  * with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
- import {axeCheck, createReport} from 'axe-testcafe'
19
- fixture`aXe a11y checking`.page`./testcafe.html`
20
18
 
21
- async function runAxeCheck(t, context, options) {
22
- const {violations} = await axeCheck(t, context, options)
23
- if (violations) {
24
- await t.expect(violations.length === 0).ok(createReport(violations))
19
+ export const normalizeContainingContext = context => {
20
+ if (context && !['user', 'course', 'group'].includes(context.contextType)) {
21
+ return {
22
+ ...context,
23
+ contextType: 'user',
24
+ contextId: context.userId
25
+ };
25
26
  }
26
- }
27
-
28
- test('automated a11y testing', async t => {
29
- const axeContext = {
30
- include: 'body',
31
- }
32
- const axeOptions = {
33
- runOnly: {
34
- type: 'tag',
35
- values: ['wcag21a', 'wcag21aa', 'best-practice', 'section508'],
36
- },
37
- }
38
- await runAxeCheck(t, axeContext, axeOptions)
39
- })
27
+ return context;
28
+ };
@@ -33,11 +33,11 @@ export async function placeholderInfoFor(fileMetaProps) {
33
33
  const ariaLabel = formatMessage('Loading placeholder for {fileName}', {
34
34
  fileName: fileName !== null && fileName !== void 0 ? fileName : 'unknown filename'
35
35
  });
36
- if (typeof fileMetaProps.contentType !== 'string') {
37
- throw new Error('Invalid fileMetaProps.contentType');
38
- }
39
36
  const type = fileMetaProps.contentType || fileMetaProps.type;
40
- if (isImage(fileMetaProps.contentType) && fileMetaProps.displayAs !== 'link') {
37
+ if (typeof type !== 'string') {
38
+ throw new Error('Invalid type: ' + type);
39
+ }
40
+ if (isImage(type) && fileMetaProps.displayAs !== 'link') {
41
41
  var _trimmedOrNull2;
42
42
  const imageUrl = (_trimmedOrNull2 = trimmedOrNull(fileMetaProps.domObject.preview)) !== null && _trimmedOrNull2 !== void 0 ? _trimmedOrNull2 : URL.createObjectURL(fileMetaProps.domObject);
43
43
  return new Promise((resolve, reject) => {
@@ -54,7 +54,7 @@ export async function placeholderInfoFor(fileMetaProps) {
54
54
  image.onerror = () => reject(new Error('Failed to load image: ' + imageUrl));
55
55
  image.src = imageUrl;
56
56
  });
57
- } else if (typeof type === 'string' && isVideo(type)) {
57
+ } else if (isVideo(type)) {
58
58
  const videoSize = videoDefaultSize();
59
59
  return {
60
60
  type: 'block',
@@ -64,7 +64,7 @@ export async function placeholderInfoFor(fileMetaProps) {
64
64
  height: videoSize.height,
65
65
  vAlign: 'bottom'
66
66
  };
67
- } else if (typeof type === 'string' && isAudio(type)) {
67
+ } else if (isAudio(type)) {
68
68
  return {
69
69
  type: 'block',
70
70
  visibleLabel,
@@ -159,7 +159,7 @@ export async function insertPlaceholder(editor, unencodedName, placeholderInfoPr
159
159
  const labelElem = editor.dom.doc.createElement('div');
160
160
  placeholderElem.appendChild(labelElem);
161
161
  Object.assign(labelElem.style, {
162
- color: '#2D3B45',
162
+ color: '#273540',
163
163
  zIndex: '1000',
164
164
  /* Restrict text to one line */
165
165
  display: 'inline-block',
@@ -179,7 +179,7 @@ export async function insertPlaceholder(editor, unencodedName, placeholderInfoPr
179
179
  padding: '5px',
180
180
  verticalAlign: 'baseline',
181
181
  gap: '8px',
182
- backgroundColor: '#F5F5F5'
182
+ backgroundColor: '#F2F4F4'
183
183
  });
184
184
  break;
185
185
  case 'block':
@@ -299,8 +299,8 @@ function spinnerSvg(size, labelId) {
299
299
  position: relative;
300
300
  box-sizing: border-box;
301
301
  overflow: hidden;
302
- --Spinner-trackColor: #F5F5F5;
303
- --Spinner-color: #0374B5;
302
+ --Spinner-trackColor: #F2F4F4;
303
+ --Spinner-color: #2B7ABC;
304
304
  --Spinner-xSmallSize: 1.5em;
305
305
  --Spinner-xSmallBorderWidth: 0.25em;
306
306
  --Spinner-smallSize: 3em;
@@ -309,7 +309,7 @@ function spinnerSvg(size, labelId) {
309
309
  --Spinner-mediumBorderWidth: 0.5em;
310
310
  --Spinner-largeSize: 7em;
311
311
  --Spinner-largeBorderWidth: 0.75em;
312
- --Spinner-inverseColor: #0374B5;
312
+ --Spinner-inverseColor: #2B7ABC;
313
313
  }
314
314
 
315
315
  .Spinner-circleTrack {
package/eslint.config.js CHANGED
@@ -14,17 +14,10 @@ const pluginJest = require('eslint-plugin-jest')
14
14
  module.exports = tseslint.config(
15
15
  // General
16
16
  {
17
- files: ['src/**/*.ts', 'testcafe/**/*.{js,mjs,ts,jsx,tsx}'],
17
+ files: ['src/**/*.ts'],
18
18
  },
19
19
  {
20
- ignores: [
21
- 'es/**/*',
22
- './src/translations/*/*',
23
- 'scripts',
24
- 'packages/canvas-rce/webpack.testcafe.config.js',
25
- 'testcafe/',
26
- 'webpack.*.config.js',
27
- ],
20
+ ignores: ['es/**/*', './src/translations/*/*', 'scripts', 'webpack.*.config.js'],
28
21
  },
29
22
 
30
23
  // Globals
@@ -165,11 +158,7 @@ module.exports = tseslint.config(
165
158
  // Imports
166
159
  importPlugin.flatConfigs.recommended,
167
160
  {
168
- files: [
169
- '__tests__/**/*.{js,mjs,ts,jsx,tsx}',
170
- 'src/**/*.{js,mjs,ts,jsx,tsx}',
171
- 'testcafe/**/*.{js,mjs,ts,jsx,tsx}',
172
- ],
161
+ files: ['__tests__/**/*.{js,mjs,ts,jsx,tsx}', 'src/**/*.{js,mjs,ts,jsx,tsx}'],
173
162
  ignores: ['src/translations/**'],
174
163
  languageOptions: {
175
164
  ecmaVersion: 'latest',
@@ -212,17 +201,6 @@ module.exports = tseslint.config(
212
201
  },
213
202
  },
214
203
 
215
- // Testcafe
216
- {
217
- files: ['testcafe/**/*.{js,mjs,ts,jsx,tsx}'],
218
- languageOptions: {
219
- globals: {
220
- test: true,
221
- fixture: true,
222
- },
223
- },
224
- },
225
-
226
204
  // Jest
227
205
  {
228
206
  files: [
@@ -25,6 +25,30 @@ import {TextDecoder, TextEncoder} from 'util'
25
25
  global.TextEncoder = TextEncoder
26
26
  global.TextDecoder = TextDecoder
27
27
 
28
+ // Add fetch polyfills for msw
29
+ require('isomorphic-fetch')
30
+
31
+ // Add BroadcastChannel polyfill for msw
32
+ if (!globalThis.BroadcastChannel) {
33
+ globalThis.BroadcastChannel = class BroadcastChannel {
34
+ constructor() {}
35
+ postMessage() {}
36
+ close() {}
37
+ addEventListener() {}
38
+ removeEventListener() {}
39
+ }
40
+ }
41
+
42
+ // Add TransformStream polyfill for msw
43
+ if (!globalThis.TransformStream) {
44
+ globalThis.TransformStream = class TransformStream {
45
+ constructor() {
46
+ this.readable = {}
47
+ this.writable = {}
48
+ }
49
+ }
50
+ }
51
+
28
52
  /**
29
53
  * We want to ensure errors and warnings get appropriate eyes. If
30
54
  * you are seeing an exception from here, it probably means you
@@ -59,6 +83,7 @@ const ignoredErrors = [
59
83
  /Warning: findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https:\/\/reactjs.org\/link\/strict-mode-find-node/,
60
84
  /Warning: %s uses the legacy childContextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext\(\) instead/,
61
85
  /Warning: %s uses the legacy contextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext\(\) with static contextType instead./,
86
+ /Warning: Unknown event handler property `%s`. It will be ignored.%s/,
62
87
  ]
63
88
  const globalWarn = global.console.warn
64
89
  const ignoredWarnings = [
@@ -78,7 +103,7 @@ global.console = {
78
103
  }
79
104
  globalError(error)
80
105
  throw new Error(
81
- `Looks like you have an unhandled error. Keep our test logs clean by handling or filtering it. ${error}`
106
+ `Looks like you have an unhandled error. Keep our test logs clean by handling or filtering it. ${error}`,
82
107
  )
83
108
  },
84
109
  warn: warning => {
@@ -87,7 +112,7 @@ global.console = {
87
112
  }
88
113
  globalWarn(warning)
89
114
  throw new Error(
90
- `Looks like you have an unhandled warning. Keep our test logs clean by handling or filtering it. ${warning}`
115
+ `Looks like you have an unhandled warning. Keep our test logs clean by handling or filtering it. ${warning}`,
91
116
  )
92
117
  },
93
118
  info: console.info,
package/jest.config.js CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  // Used to enable babel transformations for node_modules that use ecmascript module syntax directly
20
20
  // From https://github.com/nrwl/nx/issues/812
21
- const esModules = ['text-field-edit', '@instructure\\/ui-icons'].join('|')
21
+ const esModules = ['text-field-edit', '@instructure\\/ui-icons', 'msw'].join('|')
22
22
 
23
23
  module.exports = {
24
24
  setupFiles: ['jest-canvas-mock', '<rootDir>/jest/jest-setup.js'],
@@ -43,6 +43,10 @@ module.exports = {
43
43
  modulePathIgnorePatterns: ['<rootDir>/es', '<rootDir>/canvas'],
44
44
  transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
45
45
  testEnvironment: 'jsdom',
46
+ testEnvironmentOptions: {
47
+ // https://github.com/mswjs/examples/blob/main/examples/with-jest/jest.config.ts#L20
48
+ customExportConditions: [''],
49
+ },
46
50
  moduleNameMapper: {
47
51
  // jest can't import css
48
52
  '\\.(css|less)$': '<rootDir>/src/rce/__mocks__/styleMock.js',
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@instructure/canvas-rce",
3
- "version": "6.0.0",
3
+ "version": "7.2.0",
4
4
  "description": "A component wrapping Canvas's usage of Tinymce",
5
5
  "main": "es/index.js",
6
6
  "types": "es/index.d.ts",
7
- "owner": "LF",
7
+ "owner": "RCX",
8
8
  "scripts": {
9
9
  "i18n:extract": "format-message extract \"es/**/*.js\" -g underscored_crc32 -o locales/en.json",
10
10
  "integration-test": "nightwatch --env integration",
@@ -14,14 +14,6 @@
14
14
  "test:parallel": "yarn test:jest",
15
15
  "test:serial": "yarn test:jest",
16
16
  "test:jest": "jest --color",
17
- "test:cafe": "yarn build:cafe && yarn test:cafe:only",
18
- "test:cafe:ui": "yarn build:cafe && yarn test:cafe:only:ui",
19
- "test:cafe:only": "testcafe ${TESTCAFE_PROVIDER:-chrome:headless} testcafe/**/*.test.js",
20
- "test:cafe:only:ui": "testcafe chrome testcafe/**/*.test.js -s takeOnFails=true",
21
- "test:cafe:only:debug": "testcafe chrome testcafe/**/*.test.js --debug-mode -s takeOnFails=true",
22
- "test:cafe:one": "testcafe chrome testcafe/**/*.test.js --test ",
23
- "test:cafe:all": "yarn build:cafe && testcafe chrome,firefox,safari testcafe/**/*.test.js",
24
- "test:cafe:debug": "yarn build:cafe && yarn test:cafe:only:debug",
25
17
  "test:jest:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
26
18
  "test:jest:watch": "node node_modules/.bin/jest --watch",
27
19
  "demo": "scripts/demo.sh",
@@ -35,8 +27,7 @@
35
27
  "build:types": "tsc",
36
28
  "build:canvas": "yarn run build",
37
29
  "build:watch": "yarn clean:es && yarn build:es --watch",
38
- "build:cafe": "wp --config webpack.testcafe.config.js",
39
- "prepublishOnly": "yarn build",
30
+ "prepublishOnly": "yarn build && yarn test",
40
31
  "fmt:check": "biome check",
41
32
  "fmt:fix": "biome format --write",
42
33
  "clean": "rm -rf lib && yarn clean:es && rm -rf coverage && yarn demo:clean",
@@ -54,92 +45,83 @@
54
45
  ],
55
46
  "author": "Instructure, Inc",
56
47
  "license": "AGPL-3.0",
57
- "browserslist": [
58
- "extends @instructure/browserslist-config-canvas-lms"
59
- ],
48
+ "browserslist": ["extends @instructure/browserslist-config-canvas-lms"],
60
49
  "nyc": {
61
- "include": [
62
- "shared/**/*.js",
63
- "src/**/*.js"
64
- ],
50
+ "include": ["shared/**/*.js", "src/**/*.js"],
65
51
  "exclude": [],
66
- "require": [
67
- "@babel/register",
68
- "@instructure/canvas-theme"
69
- ],
52
+ "require": ["@babel/register", "@instructure/canvas-theme"],
70
53
  "sourceMap": false,
71
54
  "instrument": false
72
55
  },
73
56
  "dependencies": {
74
- "@instructure/canvas-theme": "9.10.1",
57
+ "@instructure/canvas-theme": "10.24.2",
75
58
  "@instructure/canvas-media": "*",
76
- "@instructure/debounce": "9.10.1",
77
- "@instructure/emotion": "9.10.1",
59
+ "@instructure/debounce": "10.24.2",
60
+ "@instructure/emotion": "10.24.2",
78
61
  "@instructure/k5uploader": "*",
79
62
  "@instructure/media-capture": "^9.0.0",
80
- "@instructure/theme-registry": "9.10.1",
81
- "@instructure/ui-a11y-content": "9.10.1",
82
- "@instructure/ui-a11y-utils": "9.10.1",
83
- "@instructure/ui-alerts": "9.10.1",
84
- "@instructure/ui-avatar": "9.10.1",
85
- "@instructure/ui-badge": "9.10.1",
86
- "@instructure/ui-billboard": "9.10.1",
87
- "@instructure/ui-buttons": "9.10.1",
88
- "@instructure/ui-checkbox": "9.10.1",
89
- "@instructure/ui-source-code-editor": "9.10.1",
90
- "@instructure/ui-color-picker": "8.56.4",
91
- "@instructure/ui-color-utils": "9.10.1",
92
- "@instructure/ui-file-drop": "9.10.1",
93
- "@instructure/ui-flex": "9.10.1",
94
- "@instructure/ui-focusable": "9.10.1",
95
- "@instructure/ui-form-field": "9.10.1",
96
- "@instructure/ui-grid": "9.10.1",
97
- "@instructure/ui-heading": "9.10.1",
98
- "@instructure/ui-icons": "9.10.1",
99
- "@instructure/ui-img": "9.10.1",
100
- "@instructure/ui-link": "9.10.1",
101
- "@instructure/ui-list": "9.10.1",
63
+ "@instructure/theme-registry": "10.24.2",
64
+ "@instructure/ui-a11y-content": "10.24.2",
65
+ "@instructure/ui-a11y-utils": "10.24.2",
66
+ "@instructure/ui-alerts": "10.24.2",
67
+ "@instructure/ui-avatar": "10.24.2",
68
+ "@instructure/ui-badge": "10.24.2",
69
+ "@instructure/ui-billboard": "10.24.2",
70
+ "@instructure/ui-buttons": "10.24.2",
71
+ "@instructure/ui-checkbox": "10.24.2",
72
+ "@instructure/ui-source-code-editor": "10.24.2",
73
+ "@instructure/ui-color-picker": "10.24.2",
74
+ "@instructure/ui-color-utils": "10.24.2",
75
+ "@instructure/ui-file-drop": "10.24.2",
76
+ "@instructure/ui-flex": "10.24.2",
77
+ "@instructure/ui-focusable": "10.24.2",
78
+ "@instructure/ui-form-field": "10.24.2",
79
+ "@instructure/ui-grid": "10.24.2",
80
+ "@instructure/ui-heading": "10.24.2",
81
+ "@instructure/ui-icons": "10.24.2",
82
+ "@instructure/ui-img": "10.24.2",
83
+ "@instructure/ui-link": "10.24.2",
84
+ "@instructure/ui-list": "10.24.2",
102
85
  "@instructure/ui-media-player": "^9.0.0",
103
- "@instructure/ui-menu": "9.10.1",
104
- "@instructure/ui-modal": "9.10.1",
105
- "@instructure/ui-motion": "9.10.1",
106
- "@instructure/ui-number-input": "9.10.1",
107
- "@instructure/ui-overlays": "9.10.1",
108
- "@instructure/ui-pagination": "9.10.1",
109
- "@instructure/ui-pill": "9.10.1",
110
- "@instructure/ui-popover": "9.10.1",
111
- "@instructure/ui-radio-input": "9.10.1",
112
- "@instructure/ui-simple-select": "9.10.1",
113
- "@instructure/ui-spinner": "9.10.1",
114
- "@instructure/ui-svg-images": "9.10.1",
115
- "@instructure/ui-table": "9.10.1",
116
- "@instructure/ui-tabs": "9.10.1",
117
- "@instructure/ui-text-area": "9.10.1",
118
- "@instructure/ui-text-input": "9.10.1",
119
- "@instructure/ui-text": "9.10.1",
120
- "@instructure/ui-themes": "9.10.1",
121
- "@instructure/ui-toggle-details": "9.10.1",
122
- "@instructure/ui-tooltip": "9.10.1",
123
- "@instructure/ui-tray": "9.10.1",
124
- "@instructure/ui-tree-browser": "9.10.1",
125
- "@instructure/ui-truncate-text": "9.10.1",
126
- "@instructure/ui-utils": "9.10.1",
127
- "@instructure/ui-view": "9.10.1",
128
- "@instructure/uid": "9.10.1",
86
+ "@instructure/ui-menu": "10.24.2",
87
+ "@instructure/ui-modal": "10.24.2",
88
+ "@instructure/ui-motion": "10.24.2",
89
+ "@instructure/ui-number-input": "10.24.2",
90
+ "@instructure/ui-overlays": "10.24.2",
91
+ "@instructure/ui-pagination": "10.24.2",
92
+ "@instructure/ui-pill": "10.24.2",
93
+ "@instructure/ui-popover": "10.24.2",
94
+ "@instructure/ui-radio-input": "10.24.2",
95
+ "@instructure/ui-simple-select": "10.24.2",
96
+ "@instructure/ui-spinner": "10.24.2",
97
+ "@instructure/ui-svg-images": "10.24.2",
98
+ "@instructure/ui-table": "10.24.2",
99
+ "@instructure/ui-tabs": "10.24.2",
100
+ "@instructure/ui-text-area": "10.24.2",
101
+ "@instructure/ui-text-input": "10.24.2",
102
+ "@instructure/ui-text": "10.24.2",
103
+ "@instructure/ui-themes": "10.24.2",
104
+ "@instructure/ui-toggle-details": "10.24.2",
105
+ "@instructure/ui-tooltip": "10.24.2",
106
+ "@instructure/ui-tray": "10.24.2",
107
+ "@instructure/ui-tree-browser": "10.24.2",
108
+ "@instructure/ui-truncate-text": "10.24.2",
109
+ "@instructure/ui-utils": "10.24.2",
110
+ "@instructure/ui-view": "10.24.2",
111
+ "@instructure/uid": "10.24.2",
129
112
  "@sheerun/mutationobserver-shim": "^0.3.2",
130
113
  "@types/tinycolor2": "^1.4.6",
131
114
  "@tinymce/tinymce-react": "~3.8.4",
132
115
  "aphrodite": "^2",
133
- "axios": "^0.21.1",
116
+ "axios": "^1.11.0",
134
117
  "bloody-offset": "0.0.0",
135
- "crypto-es": "^2.0.4",
118
+ "crypto-es": "^2.1.0",
136
119
  "classnames": "^2.2.5",
137
- "concurrently": "^4",
138
120
  "format-message": "^6",
139
121
  "format-message-generate-id": "^6",
140
122
  "i18n-js": "^3",
141
123
  "isomorphic-fetch": "2.2.1",
142
- "js-beautify": "1",
124
+ "js-beautify": "1.14.9",
143
125
  "keycode": "^2",
144
126
  "lodash": "^4",
145
127
  "mathlive": "^0.77.0",
@@ -181,7 +163,6 @@
181
163
  "@types/react": "^18",
182
164
  "@types/react-dom": "^18",
183
165
  "@types/testing-library__jest-dom": "^5.0.0",
184
- "axe-testcafe": "^3",
185
166
  "babel-loader": "^9.1.3",
186
167
  "babel-plugin-dynamic-import-node": "^2.2.0",
187
168
  "babel-plugin-inline-json-import": "^0.2.0",
@@ -200,16 +181,12 @@
200
181
  "jest-mock-proxy": "3.1.2",
201
182
  "jest": "^28",
202
183
  "mathjax": "^3.2.0",
203
- "moxios": "^0.4",
184
+ "msw": "^2.7",
204
185
  "nyc": "^13",
205
186
  "proxyquire": "1.7.4",
206
187
  "shelljs": "^0.8.3",
207
- "sinon": "^7",
208
188
  "skin-deep": "^1",
209
189
  "source-map-support": "0.5.21",
210
- "testcafe-browser-provider-selenium": "^1.2.0",
211
- "testcafe-react-selectors": "^3.3.0",
212
- "testcafe": "1.14.2",
213
190
  "ts-node": "^10.9.2",
214
191
  "typescript": "*",
215
192
  "url-loader": "^4.1.1",
@@ -221,4 +198,4 @@
221
198
  "resolutions": {
222
199
  "format-message-estree-util": "./packages/format-message-estree-util"
223
200
  }
224
- }
201
+ }