@instructure/canvas-rce 5.14.2 → 5.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/DEVELOPMENT.md +1 -1
  3. package/es/bridge/Bridge.js +10 -17
  4. package/es/canvasFileBrowser/FileBrowser.js +10 -19
  5. package/es/common/FlashAlert.js +8 -11
  6. package/es/common/fileUrl.js +6 -10
  7. package/es/common/incremental-loading/LoadMoreButton.js +3 -4
  8. package/es/common/incremental-loading/LoadingStatus.js +4 -11
  9. package/es/common/indicate.js +1 -2
  10. package/es/defaultTinymceConfig.js +1 -1
  11. package/es/enhance-user-content/doc_previews.js +10 -10
  12. package/es/enhance-user-content/enhance_user_content.js +4 -7
  13. package/es/enhance-user-content/external_links.js +1 -1
  14. package/es/enhance-user-content/instructure_helper.js +11 -17
  15. package/es/enhance-user-content/mathml.js +15 -27
  16. package/es/enhance-user-content/media_comment_thumbnail.js +3 -10
  17. package/es/format-message.js +2 -2
  18. package/es/index.js +3 -5
  19. package/es/rce/AlertMessageArea.js +15 -16
  20. package/es/rce/KeyboardShortcutModal.js +2 -2
  21. package/es/rce/RCE.js +6 -8
  22. package/es/rce/RCEVariants.js +2 -4
  23. package/es/rce/RCEWrapper.js +397 -289
  24. package/es/rce/RCEWrapper.utils.js +131 -0
  25. package/es/rce/RCEWrapperProps.js +2 -3
  26. package/es/rce/RceHtmlEditor.js +12 -11
  27. package/es/rce/ResizeHandle.js +1 -2
  28. package/es/rce/ShowOnFocusButton/index.js +2 -2
  29. package/es/rce/StatusBar.js +5 -10
  30. package/es/rce/contentInsertion.js +1 -2
  31. package/es/rce/contentRendering.js +6 -5
  32. package/es/rce/editorLanguage.js +1 -1
  33. package/es/rce/indicatorRegion.js +1 -2
  34. package/es/rce/normalizeProps.js +4 -4
  35. package/es/rce/plugins/instructure_color/clickCallback.js +2 -4
  36. package/es/rce/plugins/instructure_color/components/ColorPicker.js +17 -22
  37. package/es/rce/plugins/instructure_color/components/ColorPopup.js +7 -8
  38. package/es/rce/plugins/instructure_condensed_buttons/ui/list-button.js +4 -10
  39. package/es/rce/plugins/instructure_condensed_buttons/ui/subscript-superscript-button.js +1 -1
  40. package/es/rce/plugins/instructure_documents/components/Link.js +1 -2
  41. package/es/rce/plugins/instructure_equation/EquationEditorModal/index.js +5 -8
  42. package/es/rce/plugins/instructure_equation/EquationEditorModal/latexTextareaUtil.js +3 -3
  43. package/es/rce/plugins/instructure_equation/EquationEditorModal/parseLatex.js +3 -3
  44. package/es/rce/plugins/instructure_equation/EquationEditorToolbar/buttons.js +2 -2
  45. package/es/rce/plugins/instructure_equation/EquationEditorToolbar/index.js +9 -11
  46. package/es/rce/plugins/instructure_equation/MathIcon/index.js +3 -4
  47. package/es/rce/plugins/instructure_equation/mathlive/index.js +167 -16
  48. package/es/rce/plugins/instructure_fullscreen/plugin.js +0 -2
  49. package/es/rce/plugins/instructure_icon_maker/clickCallback.js +3 -4
  50. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ColorSection.js +46 -49
  51. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/CreateIconMakerForm.js +9 -10
  52. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Footer.js +10 -11
  53. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Group.js +5 -6
  54. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Header.js +7 -8
  55. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.js +7 -9
  56. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ImageOptions.js +19 -26
  57. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ImageSection.js +8 -12
  58. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ModeSelect.js +6 -7
  59. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/MultiColor/index.js +5 -6
  60. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SVGList.js +6 -7
  61. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SVGThumbnail.js +8 -10
  62. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SingleColor/index.js +5 -6
  63. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SingleColor/svg.js +32 -80
  64. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Upload.js +7 -8
  65. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/utils.js +4 -5
  66. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Preview.js +3 -4
  67. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ShapeSection.js +4 -5
  68. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/TextSection.js +4 -5
  69. package/es/rce/plugins/instructure_icon_maker/components/IconMakerTray.js +22 -29
  70. package/es/rce/plugins/instructure_icon_maker/registerEditToolbar.js +1 -1
  71. package/es/rce/plugins/instructure_icon_maker/svg/image.js +5 -7
  72. package/es/rce/plugins/instructure_icon_maker/svg/index.js +6 -9
  73. package/es/rce/plugins/instructure_icon_maker/svg/settings.js +17 -20
  74. package/es/rce/plugins/instructure_icon_maker/svg/shape.js +4 -5
  75. package/es/rce/plugins/instructure_icon_maker/svg/text.js +28 -32
  76. package/es/rce/plugins/instructure_icon_maker/svg/utils.js +2 -4
  77. package/es/rce/plugins/instructure_icon_maker/utils/IconMakerClose.js +2 -3
  78. package/es/rce/plugins/instructure_icon_maker/utils/iconValidation.js +1 -2
  79. package/es/rce/plugins/instructure_image/ImageEmbedOptions.js +3 -7
  80. package/es/rce/plugins/instructure_image/ImageList/Image.js +7 -8
  81. package/es/rce/plugins/instructure_image/ImageList/index.js +7 -8
  82. package/es/rce/plugins/instructure_image/ImageOptionsTray/TrayController.js +2 -4
  83. package/es/rce/plugins/instructure_image/ImageOptionsTray/index.js +3 -3
  84. package/es/rce/plugins/instructure_image/plugin.js +1 -2
  85. package/es/rce/plugins/instructure_links/components/AccordionSection.js +7 -8
  86. package/es/rce/plugins/instructure_links/components/Link.js +61 -65
  87. package/es/rce/plugins/instructure_links/components/LinkOptionsDialog/LinkOptionsDialogController.js +1 -2
  88. package/es/rce/plugins/instructure_links/components/LinkOptionsDialog/index.js +2 -2
  89. package/es/rce/plugins/instructure_links/components/LinkOptionsTray/index.js +2 -2
  90. package/es/rce/plugins/instructure_links/components/LinkSet.js +28 -37
  91. package/es/rce/plugins/instructure_links/components/LinksPanel.js +21 -8
  92. package/es/rce/plugins/instructure_links/components/NoResults.js +6 -7
  93. package/es/rce/plugins/instructure_links/plugin.js +6 -9
  94. package/es/rce/plugins/instructure_media_embed/clickCallback.js +3 -4
  95. package/es/rce/plugins/instructure_media_embed/components/Embed.js +6 -7
  96. package/es/rce/plugins/instructure_paste/plugin.js +5 -7
  97. package/es/rce/plugins/instructure_rce_external_tools/ExternalToolsEnv.js +24 -33
  98. package/es/rce/plugins/instructure_rce_external_tools/RceToolWrapper.js +7 -38
  99. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +30 -29
  100. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +3 -4
  101. package/es/rce/plugins/instructure_rce_external_tools/dialog-helper.js +1 -2
  102. package/es/rce/plugins/instructure_rce_external_tools/jquery/jquery.dropdownList.js +3 -4
  103. package/es/rce/plugins/instructure_rce_external_tools/lti11-content-items/RceLti11ContentItem.js +17 -24
  104. package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/RceLti13ContentItem.js +2 -2
  105. package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/BaseLinkContentItem.js +4 -5
  106. package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/processEditorContentItems.js +8 -9
  107. package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/rceLti13ContentItemFromJson.js +0 -1
  108. package/es/rce/plugins/instructure_rce_external_tools/plugin.js +4 -4
  109. package/es/rce/plugins/instructure_rce_external_tools/util/externalToolsForToolbar.js +42 -0
  110. package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.js +5 -10
  111. package/es/rce/plugins/instructure_record/AudioOptionsTray/index.js +12 -13
  112. package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +8 -15
  113. package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +19 -20
  114. package/es/rce/plugins/instructure_record/clickCallback.js +26 -30
  115. package/es/rce/plugins/instructure_search_and_replace/clickCallback.js +2 -3
  116. package/es/rce/plugins/instructure_search_and_replace/components/FindReplaceTray.js +14 -16
  117. package/es/rce/plugins/instructure_search_and_replace/components/FindReplaceTrayController.js +9 -12
  118. package/es/rce/plugins/instructure_search_and_replace/plugin.js +1 -2
  119. package/es/rce/plugins/instructure_wordcount/clickCallback.js +3 -4
  120. package/es/rce/plugins/instructure_wordcount/components/WordCountModal.js +26 -33
  121. package/es/rce/plugins/instructure_wordcount/utils/countContent.js +3 -3
  122. package/es/rce/plugins/instructure_wordcount/utils/tableContent.js +5 -8
  123. package/es/rce/plugins/shared/CanvasContentTray.js +9 -16
  124. package/es/rce/plugins/shared/ColorInput.js +22 -25
  125. package/es/rce/plugins/shared/ConditionalTooltip.js +5 -6
  126. package/es/rce/plugins/shared/ContentSelection.js +12 -20
  127. package/es/rce/plugins/shared/DimensionUtils.js +2 -4
  128. package/es/rce/plugins/shared/EventUtils.js +1 -1
  129. package/es/rce/plugins/shared/FixedContentTray.js +13 -14
  130. package/es/rce/plugins/shared/ImageCropper/DirectionRegion.js +3 -4
  131. package/es/rce/plugins/shared/ImageCropper/Modal.js +12 -13
  132. package/es/rce/plugins/shared/ImageCropper/Preview.js +11 -13
  133. package/es/rce/plugins/shared/ImageCropper/controls/CustomNumberInput.js +8 -9
  134. package/es/rce/plugins/shared/ImageCropper/controls/ResetControls.js +3 -4
  135. package/es/rce/plugins/shared/ImageCropper/controls/RotationControls.js +4 -5
  136. package/es/rce/plugins/shared/ImageCropper/controls/ShapeControls.js +7 -11
  137. package/es/rce/plugins/shared/ImageCropper/controls/ZoomControls.js +4 -5
  138. package/es/rce/plugins/shared/ImageCropper/controls/index.js +4 -5
  139. package/es/rce/plugins/shared/ImageCropper/controls/useDebouncedNumericValue.js +13 -15
  140. package/es/rce/plugins/shared/ImageCropper/imageCropUtils.js +18 -21
  141. package/es/rce/plugins/shared/ImageCropper/svg/shape.js +4 -5
  142. package/es/rce/plugins/shared/ImageCropper/svg/utils.js +2 -4
  143. package/es/rce/plugins/shared/ImageCropper/useKeyMouseEvents.js +1 -4
  144. package/es/rce/plugins/shared/ImageOptionsForm.js +17 -18
  145. package/es/rce/plugins/shared/LinkDisplay.js +8 -9
  146. package/es/rce/plugins/shared/PreviewIcon.js +8 -9
  147. package/es/rce/plugins/shared/RceFileBrowser.js +2 -3
  148. package/es/rce/plugins/shared/StoreContext.js +8 -10
  149. package/es/rce/plugins/shared/StudioLtiSupportUtils.js +5 -6
  150. package/es/rce/plugins/shared/Upload/CanvasContentPanel.js +6 -7
  151. package/es/rce/plugins/shared/Upload/CategoryProcessor.js +1 -2
  152. package/es/rce/plugins/shared/Upload/ComputerPanel.js +11 -14
  153. package/es/rce/plugins/shared/Upload/PanelFilter.js +7 -8
  154. package/es/rce/plugins/shared/Upload/UploadFile.js +19 -22
  155. package/es/rce/plugins/shared/Upload/UploadFileModal.js +28 -34
  156. package/es/rce/plugins/shared/Upload/UrlPanel.js +4 -5
  157. package/es/rce/plugins/shared/Upload/UsageRightsSelectBox.js +18 -24
  158. package/es/rce/plugins/shared/Upload/doFileUpload.js +6 -7
  159. package/es/rce/plugins/shared/ai_tools/AIResponseModal.js +7 -8
  160. package/es/rce/plugins/shared/ai_tools/AIToolsTray.js +14 -17
  161. package/es/rce/plugins/shared/ai_tools/aiicons.js +2 -2
  162. package/es/rce/plugins/shared/canvasContentUtils.js +1 -2
  163. package/es/rce/plugins/shared/compressionUtils.js +17 -20
  164. package/es/rce/plugins/shared/do-fetch-api-effect/doFetchApi.js +12 -15
  165. package/es/rce/plugins/shared/do-fetch-api-effect/get-cookie.js +1 -1
  166. package/es/rce/plugins/shared/fileTypeUtils.js +3 -6
  167. package/es/rce/plugins/shared/round.js +1 -2
  168. package/es/rce/plugins/shared/trayUtils.js +3 -0
  169. package/es/rce/plugins/shared/useDataUrl.js +4 -5
  170. package/es/rce/plugins/tinymce-a11y-checker/components/ColorField.js +2 -2
  171. package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +8 -10
  172. package/es/rce/plugins/tinymce-a11y-checker/node-checker.js +1 -3
  173. package/es/rce/plugins/tinymce-a11y-checker/plugin.js +14 -17
  174. package/es/rce/plugins/tinymce-a11y-checker/rules/headings-start-at-h2.js +1 -2
  175. package/es/rce/plugins/tinymce-a11y-checker/rules/large-text-contrast.js +1 -2
  176. package/es/rce/plugins/tinymce-a11y-checker/rules/small-text-contrast.js +1 -2
  177. package/es/rce/plugins/tinymce-a11y-checker/utils/dom.js +2 -4
  178. package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.js +2 -3
  179. package/es/rce/plugins/tinymce-a11y-checker/utils/rgb-hex.js +1 -4
  180. package/es/rce/root.js +9 -9
  181. package/es/rce/tinyRCE.js +1 -0
  182. package/es/rce/transformContent.js +1 -1
  183. package/es/rcs/api.js +39 -55
  184. package/es/rcs/buildError.js +3 -3
  185. package/es/rcs/fake.js +5 -7
  186. package/es/sidebar/actions/documents.js +10 -12
  187. package/es/sidebar/actions/files.js +18 -22
  188. package/es/sidebar/actions/filter.js +4 -5
  189. package/es/sidebar/actions/images.js +20 -26
  190. package/es/sidebar/actions/media.js +15 -18
  191. package/es/sidebar/actions/session.js +1 -2
  192. package/es/sidebar/actions/upload.js +26 -37
  193. package/es/sidebar/containers/sidebarHandlers.js +6 -12
  194. package/es/sidebar/dragHtml.js +6 -2
  195. package/es/sidebar/reducers/all_files.js +1 -3
  196. package/es/sidebar/reducers/collection.js +1 -3
  197. package/es/sidebar/reducers/collections.js +1 -3
  198. package/es/sidebar/reducers/documents.js +1 -3
  199. package/es/sidebar/reducers/files.js +1 -3
  200. package/es/sidebar/reducers/filter.js +7 -15
  201. package/es/sidebar/reducers/flickr.js +1 -3
  202. package/es/sidebar/reducers/folder.js +1 -3
  203. package/es/sidebar/reducers/folders.js +1 -3
  204. package/es/sidebar/reducers/images.js +1 -3
  205. package/es/sidebar/reducers/media.js +1 -3
  206. package/es/sidebar/reducers/newPageLinkExpanded.js +1 -3
  207. package/es/sidebar/reducers/noop.js +1 -2
  208. package/es/sidebar/reducers/rootFolderId.js +1 -3
  209. package/es/sidebar/reducers/session.js +1 -3
  210. package/es/sidebar/reducers/ui.js +3 -9
  211. package/es/sidebar/reducers/upload.js +8 -24
  212. package/es/sidebar/store/initialState.js +1 -2
  213. package/es/translations/locales/ar.js +6 -0
  214. package/es/translations/locales/ca.js +6 -0
  215. package/es/translations/locales/cy.js +6 -0
  216. package/es/translations/locales/da-x-k12.js +6 -0
  217. package/es/translations/locales/da.js +6 -0
  218. package/es/translations/locales/de.js +6 -0
  219. package/es/translations/locales/en-AU-x-unimelb.js +6 -0
  220. package/es/translations/locales/en-GB-x-ukhe.js +6 -0
  221. package/es/translations/locales/en_AU.js +6 -0
  222. package/es/translations/locales/en_CA.js +6 -0
  223. package/es/translations/locales/en_CY.js +6 -0
  224. package/es/translations/locales/en_GB.js +6 -0
  225. package/es/translations/locales/es.js +6 -0
  226. package/es/translations/locales/es_ES.js +6 -0
  227. package/es/translations/locales/fi.js +6 -0
  228. package/es/translations/locales/fr.js +6 -0
  229. package/es/translations/locales/fr_CA.js +6 -0
  230. package/es/translations/locales/hi.js +6 -0
  231. package/es/translations/locales/ht.js +6 -0
  232. package/es/translations/locales/id.js +6 -0
  233. package/es/translations/locales/is.js +6 -0
  234. package/es/translations/locales/it.js +6 -0
  235. package/es/translations/locales/ja.js +6 -0
  236. package/es/translations/locales/mi.js +6 -0
  237. package/es/translations/locales/ms.js +6 -0
  238. package/es/translations/locales/nb-x-k12.js +6 -0
  239. package/es/translations/locales/nb.js +6 -0
  240. package/es/translations/locales/nl.js +6 -0
  241. package/es/translations/locales/pl.js +6 -0
  242. package/es/translations/locales/pt.js +6 -0
  243. package/es/translations/locales/pt_BR.js +6 -0
  244. package/es/translations/locales/ru.js +6 -0
  245. package/es/translations/locales/sl.js +6 -0
  246. package/es/translations/locales/sv-x-k12.js +6 -0
  247. package/es/translations/locales/sv.js +6 -0
  248. package/es/translations/locales/th.js +6 -0
  249. package/es/translations/locales/vi.js +6 -0
  250. package/es/translations/locales/zh-Hans.js +6 -0
  251. package/es/translations/locales/zh-Hant.js +6 -0
  252. package/es/translations/locales/zh.js +6 -0
  253. package/es/translations/locales/zh_HK.js +6 -0
  254. package/es/util/elem-util.js +1 -1
  255. package/es/util/file-url-util.js +1 -1
  256. package/es/util/fullscreenHelpers.js +6 -9
  257. package/es/util/loadingPlaceholder.js +2 -3
  258. package/es/util/simpleCache.js +1 -2
  259. package/es/util/url-util.js +5 -5
  260. package/eslint.config.js +15 -4
  261. package/locales/en.json +190 -10
  262. package/package.json +56 -55
  263. package/scripts/installTranslations.js +7 -8
  264. package/tsconfig.json +1 -1
  265. package/types/format-message-generate-id.d.ts +22 -0
  266. package/types/js-beautify.d.ts +21 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 5.15.0 - 2025-02-12
