@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
@@ -29,24 +29,23 @@ import { Tooltip } from '@instructure/ui-tooltip';
29
29
  import { CUSTOM, MIN_HEIGHT, MIN_WIDTH, MIN_PERCENTAGE, imageSizes, labelForImageSize } from '../instructure_image/ImageEmbedOptions';
30
30
  import formatMessage from '../../../format-message';
31
31
  import DimensionsInput from './DimensionsInput';
32
- const ImageOptionsForm = _ref => {
33
- let {
34
- imageSize,
35
- displayAs,
36
- isDecorativeImage,
37
- altText,
38
- isLinked,
39
- dimensionsState,
40
- handleAltTextChange,
41
- handleIsDecorativeChange,
42
- handleDisplayAsChange,
43
- handleImageSizeChange,
44
- messagesForSize,
45
- hideDimensions,
46
- id = 'image-options-form',
47
- isIconMaker = false,
48
- forBlockEditorUse = false
49
- } = _ref;
32
+ const ImageOptionsForm = ({
33
+ imageSize,
34
+ displayAs,
35
+ isDecorativeImage,
36
+ altText,
37
+ isLinked,
38
+ dimensionsState,
39
+ handleAltTextChange,
40
+ handleIsDecorativeChange,
41
+ handleDisplayAsChange,
42
+ handleImageSizeChange,
43
+ messagesForSize,
44
+ hideDimensions,
45
+ id = 'image-options-form',
46
+ isIconMaker = false,
47
+ forBlockEditorUse = false
48
+ }) => {
50
49
  const TYPE = isIconMaker ? formatMessage('icon') : formatMessage('image');
51
50
  const tooltipText = formatMessage('Used by screen readers to describe the content of an {TYPE}', {
52
51
  TYPE
@@ -26,15 +26,14 @@ import { showFlashAlert } from '../../../common/FlashAlert';
26
26
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
27
27
  import { getIcon, getFriendlyLinkType } from './linkUtils';
28
28
  const getEditMessage = () => formatMessage('If left empty, link text will display as course link name');
29
- export const LinkDisplay = _ref => {
30
- let {
31
- linkText,
32
- placeholderText,
33
- linkFileName,
34
- published,
35
- handleTextChange,
36
- linkType
37
- } = _ref;
29
+ export const LinkDisplay = ({
30
+ linkText,
31
+ placeholderText,
32
+ linkFileName,
33
+ published,
34
+ handleTextChange,
35
+ linkType
36
+ }) => {
38
37
  useEffect(() => {
39
38
  showFlashAlert({
40
39
  message: formatMessage('Selected {linkFileName}', {
@@ -23,15 +23,14 @@ import { Flex } from '@instructure/ui-flex';
23
23
  import formatMessage from '../../../format-message';
24
24
  import checkerboardStyle from './CheckerboardStyling';
25
25
  const SQUARE_SIZE = 4;
26
- const PreviewIcon = _ref => {
27
- let {
28
- color,
29
- testId,
30
- variant,
31
- image,
32
- loading,
33
- checkered
34
- } = _ref;
26
+ const PreviewIcon = ({
27
+ color,
28
+ testId,
29
+ variant,
30
+ image,
31
+ loading,
32
+ checkered
33
+ }) => {
35
34
  const variantSettings = PreviewIcon.variants[variant];
36
35
  const background = () => {
37
36
  if (loading) return {};
@@ -59,7 +59,6 @@ export default function RceFileBrowser(props) {
59
59
  });
60
60
  }, [host, jwt, refreshToken, source, canvasOrigin]);
61
61
  function handleFileSelect(fileInfo) {
62
- var _fileInfo$api$embed, _fileInfo$api;
63
62
  const content_type = fileInfo.api.type;
64
63
  const canPreview = isPreviewable(content_type);
65
64
  const url = downloadToWrap(fileInfo.src);
@@ -69,11 +68,11 @@ export default function RceFileBrowser(props) {
69
68
  title: fileInfo.name,
70
69
  href: url,
71
70
  embedded_iframe_url,
72
- media_id: ((_fileInfo$api$embed = fileInfo.api.embed) === null || _fileInfo$api$embed === void 0 ? void 0 : _fileInfo$api$embed.id) || fileInfo.api.mediaEntryId,
71
+ media_id: fileInfo.api.embed?.id || fileInfo.api.mediaEntryId,
73
72
  target: '_blank',
74
73
  content_type
75
74
  };
76
- if (((_fileInfo$api = fileInfo.api) === null || _fileInfo$api === void 0 ? void 0 : _fileInfo$api.category) === 'icon_maker_icons') {
75
+ if (fileInfo.api?.category === 'icon_maker_icons') {
77
76
  onFileSelectParams.src = fileInfo.api.url;
78
77
  addIconMakerAttributes(onFileSelectParams);
79
78
  } else {
@@ -22,11 +22,10 @@ import bridge from '../../../bridge';
22
22
  import sidebarHandlers from '../../../sidebar/containers/sidebarHandlers';
23
23
  import { propsFromState } from '../../../sidebar/containers/Sidebar';
24
24
  import configureStore from '../../../sidebar/store/configureStore';
25
- function Consumer(_ref) {
26
- let {
27
- children,
28
- ...props
29
- } = _ref;
25
+ function Consumer({
26
+ children,
27
+ ...props
28
+ }) {
30
29
  return children({
31
30
  onLinkClick: bridge.insertLink,
32
31
  onImageEmbed: bridge.embedImage,
@@ -37,11 +36,10 @@ function Consumer(_ref) {
37
36
  }
38
37
  export const StoreConsumer = connect(propsFromState, sidebarHandlers)(Consumer);
39
38
  const StoreContext = /*#__PURE__*/createContext();
40
- export function StoreProvider(_ref2) {
41
- let {
42
- children,
43
- ...storeProps
44
- } = _ref2;
39
+ export function StoreProvider({
40
+ children,
41
+ ...storeProps
42
+ }) {
45
43
  const [store] = useState(() => configureStore(storeProps));
46
44
  return /*#__PURE__*/React.createElement(ReduxProvider, {
47
45
  store: store
@@ -45,19 +45,18 @@ export function displayStyleFrom(studioAttributes) {
45
45
  return studioAttributes['data-studio-resizable'] || studioAttributes['data-studio-tray-enabled'] ? 'inline-block' : '';
46
46
  }
47
47
  export function isStudioEmbeddedMedia(element) {
48
- var _tinymceIframeShim$fi;
49
48
  // Borrowing this structure from isMediaElement in ContentSelection.js
50
- const tinymceIframeShim = (element === null || element === void 0 ? void 0 : element.tagName) === 'IFRAME' ? element === null || element === void 0 ? void 0 : element.parentElement : element;
51
- if ((tinymceIframeShim === null || tinymceIframeShim === void 0 ? void 0 : (_tinymceIframeShim$fi = tinymceIframeShim.firstElementChild) === null || _tinymceIframeShim$fi === void 0 ? void 0 : _tinymceIframeShim$fi.tagName) !== 'IFRAME') {
49
+ const tinymceIframeShim = element?.tagName === 'IFRAME' ? element?.parentElement : element;
50
+ if (tinymceIframeShim?.firstElementChild?.tagName !== 'IFRAME') {
52
51
  return false;
53
52
  }
54
53
  return tinymceIframeShim.getAttribute('data-mce-p-data-studio-tray-enabled') === 'true';
55
54
  }
56
55
  export function parseStudioOptions(element) {
57
- const tinymceIframeShim = (element === null || element === void 0 ? void 0 : element.tagName) === 'IFRAME' ? element === null || element === void 0 ? void 0 : element.parentElement : element;
56
+ const tinymceIframeShim = element?.tagName === 'IFRAME' ? element?.parentElement : element;
58
57
  return {
59
- resizable: (tinymceIframeShim === null || tinymceIframeShim === void 0 ? void 0 : tinymceIframeShim.getAttribute('data-mce-p-data-studio-resizable')) === 'true',
60
- convertibleToLink: (tinymceIframeShim === null || tinymceIframeShim === void 0 ? void 0 : tinymceIframeShim.getAttribute('data-mce-p-data-studio-convertible-to-link')) === 'true'
58
+ resizable: tinymceIframeShim?.getAttribute('data-mce-p-data-studio-resizable') === 'true',
59
+ convertibleToLink: tinymceIframeShim?.getAttribute('data-mce-p-data-studio-convertible-to-link') === 'true'
61
60
  };
62
61
  }
63
62
 
@@ -25,13 +25,12 @@ import PanelFilter from './PanelFilter';
25
25
  import { FILTER_SETTINGS_BY_PLUGIN, DynamicPanel } from '../canvasContentUtils';
26
26
  import { useStoreProps } from '../StoreContext';
27
27
  // TODO: Component is only validated for images, need to validate for other content types
28
- export default function CanvasContentPanel(_ref) {
29
- let {
30
- trayProps,
31
- canvasOrigin,
32
- plugin,
33
- setFileUrl
34
- } = _ref;
28
+ export default function CanvasContentPanel({
29
+ trayProps,
30
+ canvasOrigin,
31
+ plugin,
32
+ setFileUrl
33
+ }) {
35
34
  const [filterSettings, setFilterSettings] = useFilterSettings(FILTER_SETTINGS_BY_PLUGIN[plugin]);
36
35
  const [link, setLink] = useState(null);
37
36
  const [hasLoaded, setHasLoaded] = useState(false);
@@ -18,10 +18,9 @@
18
18
 
19
19
  import * as SvgProcessor from './SvgCategoryProcessor';
20
20
  export async function process(file) {
21
- var _file$type;
22
21
  // Determine which processor to use based on file type.
23
22
  // If no matching processor is found for the given file type, return undefined
24
- if (file !== null && file !== void 0 && (_file$type = file.type) !== null && _file$type !== void 0 && _file$type.includes(SvgProcessor.typeTest)) {
23
+ if (file?.type?.includes(SvgProcessor.typeTest)) {
25
24
  return await SvgProcessor.process(file);
26
25
  }
27
26
  }
@@ -83,15 +83,14 @@ function readFile(theFile) {
83
83
  });
84
84
  return p;
85
85
  }
86
- export default function ComputerPanel(_ref) {
87
- let {
88
- theFile,
89
- setFile,
90
- setError,
91
- accept,
92
- label,
93
- bounds
94
- } = _ref;
86
+ export default function ComputerPanel({
87
+ theFile,
88
+ setFile,
89
+ setError,
90
+ accept,
91
+ label,
92
+ bounds
93
+ }) {
95
94
  const [messages, setMessages] = useState([]);
96
95
  const [preview, setPreview] = useState({
97
96
  preview: null,
@@ -105,9 +104,8 @@ export default function ComputerPanel(_ref) {
105
104
  const width = 0.8 * bounds.width;
106
105
  useEffect(() => {
107
106
  return () => {
108
- if (Array.isArray(preview === null || preview === void 0 ? void 0 : preview.preview)) {
109
- var _URL, _URL$revokeObjectURL;
110
- (_URL = URL) === null || _URL === void 0 ? void 0 : (_URL$revokeObjectURL = _URL.revokeObjectURL) === null || _URL$revokeObjectURL === void 0 ? void 0 : _URL$revokeObjectURL.call(_URL, preview.preview[0].src);
107
+ if (Array.isArray(preview?.preview)) {
108
+ URL?.revokeObjectURL?.(preview.preview[0].src);
111
109
  }
112
110
  };
113
111
  }, [preview]);
@@ -259,8 +257,7 @@ export default function ComputerPanel(_ref) {
259
257
  }, /*#__PURE__*/React.createElement(FileDrop, {
260
258
  "data-testid": "filedrop",
261
259
  accept: accept,
262
- onDropAccepted: _ref2 => {
263
- let [file] = _ref2;
260
+ onDropAccepted: ([file]) => {
264
261
  if (messages.length) {
265
262
  setMessages([]);
266
263
  }
@@ -28,14 +28,13 @@ import React, { useEffect, useState } from 'react';
28
28
  function shouldSearch(searchString) {
29
29
  return searchString.length === 0 || searchString.length >= 3;
30
30
  }
31
- export default function PanelFilter(_ref) {
32
- let {
33
- mountNode,
34
- onChange,
35
- sortValue,
36
- searchString,
37
- contentType
38
- } = _ref;
31
+ export default function PanelFilter({
32
+ mountNode,
33
+ onChange,
34
+ sortValue,
35
+ searchString,
36
+ contentType
37
+ }) {
39
38
  const [pendingSearchString, setPendingSearchString] = useState(searchString);
40
39
  const [searchInputTimer, setSearchInputTimer] = useState(0);
41
40
 
@@ -33,24 +33,22 @@ export const FullPanelIds = [...UploadCanvasPanelIds, ...UploadFilePanelIds];
33
33
  /**
34
34
  * Handles uploading data based on what type of data is submitted.
35
35
  */
36
- export const handleSubmit = function (editor, accept, selectedPanel,
36
+ export const handleSubmit = (editor, accept, selectedPanel,
37
37
  // @ts-expect-error
38
38
  uploadData,
39
39
  // @ts-expect-error
40
40
  storeProps,
41
41
  // @ts-expect-error
42
- _source) {
43
- let afterInsert = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : () => undefined;
42
+ _source, afterInsert = () => undefined) => {
44
43
  Bridge.focusEditor(RCEWrapper.getByEditor(editor)); // necessary since it blurred when the modal opened
45
44
  const {
46
45
  altText,
47
46
  isDecorativeImage,
48
47
  displayAs
49
- } = (uploadData === null || uploadData === void 0 ? void 0 : uploadData.imageOptions) || {};
48
+ } = uploadData?.imageOptions || {};
50
49
  switch (selectedPanel) {
51
50
  case 'COMPUTER':
52
51
  {
53
- var _uploadData$usageRigh;
54
52
  const {
55
53
  theFile
56
54
  } = uploadData;
@@ -63,7 +61,7 @@ _source) {
63
61
  altText,
64
62
  isDecorativeImage,
65
63
  displayAs,
66
- usageRights: (uploadData === null || uploadData === void 0 ? void 0 : (_uploadData$usageRigh = uploadData.usageRights) === null || _uploadData$usageRigh === void 0 ? void 0 : _uploadData$usageRigh.usageRight) === 'choose' ? undefined : uploadData === null || uploadData === void 0 ? void 0 : uploadData.usageRights
64
+ usageRights: uploadData?.usageRights?.usageRight === 'choose' ? undefined : uploadData?.usageRights
67
65
  };
68
66
  let tabContext = 'documents';
69
67
  if (isImage(theFile.type)) {
@@ -104,21 +102,20 @@ _source) {
104
102
  element.addEventListener('load', () => indicate(indicatorRegion(editor, element)));
105
103
  afterInsert();
106
104
  };
107
- export function UploadFile(_ref) {
108
- let {
109
- accept,
110
- editor,
111
- label,
112
- panels,
113
- onDismiss,
114
- requireA11yAttributes = true,
115
- forBlockEditorUse = false,
116
- uploading = false,
117
- trayProps,
118
- canvasOrigin,
119
- onSubmit = handleSubmit,
120
- preselectedFile = undefined
121
- } = _ref;
105
+ export function UploadFile({
106
+ accept,
107
+ editor,
108
+ label,
109
+ panels,
110
+ onDismiss,
111
+ requireA11yAttributes = true,
112
+ forBlockEditorUse = false,
113
+ uploading = false,
114
+ trayProps,
115
+ canvasOrigin,
116
+ onSubmit = handleSubmit,
117
+ preselectedFile = undefined
118
+ }) {
122
119
  const [modalBodyWidth, setModalBodyWidth] = useState(undefined);
123
120
  const [modalBodyHeight, setModalBodyHeight] = useState(undefined);
124
121
  const [theFile] = useState(preselectedFile);
@@ -135,7 +132,7 @@ export function UploadFile(_ref) {
135
132
  if (bodyRef.current) {
136
133
  // eslint-disable-next-line react/no-find-dom-node
137
134
  const thebody = ReactDOM.findDOMNode(bodyRef.current);
138
- const sz = thebody === null || thebody === void 0 ? void 0 : thebody.getBoundingClientRect();
135
+ const sz = thebody?.getBoundingClientRect();
139
136
  sz.height -= px('3rem'); // leave room for the tabs
140
137
  setModalBodyWidth(sz.width);
141
138
  setModalBodyHeight(sz.height);
@@ -25,7 +25,7 @@ import { Spinner } from '@instructure/ui-spinner';
25
25
  import { Tabs } from '@instructure/ui-tabs';
26
26
  import { ToggleDetails } from '@instructure/ui-toggle-details';
27
27
  import formatMessage from '../../../../format-message';
28
- import { instuiPopupMountNode } from '../../../../util/fullscreenHelpers';
28
+ import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
29
29
  import RceApiSource from '../../../../rcs/api';
30
30
  import ImageOptionsForm from '../ImageOptionsForm';
31
31
  import UsageRightsSelectBox from './UsageRightsSelectBox';
@@ -34,12 +34,11 @@ import { UploadCanvasPanelIds, CanvasPanelTitles } from '../canvasContentUtils';
34
34
  const CanvasContentPanel = /*#__PURE__*/React.lazy(() => import('./CanvasContentPanel'));
35
35
  const ComputerPanel = /*#__PURE__*/React.lazy(() => import('./ComputerPanel'));
36
36
  const UrlPanel = /*#__PURE__*/React.lazy(() => import('./UrlPanel'));
37
- function shouldBeDisabled(_ref, selectedPanel, usageRightNotSet) {
38
- let {
39
- fileUrl,
40
- theFile,
41
- error
42
- } = _ref;
37
+ function shouldBeDisabled({
38
+ fileUrl,
39
+ theFile,
40
+ error
41
+ }, selectedPanel, usageRightNotSet) {
43
42
  if (error || usageRightNotSet && selectedPanel === 'COMPUTER') {
44
43
  return true;
45
44
  }
@@ -54,25 +53,23 @@ function shouldBeDisabled(_ref, selectedPanel, usageRightNotSet) {
54
53
  // When in doubt, don't disable (but we shouldn't get here either)
55
54
  }
56
55
  }
57
- const UploadFileModal = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
58
- var _contentProps$session;
59
- let {
60
- preselectedFile,
61
- editor,
62
- contentProps,
63
- trayProps,
64
- canvasOrigin,
65
- onSubmit,
66
- onDismiss,
67
- panels,
68
- label,
69
- accept,
70
- modalBodyWidth,
71
- modalBodyHeight,
72
- requireA11yAttributes = true,
73
- forBlockEditorUse = false,
74
- uploading = false
75
- } = _ref2;
56
+ const UploadFileModal = /*#__PURE__*/React.forwardRef(({
57
+ preselectedFile,
58
+ editor,
59
+ contentProps,
60
+ trayProps,
61
+ canvasOrigin,
62
+ onSubmit,
63
+ onDismiss,
64
+ panels,
65
+ label,
66
+ accept,
67
+ modalBodyWidth,
68
+ modalBodyHeight,
69
+ requireA11yAttributes = true,
70
+ forBlockEditorUse = false,
71
+ uploading = false
72
+ }, ref) => {
76
73
  const [theFile, setFile] = useState(preselectedFile);
77
74
  const [error, setError] = useState(null);
78
75
  const [fileUrl, setFileUrl] = useState('');
@@ -89,7 +86,7 @@ const UploadFileModal = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
89
86
  const [displayAs, setDisplayAs] = useState('embed');
90
87
  // even though usage rights might be required by the course, canvas has no place
91
88
  // on the user to store it. Only Group and Course.
92
- const requiresUsageRights = (contentProps === null || contentProps === void 0 ? void 0 : (_contentProps$session = contentProps.session) === null || _contentProps$session === void 0 ? void 0 : _contentProps$session.usageRightsRequired) && /(?:course|group)/.test(trayProps.contextType);
89
+ const requiresUsageRights = contentProps?.session?.usageRightsRequired && /(?:course|group)/.test(trayProps.contextType);
93
90
  function handleAltTextChange(event) {
94
91
  setAltText(event.target.value);
95
92
  }
@@ -127,7 +124,7 @@ const UploadFileModal = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
127
124
  "data-mce-component": true,
128
125
  as: "form",
129
126
  label: label,
130
- mountNode: instuiPopupMountNode,
127
+ mountNode: instuiPopupMountNodeFn,
131
128
  size: "large",
132
129
  overflow: "fit",
133
130
  onDismiss: onDismiss,
@@ -158,12 +155,9 @@ const UploadFileModal = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
158
155
  }), /*#__PURE__*/React.createElement(Heading, null, label)), /*#__PURE__*/React.createElement(Modal.Body, {
159
156
  ref: ref
160
157
  }, /*#__PURE__*/React.createElement(Tabs, {
161
- onRequestTabChange: (event, _ref3) => {
162
- let {
163
- index
164
- } = _ref3;
165
- return handleRequestTabChange(index);
166
- }
158
+ onRequestTabChange: (event, {
159
+ index
160
+ }) => handleRequestTabChange(index)
167
161
  }, panels.map(panel => {
168
162
  switch (panel) {
169
163
  case 'COMPUTER':
@@ -20,11 +20,10 @@ import React from 'react';
20
20
  import { string, func } from 'prop-types';
21
21
  import { TextInput } from '@instructure/ui-text-input';
22
22
  import formatMessage from '../../../../format-message';
23
- export default function UrlPanel(_ref) {
24
- let {
25
- fileUrl,
26
- setFileUrl
27
- } = _ref;
23
+ export default function UrlPanel({
24
+ fileUrl,
25
+ setFileUrl
26
+ }) {
28
27
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextInput, {
29
28
  name: "file-url",
30
29
  renderLabel: formatMessage('File URL'),
@@ -22,12 +22,11 @@ import formatMessage from '../../../../format-message';
22
22
  import { SimpleSelect } from '@instructure/ui-simple-select';
23
23
  import { View } from '@instructure/ui-view';
24
24
  import { TextInput } from '@instructure/ui-text-input';
25
- const ShowCreativeCommonsOptions = _ref => {
26
- let {
27
- ccLicense,
28
- setCCLicense,
29
- licenseOptions
30
- } = _ref;
25
+ const ShowCreativeCommonsOptions = ({
26
+ ccLicense,
27
+ setCCLicense,
28
+ licenseOptions
29
+ }) => {
31
30
  const onlyCC = licenseOptions.filter(license => license.id.indexOf('cc') === 0);
32
31
  return /*#__PURE__*/React.createElement(View, {
33
32
  as: "div",
@@ -36,12 +35,9 @@ const ShowCreativeCommonsOptions = _ref => {
36
35
  renderLabel: formatMessage('Creative Commons License:'),
37
36
  assistiveText: formatMessage('Use arrow keys to navigate options.'),
38
37
  value: ccLicense,
39
- onChange: (e, _ref2) => {
40
- let {
41
- id
42
- } = _ref2;
43
- return setCCLicense(id);
44
- }
38
+ onChange: (e, {
39
+ id
40
+ }) => setCCLicense(id)
45
41
  }, onlyCC.map(license => /*#__PURE__*/React.createElement(SimpleSelect.Option, {
46
42
  key: license.id,
47
43
  id: license.id,
@@ -59,14 +55,13 @@ const ShowMessage = () => {
59
55
  }
60
56
  }, formatMessage("If you do not select usage rights now, this file will be unpublished after it's uploaded."))));
61
57
  };
62
- const UsageRightsSelectBox = _ref3 => {
63
- let {
64
- contextType,
65
- contextId,
66
- showMessage: showMessageProp,
67
- usageRightsState,
68
- setUsageRightsState
69
- } = _ref3;
58
+ const UsageRightsSelectBox = ({
59
+ contextType,
60
+ contextId,
61
+ showMessage: showMessageProp,
62
+ usageRightsState,
63
+ setUsageRightsState
64
+ }) => {
70
65
  const {
71
66
  usageRight,
72
67
  ccLicense,
@@ -119,10 +114,9 @@ const UsageRightsSelectBox = _ref3 => {
119
114
  }, /*#__PURE__*/React.createElement(SimpleSelect, {
120
115
  renderLabel: formatMessage('Usage Right:'),
121
116
  assistiveText: formatMessage('Use arrow keys to navigate options.'),
122
- onChange: (e, _ref4) => {
123
- let {
124
- id
125
- } = _ref4;
117
+ onChange: (e, {
118
+ id
119
+ }) => {
126
120
  handleChange(id);
127
121
  },
128
122
  value: usageRight
@@ -29,13 +29,12 @@ export default function doFileUpload(ed, document, opts) {
29
29
  } = {
30
30
  ...opts
31
31
  };
32
- const title = accept !== null && accept !== void 0 && accept.startsWith('image/') ? formatMessage('Upload Image') : formatMessage('Upload File');
32
+ const title = accept?.startsWith('image/') ? formatMessage('Upload Image') : formatMessage('Upload File');
33
33
  let shownResolve;
34
34
  const shownPromise = new Promise(resolve => shownResolve = resolve);
35
- const closedPromise = import('./UploadFile').then(_ref => {
36
- let {
37
- UploadFile
38
- } = _ref;
35
+ const closedPromise = import('./UploadFile').then(({
36
+ UploadFile
37
+ }) => {
39
38
  const container = document.querySelector('.canvas-rce-upload-container') || (() => {
40
39
  const elem = document.createElement('div');
41
40
  elem.className = 'canvas-rce-upload-container';
@@ -48,9 +47,9 @@ export default function doFileUpload(ed, document, opts) {
48
47
  ed.focus(false);
49
48
  resolve('dismissed');
50
49
  };
51
- const wrappedSubmit = function () {
50
+ const wrappedSubmit = (...args) => {
52
51
  try {
53
- return handleSubmit(...arguments);
52
+ return handleSubmit(...args);
54
53
  } finally {
55
54
  resolve('submitted');
56
55
  }
@@ -22,14 +22,13 @@ import formatMessage from '../../../../format-message';
22
22
  import { Button, CloseButton } from '@instructure/ui-buttons';
23
23
  import { Heading } from '@instructure/ui-heading';
24
24
  import { Modal } from '@instructure/ui-modal';
25
- const AIResponseModal = _ref => {
26
- let {
27
- open,
28
- html,
29
- onClose,
30
- onInsert,
31
- onReplace
32
- } = _ref;
25
+ const AIResponseModal = ({
26
+ open,
27
+ html,
28
+ onClose,
29
+ onInsert,
30
+ onReplace
31
+ }) => {
33
32
  return /*#__PURE__*/React.createElement(Modal, {
34
33
  open: open,
35
34
  onDismiss: onClose,