@instructure/canvas-rce 5.14.2 → 5.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) 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.d.ts +59 -0
  19. package/es/index.js +3 -5
  20. package/es/rce/AlertMessageArea.js +15 -16
  21. package/es/rce/KeyboardShortcutModal.js +2 -2
  22. package/es/rce/RCE.js +6 -8
  23. package/es/rce/RCEVariants.js +2 -4
  24. package/es/rce/RCEWrapper.js +397 -289
  25. package/es/rce/RCEWrapper.utils.js +131 -0
  26. package/es/rce/RCEWrapperProps.js +2 -3
  27. package/es/rce/RceHtmlEditor.js +12 -11
  28. package/es/rce/ResizeHandle.js +1 -2
  29. package/es/rce/ShowOnFocusButton/index.js +2 -2
  30. package/es/rce/StatusBar.js +5 -10
  31. package/es/rce/contentInsertion.js +1 -2
  32. package/es/rce/contentRendering.js +6 -5
  33. package/es/rce/editorLanguage.js +1 -1
  34. package/es/rce/indicatorRegion.js +1 -2
  35. package/es/rce/normalizeProps.js +4 -4
  36. package/es/rce/plugins/instructure_color/clickCallback.js +2 -4
  37. package/es/rce/plugins/instructure_color/components/ColorPicker.js +17 -22
  38. package/es/rce/plugins/instructure_color/components/ColorPopup.js +7 -8
  39. package/es/rce/plugins/instructure_condensed_buttons/ui/list-button.js +4 -10
  40. package/es/rce/plugins/instructure_condensed_buttons/ui/subscript-superscript-button.js +1 -1
  41. package/es/rce/plugins/instructure_documents/components/Link.js +1 -2
  42. package/es/rce/plugins/instructure_equation/EquationEditorModal/index.js +5 -8
  43. package/es/rce/plugins/instructure_equation/EquationEditorModal/latexTextareaUtil.js +3 -3
  44. package/es/rce/plugins/instructure_equation/EquationEditorModal/parseLatex.js +3 -3
  45. package/es/rce/plugins/instructure_equation/EquationEditorToolbar/buttons.js +2 -2
  46. package/es/rce/plugins/instructure_equation/EquationEditorToolbar/index.js +9 -11
  47. package/es/rce/plugins/instructure_equation/MathIcon/index.js +3 -4
  48. package/es/rce/plugins/instructure_equation/mathlive/index.js +167 -16
  49. package/es/rce/plugins/instructure_fullscreen/plugin.js +0 -2
  50. package/es/rce/plugins/instructure_icon_maker/clickCallback.js +3 -4
  51. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ColorSection.js +46 -49
  52. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/CreateIconMakerForm.js +9 -10
  53. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Footer.js +10 -11
  54. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Group.js +5 -6
  55. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Header.js +7 -8
  56. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Course.js +7 -9
  57. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ImageOptions.js +19 -26
  58. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ImageSection.js +8 -12
  59. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/ModeSelect.js +6 -7
  60. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/MultiColor/index.js +5 -6
  61. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SVGList.js +6 -7
  62. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SVGThumbnail.js +8 -10
  63. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SingleColor/index.js +5 -6
  64. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/SingleColor/svg.js +32 -80
  65. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/Upload.js +7 -8
  66. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ImageSection/utils.js +4 -5
  67. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/Preview.js +3 -4
  68. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/ShapeSection.js +4 -5
  69. package/es/rce/plugins/instructure_icon_maker/components/CreateIconMakerForm/TextSection.js +4 -5
  70. package/es/rce/plugins/instructure_icon_maker/components/IconMakerTray.js +22 -29
  71. package/es/rce/plugins/instructure_icon_maker/registerEditToolbar.js +1 -1
  72. package/es/rce/plugins/instructure_icon_maker/svg/image.js +5 -7
  73. package/es/rce/plugins/instructure_icon_maker/svg/index.js +6 -9
  74. package/es/rce/plugins/instructure_icon_maker/svg/settings.js +17 -20
  75. package/es/rce/plugins/instructure_icon_maker/svg/shape.js +4 -5
  76. package/es/rce/plugins/instructure_icon_maker/svg/text.js +28 -32
  77. package/es/rce/plugins/instructure_icon_maker/svg/utils.js +2 -4
  78. package/es/rce/plugins/instructure_icon_maker/utils/IconMakerClose.js +2 -3
  79. package/es/rce/plugins/instructure_icon_maker/utils/iconValidation.js +1 -2
  80. package/es/rce/plugins/instructure_image/ImageEmbedOptions.js +3 -7
  81. package/es/rce/plugins/instructure_image/ImageList/Image.js +7 -8
  82. package/es/rce/plugins/instructure_image/ImageList/index.js +7 -8
  83. package/es/rce/plugins/instructure_image/ImageOptionsTray/TrayController.js +2 -4
  84. package/es/rce/plugins/instructure_image/ImageOptionsTray/index.js +3 -3
  85. package/es/rce/plugins/instructure_image/plugin.js +1 -2
  86. package/es/rce/plugins/instructure_links/components/AccordionSection.js +7 -8
  87. package/es/rce/plugins/instructure_links/components/Link.js +61 -65
  88. package/es/rce/plugins/instructure_links/components/LinkOptionsDialog/LinkOptionsDialogController.js +1 -2
  89. package/es/rce/plugins/instructure_links/components/LinkOptionsDialog/index.js +2 -2
  90. package/es/rce/plugins/instructure_links/components/LinkOptionsTray/index.js +2 -2
  91. package/es/rce/plugins/instructure_links/components/LinkSet.js +28 -37
  92. package/es/rce/plugins/instructure_links/components/LinksPanel.js +21 -8
  93. package/es/rce/plugins/instructure_links/components/NoResults.js +6 -7
  94. package/es/rce/plugins/instructure_links/plugin.js +6 -9
  95. package/es/rce/plugins/instructure_media_embed/clickCallback.js +3 -4
  96. package/es/rce/plugins/instructure_media_embed/components/Embed.js +6 -7
  97. package/es/rce/plugins/instructure_paste/plugin.js +5 -7
  98. package/es/rce/plugins/instructure_rce_external_tools/ExternalToolsEnv.js +24 -33
  99. package/es/rce/plugins/instructure_rce_external_tools/RceToolWrapper.js +7 -38
  100. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialog.js +30 -29
  101. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolSelectionDialog/ExternalToolSelectionDialog.js +3 -4
  102. package/es/rce/plugins/instructure_rce_external_tools/dialog-helper.js +1 -2
  103. package/es/rce/plugins/instructure_rce_external_tools/jquery/jquery.dropdownList.js +3 -4
  104. package/es/rce/plugins/instructure_rce_external_tools/lti11-content-items/RceLti11ContentItem.js +17 -24
  105. package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/RceLti13ContentItem.js +2 -2
  106. package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/models/BaseLinkContentItem.js +4 -5
  107. package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/processEditorContentItems.js +8 -9
  108. package/es/rce/plugins/instructure_rce_external_tools/lti13-content-items/rceLti13ContentItemFromJson.js +0 -1
  109. package/es/rce/plugins/instructure_rce_external_tools/plugin.js +4 -4
  110. package/es/rce/plugins/instructure_rce_external_tools/util/externalToolsForToolbar.js +42 -0
  111. package/es/rce/plugins/instructure_record/AudioOptionsTray/TrayController.js +5 -10
  112. package/es/rce/plugins/instructure_record/AudioOptionsTray/index.js +12 -13
  113. package/es/rce/plugins/instructure_record/VideoOptionsTray/TrayController.js +8 -15
  114. package/es/rce/plugins/instructure_record/VideoOptionsTray/index.js +19 -20
  115. package/es/rce/plugins/instructure_record/clickCallback.js +26 -30
  116. package/es/rce/plugins/instructure_search_and_replace/clickCallback.js +2 -3
  117. package/es/rce/plugins/instructure_search_and_replace/components/FindReplaceTray.js +14 -16
  118. package/es/rce/plugins/instructure_search_and_replace/components/FindReplaceTrayController.js +9 -12
  119. package/es/rce/plugins/instructure_search_and_replace/plugin.js +1 -2
  120. package/es/rce/plugins/instructure_wordcount/clickCallback.js +3 -4
  121. package/es/rce/plugins/instructure_wordcount/components/WordCountModal.js +26 -33
  122. package/es/rce/plugins/instructure_wordcount/utils/countContent.js +3 -3
  123. package/es/rce/plugins/instructure_wordcount/utils/tableContent.js +5 -8
  124. package/es/rce/plugins/shared/CanvasContentTray.js +9 -16
  125. package/es/rce/plugins/shared/ColorInput.js +22 -25
  126. package/es/rce/plugins/shared/ConditionalTooltip.js +5 -6
  127. package/es/rce/plugins/shared/ContentSelection.js +12 -20
  128. package/es/rce/plugins/shared/DimensionUtils.js +2 -4
  129. package/es/rce/plugins/shared/EventUtils.js +1 -1
  130. package/es/rce/plugins/shared/FixedContentTray.js +13 -14
  131. package/es/rce/plugins/shared/ImageCropper/DirectionRegion.js +3 -4
  132. package/es/rce/plugins/shared/ImageCropper/Modal.js +12 -13
  133. package/es/rce/plugins/shared/ImageCropper/Preview.js +11 -13
  134. package/es/rce/plugins/shared/ImageCropper/controls/CustomNumberInput.js +8 -9
  135. package/es/rce/plugins/shared/ImageCropper/controls/ResetControls.js +3 -4
  136. package/es/rce/plugins/shared/ImageCropper/controls/RotationControls.js +4 -5
  137. package/es/rce/plugins/shared/ImageCropper/controls/ShapeControls.js +7 -11
  138. package/es/rce/plugins/shared/ImageCropper/controls/ZoomControls.js +4 -5
  139. package/es/rce/plugins/shared/ImageCropper/controls/index.js +4 -5
  140. package/es/rce/plugins/shared/ImageCropper/controls/useDebouncedNumericValue.js +13 -15
  141. package/es/rce/plugins/shared/ImageCropper/imageCropUtils.js +18 -21
  142. package/es/rce/plugins/shared/ImageCropper/svg/shape.js +4 -5
  143. package/es/rce/plugins/shared/ImageCropper/svg/utils.js +2 -4
  144. package/es/rce/plugins/shared/ImageCropper/useKeyMouseEvents.js +1 -4
  145. package/es/rce/plugins/shared/ImageOptionsForm.js +17 -18
  146. package/es/rce/plugins/shared/LinkDisplay.js +8 -9
  147. package/es/rce/plugins/shared/PreviewIcon.js +8 -9
  148. package/es/rce/plugins/shared/RceFileBrowser.js +2 -3
  149. package/es/rce/plugins/shared/StoreContext.js +8 -10
  150. package/es/rce/plugins/shared/StudioLtiSupportUtils.js +5 -6
  151. package/es/rce/plugins/shared/Upload/CanvasContentPanel.js +6 -7
  152. package/es/rce/plugins/shared/Upload/CategoryProcessor.js +1 -2
  153. package/es/rce/plugins/shared/Upload/ComputerPanel.js +11 -14
  154. package/es/rce/plugins/shared/Upload/PanelFilter.js +7 -8
  155. package/es/rce/plugins/shared/Upload/UploadFile.js +19 -22
  156. package/es/rce/plugins/shared/Upload/UploadFileModal.js +28 -34
  157. package/es/rce/plugins/shared/Upload/UrlPanel.js +4 -5
  158. package/es/rce/plugins/shared/Upload/UsageRightsSelectBox.js +18 -24
  159. package/es/rce/plugins/shared/Upload/doFileUpload.js +6 -7
  160. package/es/rce/plugins/shared/ai_tools/AIResponseModal.js +7 -8
  161. package/es/rce/plugins/shared/ai_tools/AIToolsTray.js +14 -17
  162. package/es/rce/plugins/shared/ai_tools/aiicons.js +2 -2
  163. package/es/rce/plugins/shared/canvasContentUtils.js +1 -2
  164. package/es/rce/plugins/shared/compressionUtils.js +17 -20
  165. package/es/rce/plugins/shared/do-fetch-api-effect/doFetchApi.js +12 -15
  166. package/es/rce/plugins/shared/do-fetch-api-effect/get-cookie.js +1 -1
  167. package/es/rce/plugins/shared/fileTypeUtils.js +3 -6
  168. package/es/rce/plugins/shared/round.js +1 -2
  169. package/es/rce/plugins/shared/trayUtils.js +3 -0
  170. package/es/rce/plugins/shared/useDataUrl.js +4 -5
  171. package/es/rce/plugins/tinymce-a11y-checker/components/ColorField.js +2 -2
  172. package/es/rce/plugins/tinymce-a11y-checker/components/checker.js +8 -10
  173. package/es/rce/plugins/tinymce-a11y-checker/node-checker.js +1 -3
  174. package/es/rce/plugins/tinymce-a11y-checker/plugin.js +14 -17
  175. package/es/rce/plugins/tinymce-a11y-checker/rules/headings-start-at-h2.js +1 -2
  176. package/es/rce/plugins/tinymce-a11y-checker/rules/large-text-contrast.js +1 -2
  177. package/es/rce/plugins/tinymce-a11y-checker/rules/small-text-contrast.js +1 -2
  178. package/es/rce/plugins/tinymce-a11y-checker/utils/dom.js +2 -4
  179. package/es/rce/plugins/tinymce-a11y-checker/utils/indicate.js +2 -3
  180. package/es/rce/plugins/tinymce-a11y-checker/utils/rgb-hex.js +1 -4
  181. package/es/rce/root.js +9 -9
  182. package/es/rce/tinyRCE.js +1 -0
  183. package/es/rce/transformContent.js +1 -1
  184. package/es/rcs/api.js +39 -55
  185. package/es/rcs/buildError.js +3 -3
  186. package/es/rcs/fake.js +5 -7
  187. package/es/sidebar/actions/documents.js +10 -12
  188. package/es/sidebar/actions/files.js +18 -22
  189. package/es/sidebar/actions/filter.js +4 -5
  190. package/es/sidebar/actions/images.js +20 -26
  191. package/es/sidebar/actions/media.js +15 -18
  192. package/es/sidebar/actions/session.js +1 -2
  193. package/es/sidebar/actions/upload.js +26 -37
  194. package/es/sidebar/containers/sidebarHandlers.js +6 -12
  195. package/es/sidebar/dragHtml.js +6 -2
  196. package/es/sidebar/reducers/all_files.js +1 -3
  197. package/es/sidebar/reducers/collection.js +1 -3
  198. package/es/sidebar/reducers/collections.js +1 -3
  199. package/es/sidebar/reducers/documents.js +1 -3
  200. package/es/sidebar/reducers/files.js +1 -3
  201. package/es/sidebar/reducers/filter.js +7 -15
  202. package/es/sidebar/reducers/flickr.js +1 -3
  203. package/es/sidebar/reducers/folder.js +1 -3
  204. package/es/sidebar/reducers/folders.js +1 -3
  205. package/es/sidebar/reducers/images.js +1 -3
  206. package/es/sidebar/reducers/media.js +1 -3
  207. package/es/sidebar/reducers/newPageLinkExpanded.js +1 -3
  208. package/es/sidebar/reducers/noop.js +1 -2
  209. package/es/sidebar/reducers/rootFolderId.js +1 -3
  210. package/es/sidebar/reducers/session.js +1 -3
  211. package/es/sidebar/reducers/ui.js +3 -9
  212. package/es/sidebar/reducers/upload.js +8 -24
  213. package/es/sidebar/store/initialState.js +1 -2
  214. package/es/translations/locales/ar.js +6 -0
  215. package/es/translations/locales/ca.js +6 -0
  216. package/es/translations/locales/cy.js +6 -0
  217. package/es/translations/locales/da-x-k12.js +6 -0
  218. package/es/translations/locales/da.js +6 -0
  219. package/es/translations/locales/de.js +6 -0
  220. package/es/translations/locales/en-AU-x-unimelb.js +6 -0
  221. package/es/translations/locales/en-GB-x-ukhe.js +6 -0
  222. package/es/translations/locales/en_AU.js +6 -0
  223. package/es/translations/locales/en_CA.js +6 -0
  224. package/es/translations/locales/en_CY.js +6 -0
  225. package/es/translations/locales/en_GB.js +6 -0
  226. package/es/translations/locales/es.js +6 -0
  227. package/es/translations/locales/es_ES.js +6 -0
  228. package/es/translations/locales/fi.js +6 -0
  229. package/es/translations/locales/fr.js +6 -0
  230. package/es/translations/locales/fr_CA.js +6 -0
  231. package/es/translations/locales/hi.js +6 -0
  232. package/es/translations/locales/ht.js +6 -0
  233. package/es/translations/locales/id.js +6 -0
  234. package/es/translations/locales/is.js +6 -0
  235. package/es/translations/locales/it.js +6 -0
  236. package/es/translations/locales/ja.js +6 -0
  237. package/es/translations/locales/mi.js +6 -0
  238. package/es/translations/locales/ms.js +6 -0
  239. package/es/translations/locales/nb-x-k12.js +6 -0
  240. package/es/translations/locales/nb.js +6 -0
  241. package/es/translations/locales/nl.js +6 -0
  242. package/es/translations/locales/pl.js +6 -0
  243. package/es/translations/locales/pt.js +6 -0
  244. package/es/translations/locales/pt_BR.js +6 -0
  245. package/es/translations/locales/ru.js +6 -0
  246. package/es/translations/locales/sl.js +6 -0
  247. package/es/translations/locales/sv-x-k12.js +6 -0
  248. package/es/translations/locales/sv.js +6 -0
  249. package/es/translations/locales/th.js +6 -0
  250. package/es/translations/locales/vi.js +6 -0
  251. package/es/translations/locales/zh-Hans.js +6 -0
  252. package/es/translations/locales/zh-Hant.js +6 -0
  253. package/es/translations/locales/zh.js +6 -0
  254. package/es/translations/locales/zh_HK.js +6 -0
  255. package/es/util/elem-util.js +1 -1
  256. package/es/util/file-url-util.js +1 -1
  257. package/es/util/fullscreenHelpers.js +6 -9
  258. package/es/util/loadingPlaceholder.js +2 -3
  259. package/es/util/simpleCache.js +1 -2
  260. package/es/util/url-util.js +5 -5
  261. package/eslint.config.js +15 -4
  262. package/locales/en.json +190 -10
  263. package/package.json +56 -55
  264. package/scripts/installTranslations.js +7 -8
  265. package/tsconfig.json +1 -1
  266. package/types/format-message-generate-id.d.ts +22 -0
  267. package/types/js-beautify.d.ts +21 -0