9
+
10
+ - Lazy load iframe and images by default
11
+ - Improve TypeScript coverage
12
+ - Use Biome for formatting
13
+ - Upgrade ESLint
14
+ - Remove jQuery dependency
15
+ - Remove some node.js dependencies
16
+ - Replace some ReactDOM.render usage with createRoot
17
+
8
18
  ## 5.14.2 - 2024-11-26
9
19
 
10
20
  - Added an icon to find and replace tray error
package/DEVELOPMENT.md CHANGED
@@ -79,7 +79,7 @@ or anything else that gets mounted in a react portal comes with 2 requirements
79
79
 
80
80
  1. Include the attribute `data-mce-component={true}` on the `<Modal>` or ` <Tray>`. This tells the RCE
81
81
  that the modal is part of the RCE and not to fire a `blur` event when it closes and loses focus.
82
- 1. Include `mountNode={instuPopupMountNode}` on thew `<Modal>` or `<Tray>`. The `instuiPopupMountNode`
82
+ 1. Include `mountNode={instuiPopupMountNodeFn}` on thew `<Modal>` or `<Tray>`. The `instuiPopupMountNodeFn`
83
83
  function is imported from `src/util/fullscreenHelpers` within the `canvas-rce` package or `@instructure/canvs-rce` from outside. This function will mount modals in the `<div class="rce-wrapper">` when the RCE is fullscreen, where it will not be hidden behind the RCE.
