@instructure/canvas-rce 7.0.0 → 7.3.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 (152) hide show
  1. package/CHANGELOG.md +60 -1
  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/defaultTinymceConfig.d.ts +1 -1
  6. package/es/defaultTinymceConfig.js +149 -114
  7. package/es/enhance-user-content/doc_previews.js +1 -14
  8. package/es/enhance-user-content/enhance_user_content.js +7 -1
  9. package/es/enhance-user-content/instructure_helper.js +4 -0
  10. package/es/enhance-user-content/youtube_overlay.d.ts +1 -0
  11. package/es/enhance-user-content/youtube_overlay.js +87 -0
  12. package/es/format-message.d.js +1 -0
  13. package/es/format-message.js +5 -0
  14. package/es/index.d.ts +2 -1
  15. package/es/index.js +2 -1
  16. package/es/rce/AlertMessageArea.d.ts +2 -2
  17. package/es/rce/AlertMessageArea.js +4 -6
  18. package/es/rce/RCE.d.ts +0 -1
  19. package/es/rce/RCE.js +5 -10
  20. package/es/rce/RCEGlobals.d.ts +2 -0
  21. package/es/rce/RCEGlobals.js +1 -0
  22. package/es/rce/RCEVariants.d.ts +8 -3
  23. package/es/rce/RCEVariants.js +31 -5
  24. package/es/rce/RCEWrapper.d.ts +16 -14
  25. package/es/rce/RCEWrapper.js +260 -244
  26. package/es/rce/RCEWrapperProps.d.ts +1 -1
  27. package/es/rce/ShowOnFocusButton/index.js +4 -2
  28. package/es/rce/StatusBar.js +61 -15
  29. package/es/rce/alertHandler.js +6 -7
  30. package/es/rce/plugins/instructure-ui-icons/plugin.js +2 -2
  31. package/es/rce/plugins/instructure_equation/EquationEditorModal/index.js +6 -10
  32. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.d.ts +5 -15
  33. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.js +4 -10
  34. package/es/rce/plugins/instructure_image/ImageEmbedOptions.d.ts +7 -0
  35. package/es/rce/plugins/instructure_image/ImageEmbedOptions.js +45 -2
  36. package/es/rce/plugins/instructure_keyboard_shortcuts_header/clickCallback.d.ts +2 -0
  37. package/es/rce/plugins/instructure_keyboard_shortcuts_header/clickCallback.js +45 -0
  38. package/es/rce/plugins/instructure_keyboard_shortcuts_header/plugin.d.ts +1 -0
  39. package/es/rce/plugins/instructure_keyboard_shortcuts_header/plugin.js +43 -0
  40. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.d.ts +1 -8
  41. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +13 -33
  42. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.d.ts +1 -2
  43. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.js +2 -1
  44. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.d.ts +1 -1
  45. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +25 -25
  46. package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.d.ts +1 -1
  47. package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.js +2 -1
  48. package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.d.ts +1 -1
  49. package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +2 -1
  50. package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +10 -7
  51. package/es/rce/plugins/instructure_record/mediaTranslations.js +1 -1
  52. package/es/rce/plugins/instructure_studio_media_options/plugin.js +109 -14
  53. package/es/rce/plugins/instructure_studio_media_options/studioToolbarIcons.d.ts +5 -0
  54. package/es/rce/plugins/instructure_studio_media_options/studioToolbarIcons.js +23 -0
  55. package/es/rce/plugins/instructure_wordcount_header/plugin.d.ts +1 -0
  56. package/es/rce/plugins/instructure_wordcount_header/plugin.js +75 -0
  57. package/es/rce/plugins/shared/ContentSelection.d.ts +1 -2
  58. package/es/rce/plugins/shared/ContentSelection.js +1 -18
  59. package/es/rce/plugins/shared/DimensionsInput/index.js +3 -3
  60. package/es/rce/plugins/shared/FixedContentTray.d.ts +7 -23
  61. package/es/rce/plugins/shared/FixedContentTray.js +7 -16
  62. package/es/rce/plugins/shared/ImageCropper/constants.d.ts +1 -1
  63. package/es/rce/plugins/shared/ImageCropper/constants.js +1 -1
  64. package/es/rce/plugins/shared/ImageCropper/controls/CustomNumberInput.js +1 -1
  65. package/es/rce/plugins/shared/PreviewIcon.js +1 -1
  66. package/es/rce/plugins/shared/StudioLtiSupportUtils.d.ts +9 -1
  67. package/es/rce/plugins/shared/StudioLtiSupportUtils.js +94 -1
  68. package/es/rce/plugins/shared/Upload/ComputerPanel.js +1 -1
  69. package/es/rce/plugins/shared/Upload/UploadFileModal.js +37 -4
  70. package/es/rce/plugins/shared/Upload/VideoUrlPanel.d.ts +15 -0
  71. package/es/rce/plugins/shared/Upload/VideoUrlPanel.js +51 -0
  72. package/es/rce/plugins/shared/Upload/videoValidationUtils.d.ts +7 -0
  73. package/es/rce/plugins/shared/Upload/videoValidationUtils.js +58 -0
  74. package/es/rce/plugins/shared/ai_tools/aiicons.d.ts +3 -3
  75. package/es/rce/plugins/shared/ai_tools/aiicons.js +11 -11
  76. package/es/rce/plugins/shared/iframeUtils.d.ts +1 -0
  77. package/es/rce/plugins/shared/iframeUtils.js +37 -0
  78. package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +7 -1
  79. package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.d.ts +1 -1
  80. package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.js +1 -1
  81. package/es/rce/style.js +19 -17
  82. package/es/rce/tinyRCE.js +2 -0
  83. package/es/sidebar/actions/upload.d.ts +1 -0
  84. package/es/sidebar/actions/upload.js +56 -0
  85. package/es/sidebar/containers/sidebarHandlers.d.ts +1 -0
  86. package/es/sidebar/containers/sidebarHandlers.js +2 -1
  87. package/es/translations/locales/ar.js +44 -11
  88. package/es/translations/locales/ca.js +47 -14
  89. package/es/translations/locales/cy.js +44 -11
  90. package/es/translations/locales/da-x-k12.js +44 -11
  91. package/es/translations/locales/da.js +44 -11
  92. package/es/translations/locales/de.js +44 -11
  93. package/es/translations/locales/el.js +6 -0
  94. package/es/translations/locales/en-AU-x-unimelb.js +44 -11
  95. package/es/translations/locales/en-GB-x-ukhe.js +44 -11
  96. package/es/translations/locales/en.js +47 -11
  97. package/es/translations/locales/en_AU.js +44 -11
  98. package/es/translations/locales/en_CA.js +44 -11
  99. package/es/translations/locales/en_CY.js +44 -11
  100. package/es/translations/locales/en_GB.js +44 -11
  101. package/es/translations/locales/es.js +44 -11
  102. package/es/translations/locales/es_ES.js +44 -11
  103. package/es/translations/locales/fa_IR.js +6 -6
  104. package/es/translations/locales/fi.js +44 -11
  105. package/es/translations/locales/fr.js +44 -11
  106. package/es/translations/locales/fr_CA.js +49 -16
  107. package/es/translations/locales/ga.js +61 -28
  108. package/es/translations/locales/he.js +6 -0
  109. package/es/translations/locales/hi.js +44 -11
  110. package/es/translations/locales/ht.js +44 -11
  111. package/es/translations/locales/hu.js +6 -12
  112. package/es/translations/locales/hy.js +6 -0
  113. package/es/translations/locales/id.js +44 -11
  114. package/es/translations/locales/is.js +44 -11
  115. package/es/translations/locales/it.js +44 -11
  116. package/es/translations/locales/ja.js +44 -11
  117. package/es/translations/locales/ko.js +6 -0
  118. package/es/translations/locales/mi.js +44 -11
  119. package/es/translations/locales/ms.js +44 -11
  120. package/es/translations/locales/nb-x-k12.js +44 -11
  121. package/es/translations/locales/nb.js +44 -11
  122. package/es/translations/locales/nl.js +44 -11
  123. package/es/translations/locales/nn.js +6 -12
  124. package/es/translations/locales/pl.js +44 -11
  125. package/es/translations/locales/pt.js +44 -11
  126. package/es/translations/locales/pt_BR.js +44 -11
  127. package/es/translations/locales/ru.js +44 -11
  128. package/es/translations/locales/sl.js +44 -11
  129. package/es/translations/locales/sv-x-k12.js +44 -11
  130. package/es/translations/locales/sv.js +44 -11
  131. package/es/translations/locales/th.js +44 -11
  132. package/es/translations/locales/tr.js +6 -3
  133. package/es/translations/locales/uk_UA.js +6 -9
  134. package/es/translations/locales/vi.js +44 -11
  135. package/es/translations/locales/zh-Hans.js +44 -11
  136. package/es/translations/locales/zh-Hant.js +44 -11
  137. package/es/translations/locales/zh.js +44 -11
  138. package/es/translations/locales/zh_HK.js +44 -11
  139. package/es/util/contextHelper.d.ts +7 -0
  140. package/{testcafe/axe.test.js → es/util/contextHelper.js} +10 -21
  141. package/es/util/loadingPlaceholder.js +11 -11
  142. package/eslint.config.js +3 -25
  143. package/jest/jest-setup.js +27 -2
  144. package/jest.config.js +5 -1
  145. package/package.json +61 -84
  146. package/testcafe/RCEWrapper.test.js +0 -319
  147. package/testcafe/StatusBar.test.js +0 -108
  148. package/testcafe/enhanceUserContent.html +0 -58
  149. package/testcafe/enhanceUserContent.test.js +0 -44
  150. package/testcafe/entry.jsx +0 -77
  151. package/testcafe/testcafe.html +0 -14
  152. package/webpack.testcafe.config.js +0 -61
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@instructure/canvas-rce",
3
- "version": "7.0.0",
3
+ "version": "7.3.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,7 +27,6 @@
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
30
  "prepublishOnly": "yarn build && yarn test",
