@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
@@ -38,7 +38,7 @@ import { validIcon } from '../utils/iconValidation';
38
38
  import { IconMakerFormHasChanges } from '../utils/IconMakerFormHasChanges';
39
39
  import bridge from '../../../../bridge';
40
40
  import { shouldIgnoreClose } from '../utils/IconMakerClose';
41
- import { instuiPopupMountNode } from '../../../../util/fullscreenHelpers';
41
+ import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
42
42
  const INVALID_MESSAGE = formatMessage('One of the following styles must be added to save an icon: Icon Color, Outline Size, Icon Text, or Image');
43
43
  const UNSAVED_CHANGES_MESSAGE = formatMessage('You have unsaved changes in the Icon Maker tray. Do you want to continue without saving these changes?');
44
44
  function renderHeader(title, settings, onKeyDown, onAlertDismissal, onClose) {
@@ -109,13 +109,12 @@ function renderFooter(status, onClose, handleSubmit, editing, replaceAll, setRep
109
109
  isModified: isModified
110
110
  }));
111
111
  }
112
- export function IconMakerTray(_ref) {
113
- let {
114
- editor,
115
- onUnmount,
116
- editing,
117
- canvasOrigin
118
- } = _ref;
112
+ export function IconMakerTray({
113
+ editor,
114
+ onUnmount,
115
+ editing,
116
+ canvasOrigin
117
+ }) {
119
118
  const nameRef = useRef();
120
119
  const applyRef = useRef();
121
120
  const [isOpen, setIsOpen] = useState(true);
@@ -127,9 +126,9 @@ export function IconMakerTray(_ref) {
127
126
  ...defaultState
128
127
  });
129
128
  const isModified = useRef(false);
130
- const [mountNode, setMountNode] = useState(instuiPopupMountNode());
129
+ const [mountNode, setMountNode] = useState(instuiPopupMountNodeFn());
131
130
  const handleFullscreenChange = useCallback(() => {
132
- setMountNode(instuiPopupMountNode());
131
+ setMountNode(instuiPopupMountNodeFn());
133
132
  }, []);
134
133
 
135
134
  // These useRef objects are needed because when the tray is closed using the escape key
@@ -142,11 +141,9 @@ export function IconMakerTray(_ref) {
142
141
  statusRef.current = useMemo(() => status, [status]);
143
142
  initialSettingsRef.current = useMemo(() => initialSettings, [initialSettings]);
144
143
  useEffect(() => {
145
- var _editor$rceWrapper, _editor$rceWrapper$_e, _editor$rceWrapper$_e2;
146
- editor === null || editor === void 0 ? void 0 : (_editor$rceWrapper = editor.rceWrapper) === null || _editor$rceWrapper === void 0 ? void 0 : (_editor$rceWrapper$_e = _editor$rceWrapper._elementRef) === null || _editor$rceWrapper$_e === void 0 ? void 0 : (_editor$rceWrapper$_e2 = _editor$rceWrapper$_e.current) === null || _editor$rceWrapper$_e2 === void 0 ? void 0 : _editor$rceWrapper$_e2.addEventListener('fullscreenchange', handleFullscreenChange);
144
+ editor?.rceWrapper?._elementRef?.current?.addEventListener('fullscreenchange', handleFullscreenChange);
147
145
  return () => {
148
- var _editor$rceWrapper2, _editor$rceWrapper2$_, _editor$rceWrapper2$_2;
149
- editor === null || editor === void 0 ? void 0 : (_editor$rceWrapper2 = editor.rceWrapper) === null || _editor$rceWrapper2 === void 0 ? void 0 : (_editor$rceWrapper2$_ = _editor$rceWrapper2._elementRef) === null || _editor$rceWrapper2$_ === void 0 ? void 0 : (_editor$rceWrapper2$_2 = _editor$rceWrapper2$_.current) === null || _editor$rceWrapper2$_2 === void 0 ? void 0 : _editor$rceWrapper2$_2.removeEventListener('fullscreenchange', handleFullscreenChange);
146
+ editor?.rceWrapper?._elementRef?.current?.removeEventListener('fullscreenchange', handleFullscreenChange);
150
147
  };
151
148
  }, [editor, handleFullscreenChange]);
152
149
  useEffect(() => {
@@ -155,14 +152,14 @@ export function IconMakerTray(_ref) {
155
152
  }, [settings, initialSettings]);
156
153
  const storeProps = useStoreProps();
157
154
  const onClose = event => {
158
- if (shouldIgnoreClose(event === null || event === void 0 ? void 0 : event.target, editor === null || editor === void 0 ? void 0 : editor.id)) return;
159
- if ((statusRef === null || statusRef === void 0 ? void 0 : statusRef.current) === statuses.LOADING) return;
155
+ if (shouldIgnoreClose(event?.target, editor?.id)) return;
156
+ if (statusRef?.current === statuses.LOADING) return;
160
157
  // Uploading an image creates a modal on the page. If that modal is open, we don't want to close the tray
161
158
  // eslint-disable-next-line no-extra-boolean-cast
162
159
  if (!!hasOpenModal()) return;
163
160
  // RCE already uses browser's confirm dialog for unsaved changes
164
161
  // Its use here in the Icon Maker tray keeps that consistency
165
- // eslint-disable-next-line no-restricted-globals, no-alert
162
+
166
163
  if (isModified.current && !confirm(UNSAVED_CHANGES_MESSAGE)) {
167
164
  return;
168
165
  }
@@ -171,10 +168,9 @@ export function IconMakerTray(_ref) {
171
168
  const hasOpenModal = () => document.querySelector('[data-cid="Modal"]');
172
169
  const isLoading = () => status === statuses.LOADING;
173
170
  const onKeyDown = event => {
174
- var _applyRef$current, _nameRef$current;
175
171
  if (event.keyCode !== 9) return;
176
172
  event.preventDefault();
177
- event.shiftKey ? (_applyRef$current = applyRef.current) === null || _applyRef$current === void 0 ? void 0 : _applyRef$current.focus() : (_nameRef$current = nameRef.current) === null || _nameRef$current === void 0 ? void 0 : _nameRef$current.focus();
173
+ event.shiftKey ? applyRef.current?.focus() : nameRef.current?.focus();
178
174
  };
179
175
  useEffect(() => {
180
176
  setReplaceAll(false);
@@ -189,10 +185,9 @@ export function IconMakerTray(_ref) {
189
185
  }
190
186
  // eslint-disable-next-line react-hooks/exhaustive-deps
191
187
  }, [settings.color, settings.textColor, settings.text, settings.textSize, settings.textBackgroundColor, settings.textPosition, settings.imageSettings, settings.outlineColor, settings.outlineSize, settings.name]);
192
- const handleSubmit = _ref2 => {
193
- let {
194
- replaceFile = false
195
- } = _ref2;
188
+ const handleSubmit = ({
189
+ replaceFile = false
190
+ }) => {
196
191
  setStatus(statuses.LOADING);
197
192
  if (!validIcon(settings)) {
198
193
  dispatch({
@@ -212,16 +207,14 @@ export function IconMakerTray(_ref) {
212
207
  }, {
213
208
  onDuplicate: replaceFile && 'overwrite'
214
209
  }).then(writeIconToRCE).then(() => setIsOpen(false)).catch(err => {
215
- // eslint-disable-next-line no-console
216
210
  console.error(err);
217
211
  setStatus(statuses.ERROR);
218
212
  });
219
213
  };
220
- const writeIconToRCE = _ref3 => {
221
- let {
222
- url,
223
- display_name
224
- } = _ref3;
214
+ const writeIconToRCE = ({
215
+ url,
216
+ display_name
217
+ }) => {
225
218
  const {
226
219
  alt,
227
220
  isDecorative,
@@ -19,7 +19,7 @@
19
19
  import formatMessage from '../../../format-message';
20
20
  import { BUTTON_ID, TOOLBAR_ID, ICON_MAKER_ATTRIBUTE } from './svg/constants';
21
21
  import TrayController from '../instructure_image/ImageOptionsTray/TrayController';
22
- export const shouldShowEditButton = node => !!(node !== null && node !== void 0 && node.getAttribute(ICON_MAKER_ATTRIBUTE));
22
+ export const shouldShowEditButton = node => !!node?.getAttribute(ICON_MAKER_ATTRIBUTE);
23
23
  export const EDIT_ALT_TEXT_BUTTON_ID = 'inst-icon-maker-edit-alt-text';
24
24
  const trayController = new TrayController();
25
25
  export default function registerEditToolbar(editor, onAction) {
@@ -21,11 +21,10 @@ import { CLIP_PATH_ID } from './clipPath';
21
21
  import { Shape } from './shape';
22
22
  import { Size, STROKE_WIDTH, BASE_SIZE, ICON_PADDING } from './constants';
23
23
  const STOCK_IMAGE_TYPES = ['SingleColor', 'MultiColor'];
24
- const calculateImageHeight = _ref => {
25
- let {
26
- size,
27
- outlineSize
28
- } = _ref;
24
+ const calculateImageHeight = ({
25
+ size,
26
+ outlineSize
27
+ }) => {
29
28
  // Subtract the padding at the top and the bottom
30
29
  // to get the true height of the shape in the icon
31
30
  const iconHeightLessPadding = BASE_SIZE[size] - 2 * ICON_PADDING;
@@ -35,9 +34,8 @@ const calculateImageHeight = _ref => {
35
34
  return iconHeightLessPadding - STROKE_WIDTH[outlineSize];
36
35
  };
37
36
  export function buildImage(settings) {
38
- var _settings$imageSettin;
39
37
  // Don't attempt to embed an image if none exist
40
- if (!((_settings$imageSettin = settings.imageSettings) !== null && _settings$imageSettin !== void 0 && _settings$imageSettin.image)) return;
38
+ if (!settings.imageSettings?.image) return;
41
39
  let imageAttributes;
42
40
  if (STOCK_IMAGE_TYPES.includes(settings.imageSettings.mode)) {
43
41
  imageAttributes = {
@@ -24,8 +24,7 @@ import { buildImage } from './image';
24
24
  import { buildClipPath } from './clipPath';
25
25
  import { buildText, buildTextBackground, getContainerWidth, getContainerHeight } from './text';
26
26
  import base64EncodedFont from './font';
27
- export function buildSvg(settings) {
28
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
27
+ export function buildSvg(settings, options = {}) {
29
28
  settings = {
30
29
  ...DEFAULT_SETTINGS,
31
30
  ...settings
@@ -100,13 +99,11 @@ export function buildSvgContainer(settings, options) {
100
99
  if (options.isPreview) attributes.style = 'padding: 16px';
101
100
  return createSvgElement('svg', attributes);
102
101
  }
103
- export function buildGroup(_ref) {
104
- let {
105
- color,
106
- outlineColor,
107
- outlineSize
108
- } = _ref;
109
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
102
+ export function buildGroup({
103
+ color,
104
+ outlineColor,
105
+ outlineSize
106
+ }, options = {}) {
110
107
  const g = createSvgElement('g');
111
108
  if (options.fill) {
112
109
  g.setAttribute('fill', color || 'none');
@@ -29,11 +29,10 @@ export const statuses = {
29
29
  IDLE: 'idle'
30
30
  };
31
31
  const getImageNode = (editor, editing) => {
32
- var _editor$selection;
33
32
  // If the user is creating an icon rather then editing, no sense trying
34
33
  // to get an existing SVG URL
35
34
  if (!editing) return;
36
- const selectedNode = editor === null || editor === void 0 ? void 0 : (_editor$selection = editor.selection) === null || _editor$selection === void 0 ? void 0 : _editor$selection.getNode();
35
+ const selectedNode = editor?.selection?.getNode();
37
36
 
38
37
  // No selection made, return
39
38
  if (!selectedNode) return;
@@ -64,21 +63,20 @@ export function useSvgSettings(editor, editing, canvasOrigin) {
64
63
  const [settings, dispatch] = useReducer(svgSettingsReducer, defaultState);
65
64
  const [status, setStatus] = useState(statuses.IDLE);
66
65
  const imgNode = getImageNode(editor, editing);
67
- const urlFromNode = imgNode === null || imgNode === void 0 ? void 0 : imgNode.getAttribute(ICON_MAKER_DOWNLOAD_URL_ATTR);
68
- const altText = imgNode === null || imgNode === void 0 ? void 0 : imgNode.getAttribute('alt');
69
- const customStyle = imgNode === null || imgNode === void 0 ? void 0 : imgNode.getAttribute('style');
70
- const customWidth = imgNode === null || imgNode === void 0 ? void 0 : imgNode.getAttribute('width');
71
- const customHeight = imgNode === null || imgNode === void 0 ? void 0 : imgNode.getAttribute('height');
66
+ const urlFromNode = imgNode?.getAttribute(ICON_MAKER_DOWNLOAD_URL_ATTR);
67
+ const altText = imgNode?.getAttribute('alt');
68
+ const customStyle = imgNode?.getAttribute('style');
69
+ const customWidth = imgNode?.getAttribute('width');
70
+ const customHeight = imgNode?.getAttribute('height');
72
71
  useEffect(() => {
73
72
  const fetchSvgSettings = async () => {
74
73
  if (!urlFromNode) return;
75
74
  try {
76
- var _urlFromNode$split$;
77
75
  setStatus(statuses.LOADING);
78
76
 
79
77
  // Parse out the file ID from something like
80
78
  // /courses/1/files/3/preview?...
81
- const fileId = (_urlFromNode$split$ = urlFromNode.split('files/')[1]) === null || _urlFromNode$split$ === void 0 ? void 0 : _urlFromNode$split$.split('/')[0];
79
+ const fileId = urlFromNode.split('files/')[1]?.split('/')[0];
82
80
  const downloadUrl = buildMetadataUrl(fileId, canvasOrigin);
83
81
 
84
82
  // Download icon metadata. If no metadata found, return defaults
@@ -107,13 +105,13 @@ export function useSvgSettings(editor, editing, canvasOrigin) {
107
105
  const {
108
106
  imageSettings
109
107
  } = metadataJson;
110
- if (imageSettings !== null && imageSettings !== void 0 && imageSettings.cropperSettings) {
108
+ if (imageSettings?.cropperSettings) {
111
109
  const generatedSvg = await createCroppedImageSvg(imageSettings.cropperSettings, imageSettings.image);
112
110
  metadataJson.embedImage = await convertFileToBase64(new Blob([generatedSvg.outerHTML], {
113
111
  type: 'image/svg+xml'
114
112
  }));
115
113
  } else {
116
- metadataJson.embedImage = (imageSettings === null || imageSettings === void 0 ? void 0 : imageSettings.image) || defaultState.embedImage;
114
+ metadataJson.embedImage = imageSettings?.image || defaultState.embedImage;
117
115
  }
118
116
 
119
117
  // settings found, return parsed results
@@ -130,9 +128,8 @@ export function useSvgSettings(editor, editing, canvasOrigin) {
130
128
  return [settings, status, dispatch];
131
129
  }
132
130
  function processMetadataForBackwardCompatibility(metadataJson) {
133
- var _metadataJson$imageSe, _metadataJson$imageSe2, _metadataJson$imageSe3, _metadataJson$imageSe4, _metadataJson$imageSe5, _metadataJson$imageSe6, _metadataJson$imageSe7, _metadataJson$imageSe8;
134
- const icon = metadataJson === null || metadataJson === void 0 ? void 0 : (_metadataJson$imageSe = metadataJson.imageSettings) === null || _metadataJson$imageSe === void 0 ? void 0 : _metadataJson$imageSe.icon;
135
- const mode = metadataJson === null || metadataJson === void 0 ? void 0 : (_metadataJson$imageSe2 = metadataJson.imageSettings) === null || _metadataJson$imageSe2 === void 0 ? void 0 : _metadataJson$imageSe2.mode;
131
+ const icon = metadataJson?.imageSettings?.icon;
132
+ const mode = metadataJson?.imageSettings?.mode;
136
133
  if (mode === modes.singleColorImages.type && typeof icon === 'object') {
137
134
  const foundIconId = iconsLabels[icon.label];
138
135
  if (foundIconId) {
@@ -144,9 +141,9 @@ function processMetadataForBackwardCompatibility(metadataJson) {
144
141
 
145
142
  // On old icons we stored the original image inside cropper settings
146
143
  // If that's the case we are copying it to the correct place
147
- const cropperSettingsImage = metadataJson === null || metadataJson === void 0 ? void 0 : (_metadataJson$imageSe3 = metadataJson.imageSettings) === null || _metadataJson$imageSe3 === void 0 ? void 0 : (_metadataJson$imageSe4 = _metadataJson$imageSe3.cropperSettings) === null || _metadataJson$imageSe4 === void 0 ? void 0 : _metadataJson$imageSe4.image;
148
- const imageSettingsImage = metadataJson === null || metadataJson === void 0 ? void 0 : (_metadataJson$imageSe5 = metadataJson.imageSettings) === null || _metadataJson$imageSe5 === void 0 ? void 0 : _metadataJson$imageSe5.image;
149
- const encodedImage = metadataJson === null || metadataJson === void 0 ? void 0 : metadataJson.encodedImage;
144
+ const cropperSettingsImage = metadataJson?.imageSettings?.cropperSettings?.image;
145
+ const imageSettingsImage = metadataJson?.imageSettings?.image;
146
+ const encodedImage = metadataJson?.encodedImage;
150
147
  if (imageSettingsImage && cropperSettingsImage && imageSettingsImage !== cropperSettingsImage) {
151
148
  metadataJson.imageSettings.image = cropperSettingsImage || imageSettingsImage || encodedImage || '';
152
149
  delete metadataJson.imageSettings.cropperSettings.image;
@@ -158,14 +155,14 @@ function processMetadataForBackwardCompatibility(metadataJson) {
158
155
  delete metadataJson.encodedImageName;
159
156
 
160
157
  // Cleans image settings if there is no image or icon
161
- const imageSettingsIcon = metadataJson === null || metadataJson === void 0 ? void 0 : (_metadataJson$imageSe6 = metadataJson.imageSettings) === null || _metadataJson$imageSe6 === void 0 ? void 0 : _metadataJson$imageSe6.icon;
158
+ const imageSettingsIcon = metadataJson?.imageSettings?.icon;
162
159
  if (!imageSettingsImage && !imageSettingsIcon) {
163
160
  metadataJson.imageSettings = null;
164
161
  }
165
162
 
166
163
  // Replaces cropper settings' shape using icon's shape
167
- const cropperSettingsShape = metadataJson === null || metadataJson === void 0 ? void 0 : (_metadataJson$imageSe7 = metadataJson.imageSettings) === null || _metadataJson$imageSe7 === void 0 ? void 0 : (_metadataJson$imageSe8 = _metadataJson$imageSe7.cropperSettings) === null || _metadataJson$imageSe8 === void 0 ? void 0 : _metadataJson$imageSe8.shape;
168
- const shape = metadataJson === null || metadataJson === void 0 ? void 0 : metadataJson.shape;
164
+ const cropperSettingsShape = metadataJson?.imageSettings?.cropperSettings?.shape;
165
+ const shape = metadataJson?.shape;
169
166
  if (shape && cropperSettingsShape && shape !== cropperSettingsShape) {
170
167
  metadataJson.imageSettings.cropperSettings.shape = shape;
171
168
  }
@@ -28,11 +28,10 @@ export const Shape = {
28
28
  Octagon: 'octagon',
29
29
  Star: 'star'
30
30
  };
31
- export function buildShape(_ref) {
32
- let {
33
- shape,
34
- size
35
- } = _ref;
31
+ export function buildShape({
32
+ shape,
33
+ size
34
+ }) {
36
35
  switch (shape) {
37
36
  case Shape.Square:
38
37
  return buildSquare(size);
@@ -19,15 +19,14 @@
19
19
  import { createSvgElement, splitTextIntoLines } from './utils';
20
20
  import { TEXT_BACKGROUND_PADDING, BASE_SIZE, TEXT_SIZE, MAX_CHAR_COUNT, Size, TEXT_SIZE_FONT_DIFF } from './constants';
21
21
  import { Shape } from './shape';
22
- export function buildText(_ref) {
23
- let {
24
- text,
25
- textPosition,
26
- textSize,
27
- textColor,
28
- shape,
29
- size
30
- } = _ref;
22
+ export function buildText({
23
+ text,
24
+ textPosition,
25
+ textSize,
26
+ textColor,
27
+ shape,
28
+ size
29
+ }) {
31
30
  if (!text.trim()) return null;
32
31
  const lines = splitTextIntoLines(text, MAX_CHAR_COUNT[textSize]);
33
32
  const textElement = createSvgElement('text', {
@@ -54,15 +53,14 @@ export function buildText(_ref) {
54
53
  });
55
54
  return textElement;
56
55
  }
57
- export function buildTextBackground(_ref2) {
58
- let {
59
- text,
60
- textPosition,
61
- textSize,
62
- textBackgroundColor,
63
- shape,
64
- size
65
- } = _ref2;
56
+ export function buildTextBackground({
57
+ text,
58
+ textPosition,
59
+ textSize,
60
+ textBackgroundColor,
61
+ shape,
62
+ size
63
+ }) {
66
64
  if (!text.trim()) return null;
67
65
  const linesCount = splitTextIntoLines(text, MAX_CHAR_COUNT[textSize]).length;
68
66
  const xValue = getTextXValue(text, textSize, size);
@@ -83,25 +81,23 @@ export function buildTextBackground(_ref2) {
83
81
  pathElement.setAttribute('fill', textBackgroundColor || '');
84
82
  return pathElement;
85
83
  }
86
- export function getContainerWidth(_ref3) {
87
- let {
88
- text,
89
- textSize,
90
- size
91
- } = _ref3;
84
+ export function getContainerWidth({
85
+ text,
86
+ textSize,
87
+ size
88
+ }) {
92
89
  const fontWeight = 2;
93
90
  const base = BASE_SIZE[size];
94
91
  const textWidth = Math.floor(getTextWidth(text, textSize)) + TEXT_BACKGROUND_PADDING * 2 + fontWeight;
95
92
  return Math.max(base, textWidth);
96
93
  }
97
- export function getContainerHeight(_ref4) {
98
- let {
99
- text,
100
- textPosition,
101
- textSize,
102
- shape,
103
- size
104
- } = _ref4;
94
+ export function getContainerHeight({
95
+ text,
96
+ textPosition,
97
+ textSize,
98
+ shape,
99
+ size
100
+ }) {
105
101
  const base = BASE_SIZE[size];
106
102
  if (!text || text.trim().length === 0) {
107
103
  return base;
@@ -16,11 +16,9 @@
16
16
  * with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
 
19
- export function createSvgElement(tag) {
20
- let attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19
+ export function createSvgElement(tag, attributes = {}) {
21
20
  const element = document.createElementNS('http://www.w3.org/2000/svg', tag);
22
- Object.entries(attributes).forEach(_ref => {
23
- let [attr, value] = _ref;
21
+ Object.entries(attributes).forEach(([attr, value]) => {
24
22
  element.setAttribute(attr, value);
25
23
  });
26
24
  return element;
@@ -30,12 +30,11 @@ export const shouldIgnoreClose = (target, editorId) => {
30
30
  };
31
31
  const elementTreeHasAttribute = (target, attribute, value) => {
32
32
  while (target) {
33
- var _target, _target$attributes, _target$attributes$at, _target2;
34
33
  // @ts-expect-error
35
- if (((_target = target) === null || _target === void 0 ? void 0 : (_target$attributes = _target.attributes) === null || _target$attributes === void 0 ? void 0 : (_target$attributes$at = _target$attributes[attribute]) === null || _target$attributes$at === void 0 ? void 0 : _target$attributes$at.value) === value) {
34
+ if (target?.attributes?.[attribute]?.value === value) {
36
35
  return true;
37
36
  }
38
- target = (_target2 = target) === null || _target2 === void 0 ? void 0 : _target2.parentElement;
37
+ target = target?.parentElement;
39
38
  }
40
39
  return false;
41
40
  };
@@ -23,8 +23,7 @@ export const hasText = settings => {
23
23
  return settings.text.length > 0;
24
24
  };
25
25
  export const hasImage = settings => {
26
- var _settings$imageSettin;
27
- return ((_settings$imageSettin = settings.imageSettings) === null || _settings$imageSettin === void 0 ? void 0 : _settings$imageSettin.image.length) > 0;
26
+ return settings.imageSettings?.image.length > 0;
28
27
  };
29
28
  export const hasOutline = settings => {
30
29
  return settings.outlineSize !== 'none';
@@ -109,8 +109,7 @@ export function fromVideoEmbed($element) {
109
109
  source: $videoElem && $videoElem.querySelector('source')
110
110
  };
111
111
  try {
112
- var _$videoDoc$querySelec;
113
- const trackjson = (_$videoDoc$querySelec = $videoDoc.querySelector('[data-tracks]')) === null || _$videoDoc$querySelec === void 0 ? void 0 : _$videoDoc$querySelec.getAttribute('data-tracks');
112
+ const trackjson = $videoDoc.querySelector('[data-tracks]')?.getAttribute('data-tracks');
114
113
  if (trackjson) {
115
114
  videoOptions.tracks = JSON.parse(trackjson);
116
115
  }
@@ -120,7 +119,7 @@ export function fromVideoEmbed($element) {
120
119
  videoOptions.videoSize = imageSizeFromKnownOptions(videoOptions);
121
120
  if (RCEGlobals.getFeatures().media_links_use_attachment_id) {
122
121
  const source = $videoIframe.getAttribute('src');
123
- const matches = source === null || source === void 0 ? void 0 : source.match(/\/media_attachments_iframe\/(\d+)/);
122
+ const matches = source?.match(/\/media_attachments_iframe\/(\d+)/);
124
123
  if (matches) {
125
124
  videoOptions.attachmentId = matches[1];
126
125
  }
@@ -148,10 +147,7 @@ export function scaleToSize(imageSize, naturalWidth, naturalHeight) {
148
147
  height: naturalHeight
149
148
  };
150
149
  }
151
- const [dimension] = Object.entries(sizeByMaximumDimension).find(_ref => {
152
- let [, size] = _ref;
153
- return size === imageSize;
154
- });
150
+ const [dimension] = Object.entries(sizeByMaximumDimension).find(([, size]) => size === imageSize);
155
151
  const scaleFactor = dimension / Math.max(naturalWidth, naturalHeight);
156
152
  return {
157
153
  height: Math.round(naturalHeight * scaleFactor),
@@ -26,14 +26,13 @@ import { View } from '@instructure/ui-view';
26
26
  import dragHtml from '../../../../sidebar/dragHtml';
27
27
  import formatMessage from '../../../../format-message';
28
28
  import { renderImage } from '../../../contentRendering';
29
- export default function Image(_ref) {
30
- let {
31
- focusRef,
32
- image,
33
- onClick,
34
- isIconMaker,
35
- canvasOrigin
36
- } = _ref;
29
+ export default function Image({
30
+ focusRef,
31
+ image,
32
+ onClick,
33
+ isIconMaker,
34
+ canvasOrigin
35
+ }) {
37
36
  const imgTitle = formatMessage('Click to embed {imageName}', {
38
37
  imageName: image.display_name
39
38
  });
@@ -20,14 +20,13 @@ import React from 'react';
20
20
  import { arrayOf, func, instanceOf, shape, bool, string } from 'prop-types';
21
21
  import { Flex } from '@instructure/ui-flex';
22
22
  import Image from './Image';
23
- export default function ImageList(_ref) {
24
- let {
25
- images,
26
- lastItemRef,
27
- onImageClick,
28
- isIconMaker,
29
- canvasOrigin
30
- } = _ref;
23
+ export default function ImageList({
24
+ images,
25
+ lastItemRef,
26
+ onImageClick,
27
+ isIconMaker,
28
+ canvasOrigin
29
+ }) {
31
30
  return /*#__PURE__*/React.createElement(Flex, {
32
31
  justifyItems: "start",
33
32
  height: "100%",
@@ -45,8 +45,7 @@ export default class TrayController {
45
45
  }
46
46
 
47
47
  // Tray may be called to edit an Icon Maker icon alt text
48
- showTrayForEditor(editor) {
49
- let isIconMaker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
48
+ showTrayForEditor(editor, isIconMaker = false) {
50
49
  this._editor = editor;
51
50
  this.$img = editor.selection.getNode();
52
51
  this._shouldOpen = true;
@@ -113,7 +112,6 @@ export default class TrayController {
113
112
  this._editor = null;
114
113
  }
115
114
  _renderTray() {
116
- var _this$_editor, _this$_editor$selecti;
117
115
  if (this._shouldOpen) {
118
116
  /*
119
117
  * When the tray is being opened again, it should be rendered fresh
@@ -123,7 +121,7 @@ export default class TrayController {
123
121
  this._renderId++;
124
122
  }
125
123
  const io = asImageEmbed(this.$img);
126
- io.isLinked = ((_this$_editor = this._editor) === null || _this$_editor === void 0 ? void 0 : (_this$_editor$selecti = _this$_editor.selection) === null || _this$_editor$selecti === void 0 ? void 0 : _this$_editor$selecti.getSel().anchorNode.tagName) === 'A';
124
+ io.isLinked = this._editor?.selection?.getSel().anchorNode.tagName === 'A';
127
125
  const element = /*#__PURE__*/React.createElement(ImageOptionsTray, {
128
126
  key: this._renderId,
129
127
  imageOptions: io,
@@ -29,7 +29,7 @@ import ImageOptionsForm from '../../shared/ImageOptionsForm';
29
29
  import { getTrayHeight, isExternalUrl } from '../../shared/trayUtils';
30
30
  import validateURL from '../../instructure_links/validateURL';
31
31
  import UrlPanel from '../../shared/Upload/UrlPanel';
32
- import { instuiPopupMountNode } from '../../../../util/fullscreenHelpers';
32
+ import { instuiPopupMountNodeFn } from '../../../../util/fullscreenHelpers';
33
33
  export default function ImageOptionsTray(props) {
34
34
  const {
35
35
  imageOptions,
@@ -135,14 +135,14 @@ export default function ImageOptionsTray(props) {
135
135
  });
136
136
  }
137
137
  const disableForIcons = isIconMaker && !isDecorativeImage && altText === '';
138
- const disableForImages = url === '' || displayAs === 'embed' && (!isDecorativeImage && altText === '' || imageSize === CUSTOM && !(dimensionsState !== null && dimensionsState !== void 0 && dimensionsState.isValid));
138
+ const disableForImages = url === '' || displayAs === 'embed' && (!isDecorativeImage && altText === '' || imageSize === CUSTOM && !dimensionsState?.isValid);
139
139
  const saveDisabled = isIconMaker ? disableForIcons : disableForImages;
140
140
  const trayLabel = isIconMaker ? formatMessage('Icon Options Tray') : formatMessage('Image Options Tray');
141
141
  const trayHeading = isIconMaker ? formatMessage('Icon Options') : formatMessage('Image Options');
142
142
  return /*#__PURE__*/React.createElement(Tray, {
143
143
  "data-mce-component": true,
144
144
  label: trayLabel,
145
- mountNode: instuiPopupMountNode,
145
+ mountNode: instuiPopupMountNodeFn,
146
146
  onDismiss: onRequestClose,
147
147
  onEntered: onEntered,
148
148
  onExited: onExited,
@@ -31,8 +31,7 @@ const trayController = new TrayController();
31
31
 
32
32
  // @ts-expect-error
33
33
  function getMenuItems(ed) {
34
- var _ed$settings$canvas_r;
35
- const contextType = (_ed$settings$canvas_r = ed.settings.canvas_rce_user_context) === null || _ed$settings$canvas_r === void 0 ? void 0 : _ed$settings$canvas_r.type;
34
+ const contextType = ed.settings.canvas_rce_user_context?.type;
36
35
  const items = [{
37
36
  text: formatMessage('Upload Image'),
38
37
  value: 'instructure_upload_image'
@@ -22,14 +22,13 @@ import formatMessage from '../../../../format-message';
22
22
  import { ToggleGroup } from '@instructure/ui-toggle-details';
23
23
  import { Text } from '@instructure/ui-text';
24
24
  import { View } from '@instructure/ui-view';
25
- export default function AccordionSection(_ref) {
26
- let {
27
- collection,
28
- children,
29
- onToggle,
30
- expanded,
31
- label
32
- } = _ref;
25
+ export default function AccordionSection({
26
+ collection,
27
+ children,
28
+ onToggle,
29
+ expanded,
30
+ label
31
+ }) {
33
32
  const toggleLabel = expanded ? formatMessage('Collapse to hide {types}', {
34
33
  types: label
35
34
  }) : formatMessage('Expand to see {types}', {