84
84
 
85
85
  ## Upgrading TinyMCE
@@ -16,15 +16,15 @@
16
16
  * with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
 
19
- import K5Uploader from '@instructure/k5uploader';
19
+ import { K5Uploader } from '@instructure/k5uploader';
20
20
  import { fileEmbed } from '../common/mimeClass';
21
+ import mediaTranslations from '../rce/plugins/instructure_record/mediaTranslations';
21
22
 
22
23
  /* eslint no-console: 0 */
23
24
  export default class Bridge {
24
25
  constructor() {
25
26
  this.insertLink = link => {
26
27
  if (this.focusedEditor) {
27
- var _this$controller;
28
28
  const {
29
29
  selection
30
30
  } = this.focusedEditor.props.tinymce.get(this.focusedEditor.props.textareaId);
@@ -36,7 +36,7 @@ export default class Bridge {
36
36
  link.text = link.title || link.href;
37
37
  }
38
38
  this.focusedEditor.insertLink(link);
39
- (_this$controller = this.controller(this.focusedEditor.id)) === null || _this$controller === void 0 ? void 0 : _this$controller.hideTray();
39
+ this.controller(this.focusedEditor.id)?.hideTray();
40
40
  } else {
41
41
  console.warn('clicked sidebar link without a focused editor');
42
42
  }
@@ -77,16 +77,14 @@ export default class Bridge {
77
77
  };
78
78
  this.insertVideo = video => {
79
79
  if (this.focusedEditor) {
80
- var _this$controller2;
81
80
  this.focusedEditor.insertVideo(video);
82
- (_this$controller2 = this.controller(this.focusedEditor.id)) === null || _this$controller2 === void 0 ? void 0 : _this$controller2.hideTray();
81
+ this.controller(this.focusedEditor.id)?.hideTray();
83
82
  }
84
83
  };
85
84
  this.insertAudio = audio => {
86
85
  if (this.focusedEditor) {
87
- var _this$controller3;
88
86
  this.focusedEditor.insertAudio(audio);
89
- (_this$controller3 = this.controller(this.focusedEditor.id)) === null || _this$controller3 === void 0 ? void 0 : _this$controller3.hideTray();
87
+ this.controller(this.focusedEditor.id)?.hideTray();
90
88
  }
91
89
  };
92
90
  this.focusedEditor = null; // the RCEWrapper, not tinymce
@@ -121,10 +119,8 @@ export default class Bridge {
121
119
  this.focusedEditor = null;
122
120
  }
123
121
  }
124
- focusActiveEditor() {
125
- var _this$focusedEditor, _this$focusedEditor$m, _this$focusedEditor$m2;
126
- let skipFocus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
127
- (_this$focusedEditor = this.focusedEditor) === null || _this$focusedEditor === void 0 ? void 0 : (_this$focusedEditor$m = _this$focusedEditor.mceInstance) === null || _this$focusedEditor$m === void 0 ? void 0 : (_this$focusedEditor$m2 = _this$focusedEditor$m.call(_this$focusedEditor)) === null || _this$focusedEditor$m2 === void 0 ? void 0 : _this$focusedEditor$m2.focus(skipFocus);
122
+ focusActiveEditor(skipFocus = false) {
123
+ this.focusedEditor?.mceInstance?.()?.focus(skipFocus);
128
124
  }
129
125
  get mediaServerSession() {
130
126
  return this._mediaServerSession;
@@ -152,8 +148,7 @@ export default class Bridge {
152
148
  // are in English
153
149
  get uploadMediaTranslations() {
154
150
  if (!this._uploadMediaTranslations) {
155
- const module = require('../rce/plugins/instructure_record/mediaTranslations');
156
- this._uploadMediaTranslations = module.default;
151
+ this._uploadMediaTranslations = mediaTranslations;
157
152
  }
158
153
  return this._uploadMediaTranslations;
159
154
  }
@@ -178,8 +173,7 @@ export default class Bridge {
178
173
  delete this._controller[editorId];
179
174
  }
180
175
  showTrayForPlugin(plugin, editorId) {
181
- var _this$_controller$edi;
182
- (_this$_controller$edi = this._controller[editorId]) === null || _this$_controller$edi === void 0 ? void 0 : _this$_controller$edi.showTrayForPlugin(plugin);
176
+ this._controller[editorId]?.showTrayForPlugin(plugin);
183
177
  }
184
178
  hideTrays() {
185
179
  Object.keys(this._controller).forEach(eid => {
@@ -204,9 +198,8 @@ export default class Bridge {
204
198
 
205
199
  insertImage(image) {
206
200
  if (this.focusedEditor) {
207
- var _this$controller4;
208
201
  const result = this.focusedEditor.insertImage(image);
209
- (_this$controller4 = this.controller(this.focusedEditor.id)) === null || _this$controller4 === void 0 ? void 0 : _this$controller4.hideTray();
202
+ this.controller(this.focusedEditor.id)?.hideTray();
210
203
  return result;
211
204
  }
212
205
  }
@@ -29,9 +29,7 @@ import natcompare from '../common/natcompare';
29
29
  export const PENDING_MEDIA_ENTRY_ID = 'maybe';
30
30
  class FileBrowser extends React.Component {
31
31
  constructor(_props2) {
32
- var _this;
33
32
  super(_props2);
34
- _this = this;
35
33
  this.fetchSubFolders = _.memoize(id => {
36
34
  this.source.fetchBookmarkedData(this.source.fetchSubFolders.bind(this.source), {
37
35
  folderId: id,
@@ -44,12 +42,11 @@ class FileBrowser extends React.Component {
44
42
  console.error(error);
45
43
  });
46
44
  });
47
- this.populateCollectionsList = function (folderList) {
48
- let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
49
- _this.setState((state, props) => {
45
+ this.populateCollectionsList = (folderList, opts = {}) => {
46
+ this.setState((state, props) => {
50
47
  const newCollections = _.cloneDeep(state.collections);
51
48
  folderList.forEach(folder => {
52
- const collection = _this.formatFolderInfo(folder, {
49
+ const collection = this.formatFolderInfo(folder, {
53
50
  ...opts,
54
51
  searchString: props.searchString
55
52
  });
@@ -58,7 +55,7 @@ class FileBrowser extends React.Component {
58
55
  const collectionCollections = newCollections[parentId].collections;
59
56
  if (!collectionCollections.includes(collection.id)) {
60
57
  collectionCollections.push(collection.id);
61
- newCollections[parentId].collections = _this.orderedIdsFromList(newCollections, collectionCollections);
58
+ newCollections[parentId].collections = this.orderedIdsFromList(newCollections, collectionCollections);
62
59
  }
63
60
  });
64
61
  return {
@@ -198,8 +195,7 @@ class FileBrowser extends React.Component {
198
195
  loadingCount
199
196
  });
200
197
  }
201
- getRootFolderData(context, contextId) {
202
- let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
198
+ getRootFolderData(context, contextId, opts = {}) {
203
199
  this.increaseLoadingCount();
204
200
  this.source.fetchRootFolder({
205
201
  contextType: context,
@@ -213,8 +209,7 @@ class FileBrowser extends React.Component {
213
209
  }
214
210
  });
215
211
  }
216
- populateRootFolder(data) {
217
- let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
212
+ populateRootFolder(data, opts = {}) {
218
213
  this.decreaseLoadingCount();
219
214
  this.populateCollectionsList([data], opts);
220
215
  this.getFolderData(data.id);
@@ -224,11 +219,10 @@ class FileBrowser extends React.Component {
224
219
  // of the given folder ID, handing pagination
225
220
 
226
221
  fetchFiles(id) {
227
- var _this$state$collectio, _this$state$collectio2;
228
222
  this.source.fetchBookmarkedData(this.source.fetchFilesForFolder.bind(this.source), {
229
223
  searchString: this.props.searchString,
230
224
  perPage: 50,
231
- filesUrl: (_this$state$collectio = this.state.collections[id]) === null || _this$state$collectio === void 0 ? void 0 : (_this$state$collectio2 = _this$state$collectio.api) === null || _this$state$collectio2 === void 0 ? void 0 : _this$state$collectio2.filesUrl
225
+ filesUrl: this.state.collections[id]?.api?.filesUrl
232
226
  }, result => {
233
227
  this.populateItemsList(result.files);
234
228
  }, error => {
@@ -265,9 +259,7 @@ class FileBrowser extends React.Component {
265
259
  }
266
260
  return false;
267
261
  }
268
- formatFolderInfo(apiFolder) {
269
- var _apiFolder$contextTyp;
270
- let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
262
+ formatFolderInfo(apiFolder, opts = {}) {
271
263
  const descriptor = apiFolder.lockedForUser ? formatMessage('Locked') : null;
272
264
  const folder = {
273
265
  api: apiFolder,
@@ -275,7 +267,7 @@ class FileBrowser extends React.Component {
275
267
  collections: [],
276
268
  items: [],
277
269
  name: apiFolder.name,
278
- context: `/${(_apiFolder$contextTyp = apiFolder.contextType) === null || _apiFolder$contextTyp === void 0 ? void 0 : _apiFolder$contextTyp.toLowerCase()}s/${apiFolder.contextId}`,
270
+ context: `/${apiFolder.contextType?.toLowerCase()}s/${apiFolder.contextId}`,
279
271
  canUpload: apiFolder.canUpload,
280
272
  locked: apiFolder.lockedForUser,
281
273
  descriptor,
@@ -313,8 +305,7 @@ class FileBrowser extends React.Component {
313
305
  containerRef
314
306
  };
315
307
  }
316
- formatFileInfo(apiFile) {
317
- let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
308
+ formatFileInfo(apiFile, opts = {}) {
318
309
  const {
319
310
  collections
320
311
  } = this.state;
@@ -178,13 +178,12 @@ FlashAlert.defaultProps = {
178
178
  timeout: TIMEOUT,
179
179
  screenReaderOnly: false
180
180
  };
181
- export function showFlashAlert(_ref) {
182
- let {
183
- message,
184
- err,
185
- type = err ? 'error' : 'info',
186
- srOnly = false
187
- } = _ref;
181
+ export function showFlashAlert({
182
+ message,
183
+ err,
184
+ type = err ? 'error' : 'info',
185
+ srOnly = false
186
+ }) {
188
187
  function closeAlert(atNode) {
189
188
  ReactDOM.unmountComponentAtNode(atNode);
190
189
  atNode.remove();
@@ -201,8 +200,7 @@ export function showFlashAlert(_ref) {
201
200
  return alertContainer;
202
201
  }
203
202
  function renderAlert(parent) {
204
- var _RCEGlobals$getConfig;
205
- const configuredTimeout = (_RCEGlobals$getConfig = RCEGlobals.getConfig()) === null || _RCEGlobals$getConfig === void 0 ? void 0 : _RCEGlobals$getConfig.flashAlertTimeout;
203
+ const configuredTimeout = RCEGlobals.getConfig()?.flashAlertTimeout;
206
204
  ReactDOM.render(/*#__PURE__*/React.createElement(FlashAlert, {
207
205
  message: message,
208
206
  timeout: Number.isNaN(parseInt(configuredTimeout, 10)) ? TIMEOUT : configuredTimeout,
@@ -226,8 +224,7 @@ export function destroyContainer() {
226
224
  if (container) container.remove();
227
225
  if (liveRegion) liveRegion.remove();
228
226
  }
229
- export function showFlashError() {
230
- let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : formatMessage('An error occurred making a network request');
227
+ export function showFlashError(message = formatMessage('An error occurred making a network request')) {
231
228
  return err => showFlashAlert({
232
229
  message,
233
230
  err,
@@ -21,8 +21,7 @@
21
21
  // in mocha tests.
22
22
 
23
23
  import RCEGlobals from '../rce/RCEGlobals';
24
- function parseCanvasUrl(url) {
25
- let canvasOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.origin;
24
+ function parseCanvasUrl(url, canvasOrigin = window.location.origin) {
26
25
  if (!url) {
27
26
  return null;
28
27
  }
@@ -57,8 +56,7 @@ function parseCanvasUrl(url) {
57
56
  function formatUrl(parsed) {
58
57
  try {
59
58
  // Format query string while preserving original encoding
60
- const queryPairs = Object.entries(parsed.query || {}).map(_ref => {
61
- let [key, value] = _ref;
59
+ const queryPairs = Object.entries(parsed.query || {}).map(([key, value]) => {
62
60
  // Use encodeURIComponent to preserve %20 encoding
63
61
  return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
64
62
  });
@@ -135,7 +133,6 @@ export function fixupFileUrl(
135
133
  contextType, contextId, fileInfo, canvasOrigin) {
136
134
  const key = fileInfo.href ? 'href' : 'url';
137
135
  if (fileInfo[key]) {
138
- var _RCEGlobals$getFeatur, _fileInfo$key, _fileInfo$key2;
139
136
  const currentOrigin = canvasOrigin || window.location.origin;
140
137
  let parsed = parseCanvasUrl(fileInfo[key], currentOrigin);
141
138
  if (!parsed) {
@@ -146,7 +143,7 @@ contextType, contextId, fileInfo, canvasOrigin) {
146
143
  // if this is a user file, add the verifier
147
144
  // if this is in New Quizzes and the feature flag is enabled, add the verifier
148
145
 
149
- if (fileInfo.uuid && (contextType.includes('user') || !!canvasOrigin && canvasOrigin !== window.location.origin && (_RCEGlobals$getFeatur = RCEGlobals.getFeatures()) !== null && _RCEGlobals$getFeatur !== void 0 && _RCEGlobals$getFeatur.file_verifiers_for_quiz_links)) {
146
+ if (fileInfo.uuid && (contextType.includes('user') || !!canvasOrigin && canvasOrigin !== window.location.origin && RCEGlobals.getFeatures()?.file_verifiers_for_quiz_links)) {
150
147
  parsed.search = null;
151
148
  parsed.query.verifier = fileInfo.uuid;
152
149
  } else {
@@ -155,8 +152,8 @@ contextType, contextId, fileInfo, canvasOrigin) {
155
152
  const formattedUrl = formatUrl(parsed);
156
153
 
157
154
  // Keep absolute URLs if they match the canvas origin and input was absolute
158
- const isAbsoluteUrl = (_fileInfo$key = fileInfo[key]) === null || _fileInfo$key === void 0 ? void 0 : _fileInfo$key.startsWith('http');
159
- const matchesCanvasOrigin = (_fileInfo$key2 = fileInfo[key]) === null || _fileInfo$key2 === void 0 ? void 0 : _fileInfo$key2.startsWith(currentOrigin);
155
+ const isAbsoluteUrl = fileInfo[key]?.startsWith('http');
156
+ const matchesCanvasOrigin = fileInfo[key]?.startsWith(currentOrigin);
160
157
  fileInfo[key] = isAbsoluteUrl && matchesCanvasOrigin ? formattedUrl : absoluteToRelativeUrl(formattedUrl, currentOrigin);
161
158
  }
162
159
  return fileInfo;
@@ -167,8 +164,7 @@ contextType, contextId, fileInfo, canvasOrigin) {
167
164
  // This is appropriate for images in some rce content.
168
165
  // Remove wrap=1 to indicate we want the file downloaded
169
166
  // (which is necessary to show in an <img> tag), not viewed
170
- export function prepEmbedSrc(url) {
171
- let canvasOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.origin;
167
+ export function prepEmbedSrc(url, canvasOrigin = window.location.origin) {
172
168
  const parsed = parseCanvasUrl(url, canvasOrigin);
173
169
  if (!parsed) {
174
170
  return url;
@@ -21,10 +21,9 @@ import { func, shape } from 'prop-types';
21
21
  import { Button } from '@instructure/ui-buttons';
22
22
  import { View } from '@instructure/ui-view';
23
23
  import formatMessage from '../../format-message';
24
- export default function LoadMoreButton(_ref) {
25
- let {
26
- loader
27
- } = _ref;
24
+ export default function LoadMoreButton({
25
+ loader
26
+ }) {
28
27
  return /*#__PURE__*/React.createElement(View, {
29
28
  as: "div",
30
29
  padding: "small",
@@ -17,13 +17,11 @@
17
17
  */
18
18
 
19
19
  import React from 'react';
20
- import { number, shape } from 'prop-types';
21
20
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
22
21
  import formatMessage from '../../format-message';
23
- export default function LoadingStatus(_ref) {
24
- let {
25
- loader
26
- } = _ref;
22
+ export default function LoadingStatus({
23
+ loader
24
+ }) {
27
25
  let itemsLoadedText = null;
28
26
  if (loader.lastRecordsLoaded > 0) {
29
27
  itemsLoadedText = formatMessage(`{
@@ -38,9 +36,4 @@ export default function LoadingStatus(_ref) {
38
36
  "aria-live": "polite",
39
37
  "aria-relevant": "text additions"
40
38
  }, itemsLoadedText);
41
- }
42
- LoadingStatus.propTypes = {
43
- loader: shape({
44
- lastRecordsLoaded: number.isRequired
45
- }).isRequired
46
- };
39
+ }
@@ -22,8 +22,7 @@ import { StyleSheet, css } from 'aphrodite';
22
22
  const MARGIN = 3;
23
23
 
24
24
  // show the indicator over the target with specified margin
25
- export default function indicate(region) {
26
- let margin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MARGIN;
25
+ export default function indicate(region, margin = MARGIN) {
27
26
  const el = document.createElement('div');
28
27
 
29
28
  // add margin to region and lift it in front
@@ -74,7 +74,7 @@ const defaultTinymceConfig = {
74
74
  //
75
75
  // this list needs to be kept in sync with the list in gems/canvas_sanitize/lib/canvas_sanitize/canvas_sanitize.rb
76
76
  valid_elements: '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|role],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|data-old-link],strong/b,em/i,strike/s,u,#p,-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt|title|hspace|vspace|width|height|align|role|data-old-link],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width|height|src|*],map[name],area[shape|coords|href|alt|target],bdo,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,kbd,q[cite],samp,small,tt,var,big,figure,figcaption,source[media|width|height|sizes|src|srcset|type|data-old-link],track,mark,article,aside,details,footer,header,nav,section,summary,time',
77
- extended_valid_elements: '@[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|contextmenu|draggable|dropzone|hidden|longdesc|spellcheck|translate|align|role|aria-labelledby|aria-atomic|aria-busy|aria-controls|aria-describedby|aria-disabled|aria-dropeffect|aria-flowto|aria-grabbed|aria-haspopup|aria-hidden|aria-invalid|aria-label|aria-labelledby|aria-live|aria-owns|aria-relevant|aria-autocomplete|aria-checked|aria-disabled|aria-expanded|aria-haspopup|aria-hidden|aria-invalid|aria-label|aria-level|aria-multiline|aria-multiselectable|aria-orientation|aria-pressed|aria-readonly|aria-required|aria-selected|aria-sort|aria-valuemax|aria-valuemin|aria-valuenow|aria-valuetext],iframe[id|data-media-type|title|src|width|height|name|align|style|class|sandbox|allowfullscreen|webkitallowfullscreen|mozallowfullscreen|allow|data-old-link],i[iclass],a[hidden|href|target|rel|media|hreflang|type|charset|name|rev|shape|coords|download|alt],#p,li[value],-ol[reversed|start|type|compact],pre[width],table[border|summary|width|frame|rules|cellspacing|cellpadding|bgcolor],tbody[char|charoff|valign],td[colspan|rowspan|headers|abbr|axis|scope|align|char|charoff|valign|nowrap|bgcolor|width|height],tfoot[char|charoff|valign],th[colspan|rowspan|headers|scope|abbr|axis|align|char|charoff|valign|nowrap|bgcolor|width|height],thead[char|charoff|valign],tr[char|charoff|valign|bgcolor],-ul[compact],video[name|src|allowfullscreen|muted|poster|width|height|controls|playsinline],audio[name|src|muted|controls],annotation[href|xref|definitionURL|encoding|cd|name|src],annotation-xml[href|xref|definitionURL|encoding|cd|name|src],maction[href|xref|mathcolor|mathbackground|actiontype|selection],maligngroup[href|xref|mathcolor|mathbackground|groupalign],malignmark[href|xref|mathcolor|mathbackground|edge],math[xmlns|href|xref|display|maxwidth|overflow|altimg|altimg-width|altimg-height|altimg-valign|alttext|cdgroup|mathcolor|mathbackground|scriptlevel|displaystyle|scriptsizemultiplier|scriptminsize|infixlinebreakstyle|decimalpoint|mathvariant|mathsize|width|height|valign|form|fence|separator|lspace|rspace|stretchy|symmetric|maxsize|minsize|largeop|movablelimits|accent|linebreak|lineleading|linebreakstyle|linebreakmultchar|indentalign|indentshift|indenttarget|indentalignfirst|indentshiftfirst|indentalignlast|indentshiftlast|depth|lquote|rquote|linethickness|munalign|denomalign|bevelled|voffset|open|close|separators|notation|subscriptshift|superscriptshift|accentunder|align|rowalign|columnalign|groupalign|alignmentscope|columnwidth|rowspacing|columnspacing|rowlines|columnlines|frame|framespacing|equalrows|equalcolumns|side|minlabelspacing|rowspan|columnspan|edge|stackalign|charalign|charspacing|longdivstyle|position|shift|location|crossout|length|leftoverhang|rightoverhang|mslinethickness|selection],menclose[href|xref|mathcolor|mathbackground|notation],merror[href|xref|mathcolor|mathbackground],mfenced[href|xref|mathcolor|mathbackground|open|close|separators],mfrac[href|xref|mathcolor|mathbackground|linethickness|munalign|denomalign|bevelled],mglyph[href|xref|mathcolor|mathbackground|src|alt|width|height|valign],mi[href|xref|mathcolor|mathbackground|mathvariant|mathsize],mlabeledtr[href|xref|mathcolor|mathbackground],mlongdiv[href|xref|mathcolor|mathbackground|longdivstyle|align|stackalign|charalign|charspacing],mmultiscripts[href|xref|mathcolor|mathbackground|subscriptshift|superscriptshift],mn[href|xref|mathcolor|mathbackground|mathvariant|mathsize],mo[href|xref|mathcolor|mathbackground|mathvariant|mathsize|form|fence|separator|lspace|rspace|stretchy|symmetric|maxsize|minsize|largeop|movablelimits|accent|linebreak|lineleading|linebreakstyle|linebreakmultchar|indentalign|indentshift|indenttarget|indentalignfirst|indentshiftfirst|indentalignlast|indentshiftlast],mover[href|xref|mathcolor|mathbackground|accent|align],mpadded[href|xref|mathcolor|mathbackground|height|depth|width|lspace|voffset],mphantom[href|xref|mathcolor|mathbackground],mprescripts[href|xref|mathcolor|mathbackground],mroot[href|xref|mathcolor|mathbackground],mrow[href|xref|mathcolor|mathbackground],ms[href|xref|mathcolor|mathbackground|mathvariant|mathsize|lquote|rquote],mscarries[href|xref|mathcolor|mathbackground|position|location|crossout|scriptsizemultiplier],mscarry[href|xref|mathcolor|mathbackground|location|crossout],msgroup[href|xref|mathcolor|mathbackground|position|shift],msline[href|xref|mathcolor|mathbackground|position|length|leftoverhang|rightoverhang|mslinethickness],mspace[href|xref|mathcolor|mathbackground|mathvariant|mathsize],msqrt[href|xref|mathcolor|mathbackground],msrow[href|xref|mathcolor|mathbackground|position],mstack[href|xref|mathcolor|mathbackground|align|stackalign|charalign|charspacing],mstyle[href|xref|mathcolor|mathbackground|scriptlevel|displaystyle|scriptsizemultiplier|scriptminsize|infixlinebreakstyle|decimalpoint|mathvariant|mathsize|width|height|valign|form|fence|separator|lspace|rspace|stretchy|symmetric|maxsize|minsize|largeop|movablelimits|accent|linebreak|lineleading|linebreakstyle|linebreakmultchar|indentalign|indentshift|indenttarget|indentalignfirst|indentshiftfirst|indentalignlast|indentshiftlast|depth|lquote|rquote|linethickness|munalign|denomalign|bevelled|voffset|open|close|separators|notation|subscriptshift|superscriptshift|accentunder|align|rowalign|columnalign|groupalign|alignmentscope|columnwidth|rowspacing|columnspacing|rowlines|columnlines|frame|framespacing|equalrows|equalcolumns|side|minlabelspacing|rowspan|columnspan|edge|stackalign|charalign|charspacing|longdivstyle|position|shift|location|crossout|length|leftoverhang|rightoverhang|mslinethickness|selection],msub[href|xref|mathcolor|mathbackground|subscriptshift],msubsup[href|xref|mathcolor|mathbackground|subscriptshift|superscriptshift],msup[href|xref|mathcolor|mathbackground|superscriptshift],mtable[href|xref|mathcolor|mathbackground|align|rowalign|columnalign|groupalign|alignmentscope|columnwidth|width|rowspacing|columnspacing|rowlines|columnlines|frame|framespacing|equalrows|equalcolumns|displaystyle|side|minlabelspacing],mtd[href|xref|mathcolor|mathbackground|rowspan|columnspan|rowalign|columnalign|groupalign],mtext[href|xref|mathcolor|mathbackground|mathvariant|mathsize|width|height|depth|linebreak],mtr[href|xref|mathcolor|mathbackground|rowalign|columnalign|groupalign],munder[href|xref|mathcolor|mathbackground|accentunder|align],munderover[href|xref|mathcolor|mathbackground|accent|accentunder|align],none[href|xref|mathcolor|mathbackground],semantics[href|xref|definitionURL|encoding],picture,ruby,rp,rt,wbr' +
77
+ extended_valid_elements: '@[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|contextmenu|draggable|dropzone|hidden|longdesc|spellcheck|translate|align|role|aria-labelledby|aria-atomic|aria-busy|aria-controls|aria-describedby|aria-disabled|aria-dropeffect|aria-flowto|aria-grabbed|aria-haspopup|aria-hidden|aria-invalid|aria-label|aria-labelledby|aria-live|aria-owns|aria-relevant|aria-autocomplete|aria-checked|aria-disabled|aria-expanded|aria-haspopup|aria-hidden|aria-invalid|aria-label|aria-level|aria-multiline|aria-multiselectable|aria-orientation|aria-pressed|aria-readonly|aria-required|aria-selected|aria-sort|aria-valuemax|aria-valuemin|aria-valuenow|aria-valuetext],iframe[id|data-media-type|title|src|width|height|name|align|style|class|sandbox|loading|allowfullscreen|webkitallowfullscreen|mozallowfullscreen|allow|data-old-link],i[iclass],a[hidden|href|target|rel|media|hreflang|type|charset|name|rev|shape|coords|download|alt],#p,li[value],-ol[reversed|start|type|compact],pre[width],table[border|summary|width|frame|rules|cellspacing|cellpadding|bgcolor],tbody[char|charoff|valign],td[colspan|rowspan|headers|abbr|axis|scope|align|char|charoff|valign|nowrap|bgcolor|width|height],tfoot[char|charoff|valign],th[colspan|rowspan|headers|scope|abbr|axis|align|char|charoff|valign|nowrap|bgcolor|width|height],thead[char|charoff|valign],tr[char|charoff|valign|bgcolor],-ul[compact],video[name|src|allowfullscreen|muted|poster|width|height|controls|playsinline],audio[name|src|muted|controls],annotation[href|xref|definitionURL|encoding|cd|name|src],annotation-xml[href|xref|definitionURL|encoding|cd|name|src],maction[href|xref|mathcolor|mathbackground|actiontype|selection],maligngroup[href|xref|mathcolor|mathbackground|groupalign],malignmark[href|xref|mathcolor|mathbackground|edge],math[xmlns|href|xref|display|maxwidth|overflow|altimg|altimg-width|altimg-height|altimg-valign|alttext|cdgroup|mathcolor|mathbackground|scriptlevel|displaystyle|scriptsizemultiplier|scriptminsize|infixlinebreakstyle|decimalpoint|mathvariant|mathsize|width|height|valign|form|fence|separator|lspace|rspace|stretchy|symmetric|maxsize|minsize|largeop|movablelimits|accent|linebreak|lineleading|linebreakstyle|linebreakmultchar|indentalign|indentshift|indenttarget|indentalignfirst|indentshiftfirst|indentalignlast|indentshiftlast|depth|lquote|rquote|linethickness|munalign|denomalign|bevelled|voffset|open|close|separators|notation|subscriptshift|superscriptshift|accentunder|align|rowalign|columnalign|groupalign|alignmentscope|columnwidth|rowspacing|columnspacing|rowlines|columnlines|frame|framespacing|equalrows|equalcolumns|side|minlabelspacing|rowspan|columnspan|edge|stackalign|charalign|charspacing|longdivstyle|position|shift|location|crossout|length|leftoverhang|rightoverhang|mslinethickness|selection],menclose[href|xref|mathcolor|mathbackground|notation],merror[href|xref|mathcolor|mathbackground],mfenced[href|xref|mathcolor|mathbackground|open|close|separators],mfrac[href|xref|mathcolor|mathbackground|linethickness|munalign|denomalign|bevelled],mglyph[href|xref|mathcolor|mathbackground|src|alt|width|height|valign],mi[href|xref|mathcolor|mathbackground|mathvariant|mathsize],mlabeledtr[href|xref|mathcolor|mathbackground],mlongdiv[href|xref|mathcolor|mathbackground|longdivstyle|align|stackalign|charalign|charspacing],mmultiscripts[href|xref|mathcolor|mathbackground|subscriptshift|superscriptshift],mn[href|xref|mathcolor|mathbackground|mathvariant|mathsize],mo[href|xref|mathcolor|mathbackground|mathvariant|mathsize|form|fence|separator|lspace|rspace|stretchy|symmetric|maxsize|minsize|largeop|movablelimits|accent|linebreak|lineleading|linebreakstyle|linebreakmultchar|indentalign|indentshift|indenttarget|indentalignfirst|indentshiftfirst|indentalignlast|indentshiftlast],mover[href|xref|mathcolor|mathbackground|accent|align],mpadded[href|xref|mathcolor|mathbackground|height|depth|width|lspace|voffset],mphantom[href|xref|mathcolor|mathbackground],mprescripts[href|xref|mathcolor|mathbackground],mroot[href|xref|mathcolor|mathbackground],mrow[href|xref|mathcolor|mathbackground],ms[href|xref|mathcolor|mathbackground|mathvariant|mathsize|lquote|rquote],mscarries[href|xref|mathcolor|mathbackground|position|location|crossout|scriptsizemultiplier],mscarry[href|xref|mathcolor|mathbackground|location|crossout],msgroup[href|xref|mathcolor|mathbackground|position|shift],msline[href|xref|mathcolor|mathbackground|position|length|leftoverhang|rightoverhang|mslinethickness],mspace[href|xref|mathcolor|mathbackground|mathvariant|mathsize],msqrt[href|xref|mathcolor|mathbackground],msrow[href|xref|mathcolor|mathbackground|position],mstack[href|xref|mathcolor|mathbackground|align|stackalign|charalign|charspacing],mstyle[href|xref|mathcolor|mathbackground|scriptlevel|displaystyle|scriptsizemultiplier|scriptminsize|infixlinebreakstyle|decimalpoint|mathvariant|mathsize|width|height|valign|form|fence|separator|lspace|rspace|stretchy|symmetric|maxsize|minsize|largeop|movablelimits|accent|linebreak|lineleading|linebreakstyle|linebreakmultchar|indentalign|indentshift|indenttarget|indentalignfirst|indentshiftfirst|indentalignlast|indentshiftlast|depth|lquote|rquote|linethickness|munalign|denomalign|bevelled|voffset|open|close|separators|notation|subscriptshift|superscriptshift|accentunder|align|rowalign|columnalign|groupalign|alignmentscope|columnwidth|rowspacing|columnspacing|rowlines|columnlines|frame|framespacing|equalrows|equalcolumns|side|minlabelspacing|rowspan|columnspan|edge|stackalign|charalign|charspacing|longdivstyle|position|shift|location|crossout|length|leftoverhang|rightoverhang|mslinethickness|selection],msub[href|xref|mathcolor|mathbackground|subscriptshift],msubsup[href|xref|mathcolor|mathbackground|subscriptshift|superscriptshift],msup[href|xref|mathcolor|mathbackground|superscriptshift],mtable[href|xref|mathcolor|mathbackground|align|rowalign|columnalign|groupalign|alignmentscope|columnwidth|width|rowspacing|columnspacing|rowlines|columnlines|frame|framespacing|equalrows|equalcolumns|displaystyle|side|minlabelspacing],mtd[href|xref|mathcolor|mathbackground|rowspan|columnspan|rowalign|columnalign|groupalign],mtext[href|xref|mathcolor|mathbackground|mathvariant|mathsize|width|height|depth|linebreak],mtr[href|xref|mathcolor|mathbackground|rowalign|columnalign|groupalign],munder[href|xref|mathcolor|mathbackground|accentunder|align],munderover[href|xref|mathcolor|mathbackground|accent|accentunder|align],none[href|xref|mathcolor|mathbackground],semantics[href|xref|definitionURL|encoding],picture,ruby,rp,rt,wbr' +
78
78
  // the svg necessary for the uploading placeholder's spinner
79
79
  'svg[*],g[*],circle[*]',
80
80
  non_empty_elements: 'td th iframe video audio object script a i area base basefont br col frame hr img input isindex link meta param embed source wbr track ruby',
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import React from 'react';
20
- import ReactDOM from 'react-dom';
20
+ import { createRoot } from 'react-dom/client';
21
21
  import formatMessage from '../format-message';
22
22
  import { Spinner } from '@instructure/ui-spinner';
23
23
  import { getData, setData } from './jqueryish_funcs';
@@ -39,8 +39,7 @@ export function isPreviewable(mimeType) {
39
39
  //
40
40
  // $link: the DOM node that serves as the reference for locating the spinner
41
41
  // position: one of 'adjacent' or 'centered'
42
- export function showLoadingImage($link) {
43
- let position = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'adjacent';
42
+ export function showLoadingImage($link, position = 'adjacent') {
44
43
  const dir = $link && window.getComputedStyle($link).direction || 'ltr';
45
44
  const boundingBox = $link.getBoundingClientRect();
46
45
  const offsetLeft = boundingBox.left + (position === 'adjacent' ? dir === 'ltr' ? boundingBox.width : -24 : boundingBox.width / 2);
@@ -64,18 +63,22 @@ export function showLoadingImage($link) {
64
63
  $imageHolder.setAttribute('style', `z-index:${zIndex}; position: absolute; top: ${top}; left: ${left}; margin-inline-start:${imageMarginInlineStart}; margin-top: ${imageMarginTop}`);
65
64
  $link.appendChild($imageHolder);
66
65
  }
67
- ReactDOM.render(/*#__PURE__*/React.createElement(Spinner, {
66
+ const root = createRoot($imageHolder);
67
+ root.render(/*#__PURE__*/React.createElement(Spinner, {
68
68
  size: "x-small",
69
69
  renderTitle: formatMessage('Loading')
70
- }), $imageHolder);
70
+ }));
71
71
  return $link;
72
72
  }
73
73
  export function removeLoadingImage($link) {
74
- var _$link$querySelector;
75
- (_$link$querySelector = $link.querySelector('.loading_image')) === null || _$link$querySelector === void 0 ? void 0 : _$link$querySelector.remove();
74
+ $link.querySelector('.loading_image')?.remove();
76
75
  const list = getData($link, 'loading_images') || [];
77
76
  list.forEach(item => {
78
77
  if (item) {
78
+ const root = item._reactRoot;
79
+ if (root) {
80
+ root.unmount();
81
+ }
79
82
  item.remove();
80
83
  }
81
84
  });
@@ -174,7 +177,6 @@ export function loadDocPreview($container, options) {
174
177
  }
175
178
  }
176
179
  showLoadingImage($container, 'centered');
177
- // eslint-disable-next-line promise/catch-or-return
178
180
  fetch(url).then(response => {
179
181
  if (!response.ok) throw new Error(`${response.status}: ${response.statusText}`);
180
182
  return response;
@@ -187,7 +189,6 @@ export function loadDocPreview($container, options) {
187
189
  loadGooglePreview();
188
190
  }
189
191
  }).catch(ex => {
190
- // eslint-disable-next-line no-console
191
192
  console.error(ex);
192
193
  }).finally(() => {
193
194
  removeLoadingImage($container);
@@ -214,7 +215,6 @@ export function sanitizeUrl(url) {
214
215
  const defaultUrl = 'about:blank';
215
216
  try {
216
217
  const parsedUrl = new URL(url, window.location.origin);
217
- // eslint-disable-next-line no-script-url
218
218
  if (parsedUrl.protocol === 'javascript:') {
219
219
  return defaultUrl;
220
220
  }
@@ -27,7 +27,7 @@ import { makeExternalLinkIcon } from './external_links';
27
27
  import getTranslations from '../getTranslations';
28
28
 
29
29
  // in jest the es directory doesn't exist so stub the undefined svg
30
- const IconDownloadSVG = (IconDownloadLine === null || IconDownloadLine === void 0 ? void 0 : IconDownloadLine.src) || '<svg></svg>';
30
+ const IconDownloadSVG = IconDownloadLine?.src || '<svg></svg>';
31
31
  function makeDownloadButton(download_url, filename) {
32
32
  const a = document.createElement('a');
33
33
  a.setAttribute('class', 'file_download_btn');
@@ -109,22 +109,19 @@ function buildUrl(url) {
109
109
  }
110
110
  const addResourceIdentifiersToStudioContent = content => {
111
111
  content.querySelectorAll('iframe.lti-embed').forEach(iframe => {
112
- var _userContentContainer, _userContentContainer2;
113
112
  const url = buildUrl(iframe.getAttribute('src'));
114
113
  if (!url || !url.pathname.includes('external_tools/retrieve') || !url.search.includes('instructuremedia.com') || !url.search.includes('custom_arc_media_id')) {
115
114
  return;
116
115
  }
117
116
  const userContentContainer = iframe.closest('.user_content');
118
- if (userContentContainer !== null && userContentContainer !== void 0 && (_userContentContainer = userContentContainer.dataset) !== null && _userContentContainer !== void 0 && _userContentContainer.resourceType && userContentContainer !== null && userContentContainer !== void 0 && (_userContentContainer2 = userContentContainer.dataset) !== null && _userContentContainer2 !== void 0 && _userContentContainer2.resourceId) {
117
+ if (userContentContainer?.dataset?.resourceType && userContentContainer?.dataset?.resourceId) {
119
118
  url.searchParams.set('com_instructure_course_canvas_resource_type', userContentContainer.dataset.resourceType);
120
119
  url.searchParams.set('com_instructure_course_canvas_resource_id', userContentContainer.dataset.resourceId);
121
120
  iframe.src = url.href;
122
121
  }
123
122
  });
124
123
  };
125
- export function enhanceUserContent() {
126
- let container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
127
- let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
124
+ export function enhanceUserContent(container = document, opts = {}) {
128
125
  const {
129
126
  customEnhanceFunc,
130
127
  canvasOrigin,
@@ -330,7 +327,7 @@ export function enhanceUserContent() {
330
327
  unenhanced_anchors.forEach($anchor => {
331
328
  $anchor.querySelectorAll('img.media_comment_thumbnail').forEach($thumbnail => {
332
329
  const a = closest($thumbnail, 'a', content);
333
- a === null || a === void 0 ? void 0 : a.classList.add('instructure_inline_media_comment');
330
+ a?.classList.add('instructure_inline_media_comment');
334
331
  });
335
332
  if ($anchor.matches('.instructure_inline_media_comment')) {
336
333
  $anchor.classList.remove('no-underline');
@@ -19,7 +19,7 @@
19
19
  import { IconExternalLinkLine } from '@instructure/ui-icons/es/svg';
20
20
  import { getTld } from './instructure_helper';
21
21
  import formatMessage from '../format-message';
22
- const IconExternalLinkSVG = (IconExternalLinkLine === null || IconExternalLinkLine === void 0 ? void 0 : IconExternalLinkLine.src) || '<svg></svg>';
22
+ const IconExternalLinkSVG = IconExternalLinkLine?.src || '<svg></svg>';
23
23
  export function makeExternalLinkIcon(forLink) {
24
24
  const dir = forLink && window.getComputedStyle(forLink).direction || 'ltr';
25
25
  const $icon = document.createElement('span');
@@ -35,8 +35,7 @@ export function getTld(hostname) {
35
35
  length = parts.length;
36
36
  return (length > 1 ? [parts[length - 2], parts[length - 1]] : parts).join('.');
37
37
  }
38
- export function isExternalLink(element) {
39
- let canvasOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.location.origin;
38
+ export function isExternalLink(element, canvasOrigin = window.location.origin) {
40
39
  let canvasHost;
41
40
  try {
42
41
  canvasHost = new URL(canvasOrigin).hostname;
@@ -47,9 +46,7 @@ export function isExternalLink(element) {
47
46
  // if a browser doesnt support <a>.hostname then just dont mark anything as external, better to not get false positives.
48
47
  return !!(href && href.length && !href.match(/^(mailto\:|javascript\:)/) && element.hostname && getTld(element.hostname) !== getTld(canvasHost));
49
48
  }
50
- export function showFilePreview(event) {
51
- var _event$target, _event$currentTarget;
52
- let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
49
+ export function showFilePreview(event, opts = {}) {
53
50
  event.stopPropagation();
54
51
  const {
55
52
  canvasOrigin,
@@ -58,9 +55,9 @@ export function showFilePreview(event) {
58
55
  ...opts
59
56
  };
60
57
  let target = null;
61
- if ((_event$target = event.target) !== null && _event$target !== void 0 && _event$target.href) {
58
+ if (event.target?.href) {
62
59
  target = event.target;
63
- } else if ((_event$currentTarget = event.currentTarget) !== null && _event$currentTarget !== void 0 && _event$currentTarget.href) {
60
+ } else if (event.currentTarget?.href) {
64
61
  target = event.currentTarget;
65
62
  } else {
66
63
  return;
@@ -75,14 +72,13 @@ export function showFilePreview(event) {
75
72
  }
76
73
  }
77
74
  export function showFilePreviewInOverlay(event, canvasOrigin) {
78
- var _event$target2, _event$currentTarget2, _target;
79
75
  let target = null;
80
- if ((_event$target2 = event.target) !== null && _event$target2 !== void 0 && _event$target2.href) {
76
+ if (event.target?.href) {
81
77
  target = event.target;
82
- } else if ((_event$currentTarget2 = event.currentTarget) !== null && _event$currentTarget2 !== void 0 && _event$currentTarget2.href) {
78
+ } else if (event.currentTarget?.href) {
83
79
  target = event.currentTarget;
84
80
  }
85
- const matches = (_target = target) === null || _target === void 0 ? void 0 : _target.href.match(/\/files\/(\d+~\d+|\d+)/);
81
+ const matches = target?.href.match(/\/files\/(\d+~\d+|\d+)/);
86
82
  if (matches) {
87
83
  if (event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) {
88
84
  // if any modifier keys are pressed, do the browser default thing
@@ -90,9 +86,9 @@ export function showFilePreviewInOverlay(event, canvasOrigin) {
90
86
  }
91
87
  event.preventDefault();
92
88
  const url = new URL(target.href);
93
- const verifier = url === null || url === void 0 ? void 0 : url.searchParams.get('verifier');
94
- const access_token = url === null || url === void 0 ? void 0 : url.searchParams.get('access_token');
95
- const instfs_id = url === null || url === void 0 ? void 0 : url.searchParams.get('instfs_id');
89
+ const verifier = url?.searchParams.get('verifier');
90
+ const access_token = url?.searchParams.get('access_token');
91
+ const instfs_id = url?.searchParams.get('instfs_id');
96
92
  const file_id = matches[1];
97
93
  const params = {
98
94
  subject: 'preview_file',
@@ -144,8 +140,7 @@ export function showFilePreviewInline(event, canvasOrigin, disableGooglePreviews
144
140
  if (attachment && (!disableGooglePreviews && isPreviewable(attachment.content_type) || canvadoc_session_url)) {
145
141
  $link.setAttribute('aria-expanded', 'true');
146
142
  if (canvasOrigin && canvadoc_session_url !== null) {
147
- var _parseUrlOrNull;
148
- canvadoc_session_url = (_parseUrlOrNull = parseUrlOrNull(canvadoc_session_url, canvasOrigin)) === null || _parseUrlOrNull === void 0 ? void 0 : _parseUrlOrNull.toString();
143
+ canvadoc_session_url = parseUrlOrNull(canvadoc_session_url, canvasOrigin)?.toString();
149
144
  }
150
145
  const $div = document.querySelector(`[id="${$link.getAttribute('aria-controls')}"]`);
151
146
  $div.style.display = 'block';
@@ -177,7 +172,6 @@ export function showFilePreviewInline(event, canvasOrigin, disableGooglePreviews
177
172
  message: formatMessage('Failed getting file contents'),
178
173
  type: 'error'
179
174
  });
180
- // eslint-disable-next-line no-console
181
175
  console.error(ex);
182
176
  resetInlinePreview($link);
183
177
  removeLoadingImage($link);