40
31
  "fmt:check": "biome check",
41
32
  "fmt:fix": "biome format --write",
@@ -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": "10.11.0",
57
+ "@instructure/canvas-theme": "10.26.2",
75
58
  "@instructure/canvas-media": "*",
76
- "@instructure/debounce": "10.11.0",
77
- "@instructure/emotion": "10.11.0",
59
+ "@instructure/debounce": "10.26.2",
60
+ "@instructure/emotion": "10.26.2",
78
61
  "@instructure/k5uploader": "*",
79
62
  "@instructure/media-capture": "^9.0.0",
80
- "@instructure/theme-registry": "10.11.0",
81
- "@instructure/ui-a11y-content": "10.11.0",
82
- "@instructure/ui-a11y-utils": "10.11.0",
83
- "@instructure/ui-alerts": "10.11.0",
84
- "@instructure/ui-avatar": "10.11.0",
85
- "@instructure/ui-badge": "10.11.0",
86
- "@instructure/ui-billboard": "10.11.0",
87
- "@instructure/ui-buttons": "10.11.0",
88
- "@instructure/ui-checkbox": "10.11.0",
89
- "@instructure/ui-source-code-editor": "10.11.0",
90
- "@instructure/ui-color-picker": "10.11.0",
91
- "@instructure/ui-color-utils": "10.11.0",
92
- "@instructure/ui-file-drop": "10.11.0",
93
- "@instructure/ui-flex": "10.11.0",
94
- "@instructure/ui-focusable": "10.11.0",
95
- "@instructure/ui-form-field": "10.11.0",
96
- "@instructure/ui-grid": "10.11.0",
97
- "@instructure/ui-heading": "10.11.0",
98
- "@instructure/ui-icons": "10.11.0",
99
- "@instructure/ui-img": "10.11.0",
100
- "@instructure/ui-link": "10.11.0",
101
- "@instructure/ui-list": "10.11.0",
63
+ "@instructure/theme-registry": "10.26.2",
64
+ "@instructure/ui-a11y-content": "10.26.2",
65
+ "@instructure/ui-a11y-utils": "10.26.2",
66
+ "@instructure/ui-alerts": "10.26.2",
67
+ "@instructure/ui-avatar": "10.26.2",
68
+ "@instructure/ui-badge": "10.26.2",
69
+ "@instructure/ui-billboard": "10.26.2",
70
+ "@instructure/ui-buttons": "10.26.2",
71
+ "@instructure/ui-checkbox": "10.26.2",
72
+ "@instructure/ui-source-code-editor": "10.26.2",
73
+ "@instructure/ui-color-picker": "10.26.2",
74
+ "@instructure/ui-color-utils": "10.26.2",
75
+ "@instructure/ui-file-drop": "10.26.2",
76
+ "@instructure/ui-flex": "10.26.2",
77
+ "@instructure/ui-focusable": "10.26.2",
78
+ "@instructure/ui-form-field": "10.26.2",
79
+ "@instructure/ui-grid": "10.26.2",
80
+ "@instructure/ui-heading": "10.26.2",
81
+ "@instructure/ui-icons": "10.26.2",
82
+ "@instructure/ui-img": "10.26.2",
83
+ "@instructure/ui-link": "10.26.2",
84
+ "@instructure/ui-list": "10.26.2",
102
85
  "@instructure/ui-media-player": "^9.0.0",