@@ -28,9 +28,9 @@ import { performTextEditActionOnTextarea } from '../../../../util/textarea-editi
28
28
  */
29
29
  export function insertTextIntoLatexTextarea(textarea, insertionText) {
30
30
  var _textarea$value, _textarea$selectionSt, _textarea$selectionEn;
31
- const currentText = (_textarea$value = textarea === null || textarea === void 0 ? void 0 : textarea.value) !== null && _textarea$value !== void 0 ? _textarea$value : '';
32
- const selStart = (_textarea$selectionSt = textarea === null || textarea === void 0 ? void 0 : textarea.selectionStart) !== null && _textarea$selectionSt !== void 0 ? _textarea$selectionSt : currentText.length;
33
- const selEnd = (_textarea$selectionEn = textarea === null || textarea === void 0 ? void 0 : textarea.selectionEnd) !== null && _textarea$selectionEn !== void 0 ? _textarea$selectionEn : selStart;
31
+ const currentText = (_textarea$value = textarea?.value) !== null && _textarea$value !== void 0 ? _textarea$value : '';
32
+ const selStart = (_textarea$selectionSt = textarea?.selectionStart) !== null && _textarea$selectionSt !== void 0 ? _textarea$selectionSt : currentText.length;
33
+ const selEnd = (_textarea$selectionEn = textarea?.selectionEnd) !== null && _textarea$selectionEn !== void 0 ? _textarea$selectionEn : selStart;
34
34
  textarea.focus();
35
35
  planInsertTextIntoLatexTextarea({
36
36
  insertionText,
@@ -48,8 +48,8 @@ export const parseLatex = editor => {
48
48
  const selection = editor.selection.getContent();
49
49
  const selectionNode = editor.selection.getNode();
50
50
  const editorRange = editor.selection.getRng();
51
- const startContainer = editorRange === null || editorRange === void 0 ? void 0 : editorRange.startContainer;
52
- const wholeText = startContainer === null || startContainer === void 0 ? void 0 : startContainer.wholeText;
51
+ const startContainer = editorRange?.startContainer;
52
+ const wholeText = startContainer?.wholeText;
53
53
 
54
54
  // check if selection is inline latex
55
55
  if (selection && selectionIsLatex(selection)) {
@@ -58,7 +58,7 @@ export const parseLatex = editor => {
58
58
  latex,
59
59
  advancedOnly: containsAdvancedSyntax(latex)
60
60
  };
61
- } else if ((selectionNode === null || selectionNode === void 0 ? void 0 : selectionNode.tagName) === 'IMG' && selectionNode !== null && selectionNode !== void 0 && selectionNode.classList.contains('equation_image')) {
61
+ } else if (selectionNode?.tagName === 'IMG' && selectionNode?.classList.contains('equation_image')) {
62
62
  // check if we launched modal from an equation image
63
63
  try {
64
64
  const src = new URL(selectionNode.src);
@@ -16,8 +16,8 @@
16
16
  * with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
 
19
- const formatMessage = require('../../../../format-message');
20
- module.exports = [{
19
+ import formatMessage from '../../../../format-message';
20
+ export default [{
21
21
  name: formatMessage('Basic'),
22
22
  commands: [{
23
23
  displayName: 'x_{\u2B1A}^{\\ }',
@@ -29,10 +29,9 @@ const buttonContainerStyle = {
29
29
  };
30
30
  function EquationEditorToolbar(props) {
31
31
  const [selectedTab, setSelectedTab] = useState('Basic');
32
- const handleTabChange = (event, _ref) => {
33
- let {
34
- index
35
- } = _ref;
32
+ const handleTabChange = (event, {
33
+ index
34
+ }) => {
36
35
  setSelectedTab(buttons[index].name);
37
36
  };
38
37
  const renderTabPanel = section => /*#__PURE__*/React.createElement(Tabs.Panel, {
@@ -41,13 +40,12 @@ function EquationEditorToolbar(props) {
41
40
  padding: "small small",
42
41
  renderTitle: section.name,
43
42
  isSelected: selectedTab === section.name
44
- }, section.commands.map(_ref2 => {
45
- let {
46
- displayName,
47
- command,
48
- advancedCommand,
49
- label
50
- } = _ref2;
43
+ }, section.commands.map(({
44
+ displayName,
45
+ command,
46
+ advancedCommand,
47
+ label
48
+ }) => {
51
49
  const name = displayName || command;
52
50
  const icon = /*#__PURE__*/React.createElement(MathIcon, {
53
51
  command: command
@@ -21,10 +21,9 @@ import { string } from 'prop-types';
21
21
  import { IconWarningLine } from '@instructure/ui-icons';
22
22
  import { SVGIcon } from '@instructure/ui-svg-images';
23
23
  import svgs from './svgs';
24
- export default function MathIcon(_ref) {
25
- let {
26
- command
27
- } = _ref;
24
+ export default function MathIcon({
25
+ command
26
+ }) {
28
27
  if (command in svgs) {
29
28
  return /*#__PURE__*/React.createElement(SVGIcon, {
30
29
  src: svgs[command],
@@ -1,22 +1,173 @@
1
1
  /*
2
- * Copyright (C) 2021 - present Instructure, Inc.
3
- *
4
- * This file is part of Canvas.
5
- *
6
- * Canvas is free software: you can redistribute it and/or modify it under
7
- * the terms of the GNU Affero General Public License as published by the Free
8
- * Software Foundation, version 3 of the License.
9
- *
10
- * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
11
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
- * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
- * details.
14
- *
15
- * You should have received a copy of the GNU Affero General Public License along
16
- * with this program. If not, see <http://www.gnu.org/licenses/>.
2
+ * Copyright (c) 2017 - present Arno Gourdol. All rights reserved.
3
+
4
+ * Permission is hereby granted, free of charge, to any person obtaining a
5
+ * copy of this software and associated documentation files (the "Software"),
6
+ * to deal in the Software without restriction, including without limitation
7
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
+ * and/or sell copies of the Software, and to permit persons to whom the
9
+ * Software is furnished to do so, subject to the following conditions:
10
+
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
+ * DEALINGS IN THE SOFTWARE.
17
21
  */
18
22
 
19
- const mathliveCss = require('mathlive/dist/mathlive-fonts.css');
23
+ // TODO: restore import after switch from webpack to rslib
24
+ // import mathliveCss from 'mathlive/dist/mathlive-fonts.css'
25
+
26
+ const mathliveCss = `
27
+ @font-face {
28
+ font-display: "swap";
29
+ font-family: KaTeX_AMS;
30
+ font-style: normal;
31
+ font-weight: 400;
32
+ src: url(fonts/KaTeX_AMS-Regular.woff2) format("woff2");
33
+ }
34
+ @font-face {
35
+ font-display: "swap";
36
+ font-family: KaTeX_Caligraphic;
37
+ font-style: normal;
38
+ font-weight: 700;
39
+ src: url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2");
40
+ }
41
+ @font-face {
42
+ font-display: "swap";
43
+ font-family: KaTeX_Caligraphic;
44
+ font-style: normal;
45
+ font-weight: 400;
46
+ src: url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2");
47
+ }
48
+ @font-face {
49
+ font-display: "swap";
50
+ font-family: KaTeX_Fraktur;
51
+ font-style: normal;
52
+ font-weight: 700;
53
+ src: url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2");
54
+ }
55
+ @font-face {
56
+ font-display: "swap";
57
+ font-family: KaTeX_Fraktur;
58
+ font-style: normal;
59
+ font-weight: 400;
60
+ src: url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2");
61
+ }
62
+ @font-face {
63
+ font-display: "swap";
64
+ font-family: KaTeX_Main;
65
+ font-style: italic;
66
+ font-weight: 700;
67
+ src: url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2");
68
+ }
69
+ @font-face {
70
+ font-display: "swap";
71
+ font-family: KaTeX_Main;
72
+ font-style: normal;
73
+ font-weight: 700;
74
+ src: url(fonts/KaTeX_Main-Bold.woff2) format("woff2");
75
+ }
76
+ @font-face {
77
+ font-display: "swap";
78
+ font-family: KaTeX_Main;
79
+ font-style: italic;
80
+ font-weight: 400;
81
+ src: url(fonts/KaTeX_Main-Italic.woff2) format("woff2");
82
+ }
83
+ @font-face {
84
+ font-display: "swap";
85
+ font-family: KaTeX_Main;
86
+ font-style: normal;
87
+ font-weight: 400;
88
+ src: url(fonts/KaTeX_Main-Regular.woff2) format("woff2");
89
+ }
90
+ @font-face {
91
+ font-display: "swap";
92
+ font-family: KaTeX_Math;
93
+ font-style: italic;
94
+ font-weight: 700;
95
+ src: url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2");
96
+ }
97
+ @font-face {
98
+ font-display: "swap";
99
+ font-family: KaTeX_Math;
100
+ font-style: italic;
101
+ font-weight: 400;
102
+ src: url(fonts/KaTeX_Math-Italic.woff2) format("woff2");
103
+ }
104
+ @font-face {
105
+ font-display: "swap";
106
+ font-family: "KaTeX_SansSerif";
107
+ font-style: normal;
108
+ font-weight: 700;
109
+ src: url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2");
110
+ }
111
+ @font-face {
112
+ font-display: "swap";
113
+ font-family: "KaTeX_SansSerif";
114
+ font-style: italic;
115
+ font-weight: 400;
116
+ src: url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2");
117
+ }
118
+ @font-face {
119
+ font-display: "swap";
120
+ font-family: "KaTeX_SansSerif";
121
+ font-style: normal;
122
+ font-weight: 400;
123
+ src: url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2");
124
+ }
125
+ @font-face {
126
+ font-display: "swap";
127
+ font-family: KaTeX_Script;
128
+ font-style: normal;
129
+ font-weight: 400;
130
+ src: url(fonts/KaTeX_Script-Regular.woff2) format("woff2");
131
+ }
132
+ @font-face {
133
+ font-display: "swap";
134
+ font-family: KaTeX_Size1;
135
+ font-style: normal;
136
+ font-weight: 400;
137
+ src: url(fonts/KaTeX_Size1-Regular.woff2) format("woff2");
138
+ }
139
+ @font-face {
140
+ font-display: "swap";
141
+ font-family: KaTeX_Size2;
142
+ font-style: normal;
143
+ font-weight: 400;
144
+ src: url(fonts/KaTeX_Size2-Regular.woff2) format("woff2");
145
+ }
146
+ @font-face {
147
+ font-display: "swap";
148
+ font-family: KaTeX_Size3;
149
+ font-style: normal;
150
+ font-weight: 400;
151
+ src: url(fonts/KaTeX_Size3-Regular.woff2) format("woff2");
152
+ }
153
+ @font-face {
154
+ font-display: "swap";
155
+ font-family: KaTeX_Size4;
156
+ font-style: normal;
157
+ font-weight: 400;
158
+ src: url(fonts/KaTeX_Size4-Regular.woff2) format("woff2");
159
+ }
160
+ @font-face {
161
+ font-display: "swap";
162
+ font-family: KaTeX_Typewriter;
163
+ font-style: normal;
164
+ font-weight: 400;
165
+ src: url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2");
166
+ }
167
+ :root {
168
+ --ML__static-fonts: true;
169
+ }
170
+ `;
20
171
  const cssRules = `.ML__popover {
21
172
  /* Override this so it shows up on top of dialogs */
22
173
  z-index: 20000 !important;
@@ -29,7 +29,6 @@ tinymce.PluginManager.add('instructure_fullscreen', function (editor) {
29
29
  icon: 'fullscreen',
30
30
  onAction: () => editor.execCommand('instructureFullscreen'),
31
31
  onSetup(api) {
32
- // @ts-expect-error
33
32
  api.setDisabled(!!document[FS_ELEMENT]);
34
33
  return () => undefined;
35
34
  }
@@ -39,7 +38,6 @@ tinymce.PluginManager.add('instructure_fullscreen', function (editor) {
39
38
  icon: 'fullscreen_exit',
40
39
  onAction: () => editor.execCommand('instructureFullscreen'),
41
40
  onSetup(api) {
42
- // @ts-expect-error
43
41
  api.setDisabled(!document[FS_ELEMENT]);
44
42
  return () => undefined;
45
43
  }
@@ -25,10 +25,9 @@ export const LIST_ICON_MAKER = 'list_icon_maker_icons';
25
25
  export const EDIT_ICON_MAKER = 'edit_icon_maker_icon';
26
26
  export const ICONS_TRAY_CONTAINER_ID = 'instructure-rce-icons-tray-container';
27
27
  export default function (ed, document, type) {
28
- return import('./components/IconMakerTray').then(_ref => {
29
- let {
30
- IconMakerTray
31
- } = _ref;
28
+ return import('./components/IconMakerTray').then(({
29
+ IconMakerTray
30
+ }) => {
32
31
  let container = document.querySelector(`#${ICONS_TRAY_CONTAINER_ID}`);
33
32
  const trayProps = bridge.trayProps.get(ed);
34
33
  const handleUnmount = () => {
@@ -24,55 +24,52 @@ import formatMessage from '../../../../../format-message';
24
24
  const OUTLINE_SIZES = ['none', 'small', 'medium', 'large'];
25
25
  export const COLOR_SECTION_ID = 'icons-tray-color-section';
26
26
  const getColorSection = () => document.querySelector(`#${COLOR_SECTION_ID}`);
27
- export const ColorSection = _ref => {
28
- let {
29
- settings,
30
- onChange
31
- } = _ref;
32
- return /*#__PURE__*/React.createElement(Flex, {
33
- as: "section",
34
- direction: "column",
35
- id: COLOR_SECTION_ID,
36
- justifyItems: "space-between",
37
- padding: "0 small"
38
- }, /*#__PURE__*/React.createElement(Flex.Item, {
39
- padding: "small"
40
- }, /*#__PURE__*/React.createElement(ColorInput, {
41
- color: settings.color,
42
- label: formatMessage('Icon Color'),
43
- name: "icon-color",
44
- onChange: color => onChange({
45
- color
46
- }),
47
- popoverMountNode: getColorSection
48
- })), /*#__PURE__*/React.createElement(Flex.Item, {
49
- padding: "small"
50
- }, /*#__PURE__*/React.createElement(SimpleSelect, {
51
- assistiveText: formatMessage('Use arrow keys to select an outline size.'),
52
- id: "icon-outline-size",
53
- mountNode: getColorSection,
54
- onChange: (e, option) => onChange({
55
- outlineSize: option.value
56
- }),
57
- renderLabel: formatMessage('Outline Size'),
58
- value: settings.outlineSize
59
- }, OUTLINE_SIZES.map(size => /*#__PURE__*/React.createElement(SimpleSelect.Option, {
60
- id: `outline-size-${size}`,
61
- key: `outline-size-${size}`,
62
- value: size
63
- }, OUTLINE_SIZE_DESCRIPTION[size] || '')))), /*#__PURE__*/React.createElement(Flex.Item, {
64
- padding: "small"
65
- }, /*#__PURE__*/React.createElement(ColorInput, {
66
- color: settings.outlineColor,
67
- label: formatMessage('Outline Color'),
68
- name: "icon-outline",
69
- onChange: outlineColor => onChange({
70
- outlineColor
71
- }),
72
- popoverMountNode: getColorSection,
73
- requireColor: true
74
- })));
75
- };
27
+ export const ColorSection = ({
28
+ settings,
29
+ onChange
30
+ }) => /*#__PURE__*/React.createElement(Flex, {
31
+ as: "section",
32
+ direction: "column",
33
+ id: COLOR_SECTION_ID,
34
+ justifyItems: "space-between",
35
+ padding: "0 small"
36
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
37
+ padding: "small"
38
+ }, /*#__PURE__*/React.createElement(ColorInput, {
39
+ color: settings.color,
40
+ label: formatMessage('Icon Color'),
41
+ name: "icon-color",
42
+ onChange: color => onChange({
43
+ color
44
+ }),
45
+ popoverMountNode: getColorSection
46
+ })), /*#__PURE__*/React.createElement(Flex.Item, {
47
+ padding: "small"
48
+ }, /*#__PURE__*/React.createElement(SimpleSelect, {
49
+ assistiveText: formatMessage('Use arrow keys to select an outline size.'),
50
+ id: "icon-outline-size",
51
+ mountNode: getColorSection,
52
+ onChange: (e, option) => onChange({
53
+ outlineSize: option.value
54
+ }),
55
+ renderLabel: formatMessage('Outline Size'),
56
+ value: settings.outlineSize
57
+ }, OUTLINE_SIZES.map(size => /*#__PURE__*/React.createElement(SimpleSelect.Option, {
58
+ id: `outline-size-${size}`,
59
+ key: `outline-size-${size}`,
60
+ value: size
61
+ }, OUTLINE_SIZE_DESCRIPTION[size] || '')))), /*#__PURE__*/React.createElement(Flex.Item, {
62
+ padding: "small"
63
+ }, /*#__PURE__*/React.createElement(ColorInput, {
64
+ color: settings.outlineColor,
65
+ label: formatMessage('Outline Color'),
66
+ name: "icon-outline",
67
+ onChange: outlineColor => onChange({
68
+ outlineColor
69
+ }),
70
+ popoverMountNode: getColorSection,
71
+ requireColor: true
72
+ })));
76
73
  const OUTLINE_SIZE_DESCRIPTION = {
77
74
  none: formatMessage('None'),
78
75
  small: formatMessage('Small'),
@@ -22,16 +22,15 @@ import { ShapeSection } from './ShapeSection';
22
22
  import { ColorSection } from './ColorSection';
23
23
  import { TextSection } from './TextSection';
24
24
  import { ImageSection } from './ImageSection';
25
- export const CreateIconMakerForm = _ref => {
26
- let {
27
- settings,
28
- dispatch,
29
- editor,
30
- editing,
31
- allowNameChange,
32
- nameRef,
33
- canvasOrigin
34
- } = _ref;
25
+ export const CreateIconMakerForm = ({
26
+ settings,
27
+ dispatch,
28
+ editor,
29
+ editing,
30
+ allowNameChange,
31
+ nameRef,
32
+ canvasOrigin
33
+ }) => {
35
34
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, {
36
35
  settings: settings,
37
36
  onChange: dispatch,
@@ -23,17 +23,16 @@ import { Flex } from '@instructure/ui-flex';
23
23
  import { View } from '@instructure/ui-view';
24
24
  import formatMessage from '../../../../../format-message';
25
25
  import { ConditionalTooltip } from '../../../shared/ConditionalTooltip';
26
- export const Footer = _ref => {
27
- let {
28
- disabled,
29
- onCancel,
30
- onSubmit,
31
- replaceAll,
32
- onReplaceAllChanged,
33
- editing,
34
- isModified,
35
- applyRef
36
- } = _ref;
26
+ export const Footer = ({
27
+ disabled,
28
+ onCancel,
29
+ onSubmit,
30
+ replaceAll,
31
+ onReplaceAllChanged,
32
+ editing,
33
+ isModified,
34
+ applyRef
35
+ }) => {
37
36
  return /*#__PURE__*/React.createElement(React.Fragment, null, editing && /*#__PURE__*/React.createElement(View, {
38
37
  as: "div",
39
38
  padding: "medium"
@@ -19,12 +19,11 @@
19
19
  import React from 'react';
20
20
  import { ToggleGroup } from '@instructure/ui-toggle-details';
21
21
  import formatMessage from '../../../../../format-message';
22
- export function Group(_ref) {
23
- let {
24
- children,
25
- summary,
26
- ...props
27
- } = _ref;
22
+ export function Group({
23
+ children,
24
+ summary,
25
+ ...props
26
+ }) {
28
27
  return /*#__PURE__*/React.createElement(ToggleGroup, Object.assign({
29
28
  background: "default",
30
29
  border: false,
@@ -49,14 +49,13 @@ const getAltTextLabel = () => /*#__PURE__*/React.createElement(Flex, {
49
49
  size: "small",
50
50
  screenReaderLabel: formatMessage('Toggle tooltip')
51
51
  }))));
52
- export const Header = _ref => {
53
- let {
54
- settings,
55
- onChange,
56
- allowNameChange,
57
- nameRef,
58
- editing
59
- } = _ref;
52
+ export const Header = ({
53
+ settings,
54
+ onChange,
55
+ allowNameChange,
56
+ nameRef,
57
+ editing
58
+ }) => {
60
59
  const originalName = settings.originalName;
61
60
  const [name, setName] = useDebouncedValue(settings.name, n => onChange({
62
61
  name: n
@@ -63,7 +63,6 @@ const dispatchImage = async (dispatch, onChange, dataUrl, dataBlob) => {
63
63
  previewHeight: PREVIEW_HEIGHT
64
64
  });
65
65
  } catch (e) {
66
- // eslint-disable-next-line no-console
67
66
  console.error(e);
68
67
  }
69
68
  dispatch({
@@ -80,14 +79,13 @@ const dispatchImage = async (dispatch, onChange, dataUrl, dataBlob) => {
80
79
  payload: image
81
80
  });
82
81
  };
83
- const Course = _ref => {
84
- let {
85
- dispatch,
86
- onChange,
87
- onLoading,
88
- onLoaded,
89
- canvasOrigin
90
- } = _ref;
82
+ const Course = ({
83
+ dispatch,
84
+ onChange,
85
+ onLoading,
86
+ onLoaded,
87
+ canvasOrigin
88
+ }) => {
91
89
  const storeProps = useStoreProps();
92
90
  const {
93
91
  files,
@@ -39,10 +39,9 @@ import _ from 'lodash';
39
39
  const getCompressionMessage = () => formatMessage('Your image has been compressed for Icon Maker. Images less than {size} KB will not be compressed.', {
40
40
  size: MAX_IMAGE_SIZE_BYTES / 1024
41
41
  });
42
- function renderImagePreview(_ref, embedImage) {
43
- let {
44
- loading
45
- } = _ref;
42
+ function renderImagePreview({
43
+ loading
44
+ }, embedImage) {
46
45
  return /*#__PURE__*/React.createElement(PreviewIcon, {
47
46
  variant: "large",
48
47
  testId: "selected-image-preview",
@@ -51,20 +50,18 @@ function renderImagePreview(_ref, embedImage) {
51
50
  checkered: true
52
51
  });
53
52
  }
54
- function renderImageName(_ref2) {
55
- let {
56
- imageName
57
- } = _ref2;
53
+ function renderImageName({
54
+ imageName
55
+ }) {
58
56
  return /*#__PURE__*/React.createElement(View, {
59
57
  maxWidth: "200px",
60
58
  as: "div"
61
59
  }, /*#__PURE__*/React.createElement(TruncateText, null, /*#__PURE__*/React.createElement(Text, null, imageName || formatMessage('None Selected'))));
62
60
  }
63
- function renderImageActionButtons(_ref3, dispatch, trayDispatch, setFocus, ref) {
64
- let {
65
- mode,
66
- collectionOpen
67
- } = _ref3;
61
+ function renderImageActionButtons({
62
+ mode,
63
+ collectionOpen
64
+ }, dispatch, trayDispatch, setFocus, ref) {
68
65
  const showCropButton = [modes.uploadImages.type, modes.courseImages.type].includes(mode) && !collectionOpen;
69
66
  return /*#__PURE__*/React.createElement(React.Fragment, null, showCropButton && /*#__PURE__*/React.createElement(IconButton, {
70
67
  margin: "0 small 0 0",
@@ -88,14 +85,13 @@ function renderImageActionButtons(_ref3, dispatch, trayDispatch, setFocus, ref)
88
85
  "data-testid": "clear-image"
89
86
  }, /*#__PURE__*/React.createElement(IconTrashLine, null)));
90
87
  }
91
- export const ImageOptions = _ref4 => {
92
- let {
93
- state,
94
- settings,
95
- dispatch,
96
- mountNode,
97
- trayDispatch
98
- } = _ref4;
88
+ export const ImageOptions = ({
89
+ state,
90
+ settings,
91
+ dispatch,
92
+ mountNode,
93
+ trayDispatch
94
+ }) => {
99
95
  const [isImageActionFocused, setIsImageActionFocused] = useState(false);
100
96
  const imageActionRef = useCallback(el => {
101
97
  if (el && isImageActionFocused) el.focus();
@@ -103,8 +99,7 @@ export const ImageOptions = _ref4 => {
103
99
 
104
100
  // After submitting cropper modal a new embedded image should be generated
105
101
  useEffect(() => {
106
- var _settings$imageSettin;
107
- if (state.cropperSettings && settings.imageSettings && !_.isEqual(state.cropperSettings, (_settings$imageSettin = settings.imageSettings) === null || _settings$imageSettin === void 0 ? void 0 : _settings$imageSettin.cropperSettings)) {
102
+ if (state.cropperSettings && settings.imageSettings && !_.isEqual(state.cropperSettings, settings.imageSettings?.cropperSettings)) {
108
103
  if (state.cropperSettings.shape !== settings.shape) {
109
104
  trayDispatch({
110
105
  shape: state.cropperSettings.shape
@@ -117,9 +112,7 @@ export const ImageOptions = _ref4 => {
117
112
  type: trayActions.SET_EMBED_IMAGE,
118
113
  payload: base64Image
119
114
  });
120
- })
121
- // eslint-disable-next-line no-console
122
- .catch(error => console.error(error));
115
+ }).catch(error => console.error(error));
123
116
  }
124
117
  // eslint-disable-next-line react-hooks/exhaustive-deps
125
118
  }, [state.cropperSettings]);