103
- "@instructure/ui-menu": "10.11.0",
104
- "@instructure/ui-modal": "10.11.0",
105
- "@instructure/ui-motion": "10.11.0",
106
- "@instructure/ui-number-input": "10.11.0",
107
- "@instructure/ui-overlays": "10.11.0",
108
- "@instructure/ui-pagination": "10.11.0",
109
- "@instructure/ui-pill": "10.11.0",
110
- "@instructure/ui-popover": "10.11.0",
111
- "@instructure/ui-radio-input": "10.11.0",
112
- "@instructure/ui-simple-select": "10.11.0",
113
- "@instructure/ui-spinner": "10.11.0",
114
- "@instructure/ui-svg-images": "10.11.0",
115
- "@instructure/ui-table": "10.11.0",
116
- "@instructure/ui-tabs": "10.11.0",
117
- "@instructure/ui-text-area": "10.11.0",
118
- "@instructure/ui-text-input": "10.11.0",
119
- "@instructure/ui-text": "10.11.0",
120
- "@instructure/ui-themes": "10.11.0",
121
- "@instructure/ui-toggle-details": "10.11.0",
122
- "@instructure/ui-tooltip": "10.11.0",
123
- "@instructure/ui-tray": "10.11.0",
124
- "@instructure/ui-tree-browser": "10.11.0",
125
- "@instructure/ui-truncate-text": "10.11.0",
126
- "@instructure/ui-utils": "10.11.0",
127
- "@instructure/ui-view": "10.11.0",
128
- "@instructure/uid": "10.11.0",
86
+ "@instructure/ui-menu": "10.26.2",
87
+ "@instructure/ui-modal": "10.26.2",
88
+ "@instructure/ui-motion": "10.26.2",
89
+ "@instructure/ui-number-input": "10.26.2",
90
+ "@instructure/ui-overlays": "10.26.2",
91
+ "@instructure/ui-pagination": "10.26.2",
92
+ "@instructure/ui-pill": "10.26.2",
93
+ "@instructure/ui-popover": "10.26.2",
94
+ "@instructure/ui-radio-input": "10.26.2",
95
+ "@instructure/ui-simple-select": "10.26.2",
96
+ "@instructure/ui-spinner": "10.26.2",
97
+ "@instructure/ui-svg-images": "10.26.2",
98
+ "@instructure/ui-table": "10.26.2",
99
+ "@instructure/ui-tabs": "10.26.2",
100
+ "@instructure/ui-text-area": "10.26.2",
101
+ "@instructure/ui-text-input": "10.26.2",
102
+ "@instructure/ui-text": "10.26.2",
103
+ "@instructure/ui-themes": "10.26.2",
104
+ "@instructure/ui-toggle-details": "10.26.2",
105
+ "@instructure/ui-tooltip": "10.26.2",
106
+ "@instructure/ui-tray": "10.26.2",
107
+ "@instructure/ui-tree-browser": "10.26.2",
108
+ "@instructure/ui-truncate-text": "10.26.2",
109
+ "@instructure/ui-utils": "10.26.2",
110
+ "@instructure/ui-view": "10.26.2",
111
+ "@instructure/uid": "10.26.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.28.0",
116
+ "axios": "^0.30.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
+ }
@@ -1,319 +0,0 @@
1
- /*
2
- * Copyright (C) 2019 - present Instructure, Inc.
3
- *
4
- * This file is part of Canvas.
5
- *
6
- * Canvas is free software: you can redistribute it and/or modify it under
7
- * the terms of the GNU Affero General Public License as published by the Free
8
- * Software Foundation, version 3 of the License.
9
- *
10
- * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
11
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
- * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
- * details.
14
- *
15
- * You should have received a copy of the GNU Affero General Public License along
16
- * with this program. If not, see <http://www.gnu.org/licenses/>.
17
- */
18
-
19
- import {Selector, ClientFunction} from 'testcafe'
20
- fixture`RCEWrapper`.page`./testcafe.html`
21
- const tinyIframe = Selector('#textarea_ifr')
22
- const textArea = Selector('.RceHtmlEditor')
23
- const rceContainer = Selector('.tox-tinymce')
24
- const toggleButton = Selector('button').withText('</>')
25
- const linksButton = Selector('[role="button"][aria-label="Links"] .tox-split-button__chevron')
26
- const externalLinksMenuItem = Selector('[role^="menuitem"][title="External Links"]')
27
- const courseLinksMenuItem = Selector('[role^="menuitem"][title="Course Links"]')
28
- const editLinkMenuItem = Selector('[role^="menuitem"][title="Edit Link"]')
29
- const removeLinkMenuItem = Selector('[role^="menuitem"][title="Remove Link"]')
30
- const linkDialog = Selector('[data-testid="RCELinkOptionsDialog"]')
31
- const linkTray = Selector('[data-testid="RCELinkOptionsTray"]')
32
- const selectword = Selector('#selectword')
33
- const linksTraySelector = '[role="dialog"][aria-label="Course Links"]'
34
- const rceBody = Selector('#tinymce')
35
- const linksPanelSelector = Selector('[data-testid="instructure_links-LinksPanel"]')
36
-
37
- function named(name) {
38
- return Selector(`[name="${name}"]`)
39
- }
40
-
41
- function specificValue(value) {
42
- return Selector(`[value="${value}"]`)
43
- }
44
-
45
- test.skip('edits in the textarea are reflected in the editor', async t => {
46
- // const myText = ClientFunction(() => document.querySelector('#tinymce').innerText)
47
- await t
48
- .click(toggleButton)
49
- .typeText(textArea, 'this is new content')
50
- .click(toggleButton)
51
- .switchToIframe(tinyIframe)
52
-
53
- await t.expect(rceBody.withExactText('this is new content').visible).ok().switchToMainWindow()
54
-
55
- await t
56
- .click(toggleButton)
57
- .pressKey('end')
58
- .typeText(textArea, 'this is more content')
59
- .click(toggleButton)
60
- .switchToIframe(tinyIframe)
61
- .expect(Selector('body').find('p').withExactText('this is new content').visible)
62
- .ok()
63
- .expect(Selector('body').find('p').withExactText('this is more content').visible)
64
- .ok()
65
- .switchToMainWindow()
66
- })
67
-
68
- test.skip('shows the create links menu', async t => {
69
- await t
70
- .click(toggleButton)
71
- .typeText(textArea, '<div>this is <span id="selectword">selected</span> text</div>')
72
- .click(toggleButton)
73
- .expect(rceContainer.visible)
74
- .ok()
75
-
76
- await t
77
- .switchToIframe(tinyIframe)
78
- .selectEditableContent(selectword, selectword)
79
- .switchToMainWindow()
80
- .click(linksButton)
81
- .expect(externalLinksMenuItem.visible)
82
- .ok()
83
- .expect(courseLinksMenuItem.visible)
84
- .ok()
85
- })
86
-
87
- test.skip('shows the edit links menu', async t => {
88
- await t
89
- .click(toggleButton)
90
- .typeText(
91
- textArea,
92
- '<div>this is <a href="http://example.com"><span id="selectword">selected</span></a> text</div>'
93
- )
94
- .click(toggleButton)
95
- .expect(rceContainer.visible)
96
- .ok()
97
-
98
- await t
99
- .switchToIframe(tinyIframe)
100
- .selectEditableContent(selectword, selectword)
101
- .switchToMainWindow()
102
- .click(linksButton)
103
- .expect(editLinkMenuItem.visible)
104
- .ok()
105
- .expect(removeLinkMenuItem.visible)
106
- .ok()
107
- })
108
-
109
- test.skip('can create an external link', async t => {
110
- await t
111
- .click(toggleButton)
112
- .typeText(textArea, '<div>this is <span id="selectword">selected</span> text</div>')
113
- .click(toggleButton)
114
- .expect(rceContainer.visible)
115
- .ok()
116
-
117
- await t
118
- .switchToIframe(tinyIframe)
119
- .selectEditableContent(selectword, selectword)
120
- .switchToMainWindow()
121
- .click(linksButton)
122
- .click(externalLinksMenuItem)
123
- .expect(linkDialog.visible)
124
- .ok()
125
- .expect(named('linklink').visible)
126
- .ok()
127
-
128
- await t
129
- .typeText(named('linklink'), 'https://instructure.com')
130
- .click(Selector('button').withText('Done'))
131
- .switchToIframe(tinyIframe)
132
- .expect(
133
- Selector('a')
134
- .withAttribute('href', 'https://instructure.com')
135
- .withAttribute('target', '_blank').exists
136
- )
137
- .ok()
138
- })
139
-
140
- test.skip('can edit an external link', async t => {
141
- await t
142
- .click(toggleButton)
143
- .typeText(
144
- textArea,
145
- '<div>this is <a href="http://example.com"><span id="selectword">selected</span></a> text</div>'
146
- )
147
- .click(toggleButton)
148
- .expect(rceContainer.visible)
149
- .ok()
150
-
151
- await t
152
- .switchToIframe(tinyIframe)
153
- .selectEditableContent(selectword, selectword)
154
- .switchToMainWindow()
155
-
156
- // the link is selected, the toolbar button should be enabled
157
- // await t.expect(linksButton.hasClass('tox-tbtn--enabled')).ok()
158
-
159
- await t.click(linksButton).click(editLinkMenuItem).expect(linkTray.visible).ok()
160
-
161
- await t.expect(specificValue('http://example.com').exists).ok()
162
- await t.expect(specificValue('selected').exists).ok()
163
- })
164
-
165
- test.skip('expands selection to edit external link', async t => {
166
- await t
167
- .click(toggleButton)
168
- .typeText(
169
- textArea,
170
- '<div>this is <a href="http://example.com"><span id="selectword">selected</span></a> text</div>'
171
- )
172
- .click(toggleButton)
173
- .expect(rceContainer.visible)
174
- .ok()
175
-
176
- await t.switchToIframe(tinyIframe).click(selectword, {caretPos: 1}).switchToMainWindow()
177
-
178
- await t.click(linksButton).click(editLinkMenuItem).expect(linkTray.visible).ok()
179
-
180
- await t.expect(specificValue('http://example.com').exists).ok()
181
- await t.expect(specificValue('selected').exists).ok()
182
- })
183
-
184
- test.skip('can remove a link', async t => {
185
- await t
186
- .click(toggleButton)
187
- .typeText(
188
- textArea,
189
- '<div>this is <a href="http://example.com"><span id="selectword">selected</span></a> text</div>'
190
- )
191
- .click(toggleButton)
192
- .expect(rceContainer.visible)
193
- .ok()
194
-
195
- await t
196
- .switchToIframe(tinyIframe)
197
- .selectEditableContent(selectword, selectword)
198
- .switchToMainWindow()
199
- .click(linksButton)
200
- .click(removeLinkMenuItem)
201
-
202
- await t.switchToIframe(tinyIframe).expect(Selector('a').exists).notOk()
203
- })
204
-
205
- // fails at the React.lazy call to load the tray's panel
206
- test.skip('focus returns on dismissing tray', async t => {
207
- const tinymceSelection = ClientFunction(() => tinymce.get('textarea').selection.getContent()) // the textarea id is from testcafe.html
208
- const focusedId = ClientFunction(() => document.activeElement.id)
209
- const focusedTag = ClientFunction(() => document.activeElement.tagName)
210
- const ltSelector = Selector(linksTraySelector)
211
-
212
- await t
213
- .click(toggleButton)
214
- .typeText(textArea, '<div>this is <span id="selectword">selected</span> text</div>')
215
- .click(toggleButton)
216
- .expect(rceContainer.visible)
217
- .ok()
218
-
219
- await t
220
- .switchToIframe(tinyIframe)
221
- .selectEditableContent(selectword, selectword)
222
- .switchToMainWindow()
223
- .click(linksButton)
224
- .click(courseLinksMenuItem)
225
-
226
- await linksPanelSelector()
227
-
228
- await t
229
- .expect(ltSelector.visible)
230
- .ok()
231
- .click(Selector(`${linksTraySelector} button`).withText('Close'))
232
- .expect(ltSelector.exist)
233
- .notOk()
234
-
235
- await t
236
- .expect(tinymceSelection())
237
- .eql('selected')
238
- .expect(focusedId())
239
- .eql('textarea_ifr')
240
-
241
- .switchToIframe(tinyIframe)
242
- .expect(focusedTag())
243
- .eql('BODY')
244
- })
245
-
246
- test.skip('show the kb shortcut modal various ways', async t => {
247
- const kbshortcutbutton = Selector('button[data-testid="ShowOnFocusButton__button"]')
248
- const sbKbshortcutbutton = Selector('button[title="View keyboard shortcuts"]')
249
- const shortcutmodal = Selector('[data-testid="RCE_KeyboardShortcutModal"]')
250
- const focusKBSCBtn = ClientFunction(() => kbshortcutbutton().focus(), {
251
- dependencies: {kbshortcutbutton},
252
- })
253
- const focusSBKBSCBtn = ClientFunction(() => sbKbshortcutbutton().focus(), {
254
- dependencies: {sbKbshortcutbutton},
255
- })
256
-
257
- await t.expect(kbshortcutbutton.exists).ok()
258
-
259
- await focusKBSCBtn()
260
-
261
- // open keyboard shortcut modal from the show-on-focus button
262
- // close with escape
263
- await t
264
- .expect(kbshortcutbutton.visible)
265
- .ok()
266
- .click(kbshortcutbutton)
267
- .expect(shortcutmodal.visible)
268
- .ok()
269
- .pressKey('esc')
270
- .expect(shortcutmodal.exists)
271
- .notOk()
272
-
273
- // open modal using alt+0
274
- // close with the close button
275
- // await t
276
- // .switchToIframe(tinyIframe)
277
- // .click(Selector('body'))
278
- // .pressKey('alt+0')
279
- // .expect(shortcutmodal.visible)
280
- // .ok()
281
- // .click(Selector('button').withText('Close'))
282
- // .expect(shortcutmodal.exists)
283
- // .notOk()
284
-
285
- // open modal from button in status bar
286
- // debugger;
287
- // close with the close button
288
- await focusSBKBSCBtn()
289
-
290
- await t
291
- .expect(sbKbshortcutbutton.exists)
292
- .ok()
293
- .click(sbKbshortcutbutton)
294
- .expect(shortcutmodal.visible)
295
- .ok()
296
- .click(Selector('button').withText('Close'))
297
- .expect(shortcutmodal.exists)
298
- .notOk()
299
- })
300
-
301
- // test.skip('can bring up the images dialog', async t => {
302
- // await t
303
- // .switchToMainWindow()
304
- // .click(imagesButton())
305
- // .click(uploadImageMenuItem())
306
- // .expect(uploadImageDialog().visible)
307
- // .ok()
308
-
309
- // await t
310
- // .typeText(named('linklink'), 'https://instructure.com')
311
- // .click(Selector('button').withText('Done'))
312
- // .switchToIframe(tinyIframe)
313
- // .expect(
314
- // Selector('a')
315
- // .withAttribute('href', 'https://instructure.com')
316
- // .withAttribute('target', '_blank').exists
317
- // )
318
- // .ok()
319
- // })
@@ -1,108 +0,0 @@
1
- /*
2
- * Copyright (C) 2019 - present Instructure, Inc.
3
- *
4
- * This file is part of Canvas.
5
- *
6
- * Canvas is free software: you can redistribute it and/or modify it under
7
- * the terms of the GNU Affero General Public License as published by the Free
8
- * Software Foundation, version 3 of the License.
9
- *
10
- * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
11
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
- * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
- * details.
14
- *
15
- * You should have received a copy of the GNU Affero General Public License along
16
- * with this program. If not, see <http://www.gnu.org/licenses/>.
17
- */
18
-
19
- import {Selector} from 'testcafe'
20
- fixture`StatusBar`.page`./testcafe.html`
21
-
22
- const tinyIframe = Selector('#textarea_ifr')
23
- const application = Selector('.tox-tinymce[role="document"]')
24
- const textArea = Selector('.RceHtmlEditor')
25
- const statusPath = Selector('[data-testid="whole-status-bar-path"]')
26
- const wordCount = Selector('[data-testid="status-bar-word-count"]')
27
- const toggleButton = Selector('button').withText('</>')
28
- const dragHandle = Selector('[name="IconDragHandle"]')
29
-
30
- test.skip('toggles between rce and html views', async t => {
31
- const rceContainer = Selector('.tox-tinymce')
32
- const keyboardButton = Selector('button[title="View keyboard shortcuts"]')
33
- const a11yButton = Selector('button[title="Accessibility Checker"]')
34
- await t.expect(rceContainer.visible).ok('rce should be initially visible')
35
- // initially empty, so it's not visible, but we just care that it exists
36
- await t.expect(statusPath.exists).ok('rich content path should be visible')
37
- await t.expect(keyboardButton.visible).ok('keyboard button should be visible')
38
- await t.expect(a11yButton.visible).ok('a11yButton button should be visible')
39
- await t.expect(wordCount.visible).ok('word count should be visible')
40
- await t.expect(textArea.visible).notOk('textarea should be initially invisible')
41
- await t.click(toggleButton)
42
- await t.expect(rceContainer.visible).notOk('rce should be invisible after toggle')
43
- await t.expect(textArea.visible).ok('textarea should be visible after toggle')
44
- await t.expect(statusPath.count).eql(0)
45
- await t.expect(wordCount.count).eql(0)
46
- await t.expect(keyboardButton.count).eql(0)
47
- await t.expect(a11yButton.count).eql(0)
48
- await t.expect(dragHandle.visible).ok('drag handle should still be visible')
49
- await t.click(toggleButton)
50
- await t.expect(rceContainer.visible).ok('rce should be visible after toggling again')
51
- await t.expect(statusPath.visible).ok('rich content path should be visible again')
52
- await t.expect(keyboardButton.visible).ok('keyboard button should be visible again')
53
- await t.expect(a11yButton.visible).ok('a11yButton button should be visible again')
54
- await t.expect(wordCount.visible).ok('word count should be visible again')
55
- await t.expect(textArea.visible).notOk('textarea should be hidden after toggling again')
56
- })
57
-
58
- test.skip('counts words', async t => {
59
- // search for the exact text for the selector will wait for it to change to this text
60
- await t.expect(wordCount.withText('0 words').exists).ok()
61
-
62
- await t.switchToIframe(tinyIframe).typeText('body', 'foo')
63
- await t.switchToMainWindow().expect(wordCount.withText('1 word').exists).ok()
64
-
65
- await t.switchToIframe(tinyIframe).typeText('body', ' bar baz bing')
66
- await t.switchToMainWindow().expect(Selector('span').withText('4 words').exists).ok()
67
- })
68
-
69
- test.skip('displays the current html path', async t => {
70
- await t.switchToIframe(tinyIframe).typeText('body', 'foo ')
71
- await t.expect(Selector(statusPath).withText(/p.*strong.*em/).exists).notOk()
72
- await t.switchToMainWindow().click(Selector('button[title="Bold"]'))
73
- await t.switchToIframe(tinyIframe).typeText('body', 'bar ')
74
- await t.switchToMainWindow().click(Selector('button[title="Italic"]'))
75
- await t.switchToIframe(tinyIframe).typeText('body', 'baz ')
76
- await t
77
- .switchToMainWindow()
78
- .expect(statusPath.withText(/p.*strong.*em/).exists)
79
- .ok()
80
- })
81
- // these 2 tests fail in headless
82
- test.skip('drag handle resizes the editor', async t => {
83
- const initialSize = await tinyIframe.boundingClientRect
84
- await t.drag(dragHandle, -100, 400)
85
- let finalSize = await tinyIframe.boundingClientRect
86
- await t.expect(finalSize.height).eql(initialSize.height + 400)
87
- await t.expect(finalSize.width).eql(initialSize.width)
88
- await t.drag(dragHandle, -100, -300)
89
- finalSize = await tinyIframe.boundingClientRect
90
- await t.expect(finalSize.height).eql(initialSize.height + 100)
91
- await t.expect(finalSize.width).eql(initialSize.width)
92
- })
93
-
94
- test.skip('drag handle in rce mode also resizes the textarea', async t => {
95
- await t.drag(dragHandle, 0, 400)
96
- const applicationHeight = await application.getStyleProperty('height')
97
- await t.click(toggleButton)
98
- const textareaHeight = await textArea.getStyleProperty('height')
99
- await t.expect(textareaHeight).eql(applicationHeight)
100
- })
101
-
102
- test.skip('drag handle in textarea mode also resizes the rce', async t => {
103
- await t.click(toggleButton).drag(dragHandle, 0, 400)
104
- const textareaHeight = await textArea.getStyleProperty('height')
105
- await t.click(toggleButton)
106
- const rceHeight = await application.getStyleProperty('height')
107
- await t.expect(rceHeight).eql(textareaHeight)
108
- })