@instructure/canvas-rce 5.8.0 → 5.10.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 (43) hide show
  1. package/.mocharc.js +7 -0
  2. package/CHANGELOG.md +20 -0
  3. package/es/enhance-user-content/mathml.js +8 -5
  4. package/es/rce/RCEWrapper.js +65 -6
  5. package/es/rce/RCEWrapperProps.js +1 -0
  6. package/es/rce/__mocks__/_mockCryptoEs.js +124 -0
  7. package/es/rce/plugins/instructure_equation/EquationEditorModal/parseLatex.js +0 -2
  8. package/es/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.js +4 -5
  9. package/es/rce/plugins/shared/CanvasContentTray.js +8 -8
  10. package/es/rce/plugins/shared/ContentSelection.js +7 -3
  11. package/es/rce/plugins/shared/ImageCropper/Preview.js +8 -7
  12. package/es/rce/plugins/shared/LinkDisplay.js +2 -2
  13. package/es/rce/plugins/tinymce-a11y-checker/rules/large-text-contrast.js +9 -0
  14. package/es/rce/plugins/tinymce-a11y-checker/rules/small-text-contrast.js +9 -0
  15. package/es/translations/locales/da-x-k12.js +39 -0
  16. package/es/translations/locales/de.js +4 -4
  17. package/es/translations/locales/fi.js +39 -0
  18. package/es/translations/locales/nb-x-k12.js +39 -0
  19. package/es/translations/locales/sv-x-k12.js +39 -0
  20. package/es/util/encrypted-storage.js +84 -0
  21. package/jest/jest-setup.js +5 -3
  22. package/jest.config.js +1 -0
  23. package/lib/enhance-user-content/mathml.js +8 -5
  24. package/lib/rce/RCEWrapper.js +65 -6
  25. package/lib/rce/RCEWrapperProps.js +1 -0
  26. package/lib/rce/__mocks__/_mockCryptoEs.js +124 -0
  27. package/lib/rce/plugins/instructure_equation/EquationEditorModal/parseLatex.js +0 -2
  28. package/lib/rce/plugins/instructure_rce_external_tools/components/ExternalToolDialog/ExternalToolDialogModal.js +4 -5
  29. package/lib/rce/plugins/shared/CanvasContentTray.js +8 -8
  30. package/lib/rce/plugins/shared/ContentSelection.js +7 -3
  31. package/lib/rce/plugins/shared/ImageCropper/Preview.js +8 -7
  32. package/lib/rce/plugins/shared/LinkDisplay.js +2 -2
  33. package/lib/rce/plugins/tinymce-a11y-checker/rules/large-text-contrast.js +9 -0
  34. package/lib/rce/plugins/tinymce-a11y-checker/rules/small-text-contrast.js +9 -0
  35. package/lib/translations/locales/da-x-k12.js +39 -0
  36. package/lib/translations/locales/de.js +4 -4
  37. package/lib/translations/locales/fi.js +39 -0
  38. package/lib/translations/locales/nb-x-k12.js +39 -0
  39. package/lib/translations/locales/sv-x-k12.js +39 -0
  40. package/lib/util/encrypted-storage.js +84 -0
  41. package/package.json +5 -5
  42. package/es/rce/getBrowser.js +0 -53
  43. package/lib/rce/getBrowser.js +0 -53
package/.mocharc.js CHANGED
@@ -15,6 +15,13 @@
15
15
  * You should have received a copy of the GNU Affero General Public License along
16
16
  * with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
+
19
+ global.MutationObserver = class {
20
+ disconnect() {}
21
+
22
+ observe() {}
23
+ }
24
+
18
25
  module.exports = {
19
26
  require: [
20
27
  '@instructure/canvas-theme',
package/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 5.10.0 - 2023-09-26
9
+
10
+ ### Fixed
11
+ - An issue where media controls don't respond in Safari
12
+ - An issue where embedded Studio videos cause unresponsiveness
13
+ - A potential race condition in postMessage forwarding
14
+
15
+ ### Changed
16
+ - Ignore a11y check on elements with a background image or gradient
17
+ - Remove math processing percentage indicator
18
+
19
+ ## 5.9.0 - 2023-08-30
20
+
21
+ ### Fixed
22
+ - An issue where LTI postMessages were not working inside active RCE
23
+
24
+ ### Changed
25
+ - Encrypt auto-saved RCE content
26
+ - Remove dependency on `@instructure/filter-console-messages`
27
+
8
28
  ## 5.8.0 - 2023-08-15
9
29
 
10
30
  ### Fixed
@@ -45,7 +45,8 @@ const localConfig = {
45
45
  }
46
46
  }
47
47
  },
48
- showMathMenu: true
48
+ showMathMenu: true,
49
+ messageStyle: 'none'
49
50
  };
50
51
 
51
52
  class Mathml {
@@ -106,7 +107,7 @@ class Mathml {
106
107
  window.MathJax.Hub.Register.MessageHook('Math Processing Error', function (message) {
107
108
  var _elem$parentElement;
108
109
 
109
- const elem = message[1]; // ".math_equation_latex" is the elem we added for MathJax to typeset the image equation
110
+ const elem = Array.isArray(message[1]) ? message[1][0] : message[1]; // ".math_equation_latex" is the elem we added for MathJax to typeset the image equation
110
111
 
111
112
  if ((_elem$parentElement = elem.parentElement) !== null && _elem$parentElement !== void 0 && _elem$parentElement.classList.contains('math_equation_latex')) {
112
113
  var _elem$parentElement$p;
@@ -123,7 +124,7 @@ class Mathml {
123
124
  }
124
125
  });
125
126
  window.MathJax.Hub.Register.MessageHook('End Math', function (message) {
126
- const elem = message[1];
127
+ const elem = Array.isArray(message[1]) ? message[1][0] : message[1];
127
128
  mathImageHelper.removeStrayEquationImages(elem);
128
129
  mathImageHelper.nearlyInfiniteStyleFix(elem);
129
130
  elem.querySelectorAll('.math_equation_latex').forEach(m => m.classList.add('fade-in-equation'));
@@ -138,7 +139,8 @@ class Mathml {
138
139
  // Since we want to ignore <math> in .hidden-readable spans, let's remove the MathJunk™
139
140
  // right after MathJax adds it.
140
141
  window.MathJax.Hub.Register.MessageHook('End Math', function (message) {
141
- $(message[1]).find('.hidden-readable [class^="MathJax"], .hidden-readable [id^="MathJax"]').remove();
142
+ const elm = Array.isArray(message[1]) ? message[1][0] : message[1];
143
+ $(elm).find('.hidden-readable [class^="MathJax"], .hidden-readable [id^="MathJax"]').remove();
142
144
  });
143
145
  } // leaving this here so I don't have to keep looking up how to see all messages
144
146
  // window.MathJax.Hub.Startup.signal.Interest(function (message) {
@@ -315,7 +317,8 @@ const mathImageHelper = {
315
317
  },
316
318
 
317
319
  catchEquationImages(refnode) {
318
- // find equation images and replace with inline LaTeX
320
+ refnode = Array.isArray(refnode) ? refnode[0] : refnode; // find equation images and replace with inline LaTeX
321
+
319
322
  const eqimgs = refnode.querySelectorAll('img.equation_image');
320
323
 
321
324
  if (eqimgs.length > 0) {
@@ -2373,6 +2373,7 @@ import { rceWrapperPropTypes } from './RCEWrapperProps';
2373
2373
  import { insertPlaceholder, placeholderInfoFor, removePlaceholder } from '../util/loadingPlaceholder';
2374
2374
  import { transformRceContentForEditing } from './transformContent';
2375
2375
  import { IconMoreSolid } from '@instructure/ui-icons/es/svg';
2376
+ import EncryptedStorage from '../util/encrypted-storage';
2376
2377
  import buildStyle from './style';
2377
2378
  const RestoreAutoSaveModal = /*#__PURE__*/React.lazy(() => import('./RestoreAutoSaveModal'));
2378
2379
  const RceHtmlEditor = /*#__PURE__*/React.lazy(() => import('./RceHtmlEditor'));
@@ -2713,9 +2714,67 @@ class RCEWrapper extends React.Component {
2713
2714
 
2714
2715
  this.checkAccessibility();
2715
2716
  this.fixToolbarKeyboardNavigation();
2717
+ this.forwardPostMessages();
2716
2718
  (_this$props$onInitted = (_this$props = this.props).onInitted) === null || _this$props$onInitted === void 0 ? void 0 : _this$props$onInitted.call(_this$props, editor);
2717
2719
  };
2718
2720
 
2721
+ this.forwardPostMessages = () => {
2722
+ const windowReferences = [];
2723
+ const rceWindow = this.editor.getWin(); // explicitly assign name for reference by parent window
2724
+
2725
+ rceWindow.name = `${RCEWrapper.editorFrameName}_${this.id}`;
2726
+ rceWindow.addEventListener('message', this.forwardPostMessagesHandler(rceWindow, windowReferences));
2727
+ };
2728
+
2729
+ this.forwardPostMessagesHandler = (rceWindow, windowReferences) => e => {
2730
+ let message;
2731
+
2732
+ try {
2733
+ message = typeof e.data === 'string' ? JSON.parse(e.data) : e.data;
2734
+ } catch (err) {
2735
+ // unparseable message may not be meant for our handlers
2736
+ return false;
2737
+ } // NOTE: the code to encode/decode `sourceToolInfo` is duplicated in
2738
+ // the ui/features/post_message_forwarding/index.ts, and
2739
+ // cannot be DRY'd because RCE is in a package
2740
+
2741
+
2742
+ if (e.origin === rceWindow.origin) {
2743
+ const {
2744
+ sourceToolInfo,
2745
+ ...messageWithoutSourceToolInfo
2746
+ } = message;
2747
+ const targetOrigin = sourceToolInfo === null || sourceToolInfo === void 0 ? void 0 : sourceToolInfo.origin;
2748
+ const targetWindow = windowReferences[sourceToolInfo === null || sourceToolInfo === void 0 ? void 0 : sourceToolInfo.windowId];
2749
+
2750
+ if (!targetOrigin || !targetWindow) {
2751
+ return false;
2752
+ }
2753
+
2754
+ targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.postMessage(messageWithoutSourceToolInfo, targetOrigin);
2755
+ } else {
2756
+ // message is from tool, forward to Canvas window
2757
+ // We can't forward the whole `e.source` window in the postMessage,
2758
+ // so we keep a list (`windowReferences`) of all windows we've received
2759
+ // messages from, and include the index into that list as `windowId`
2760
+ let windowId = windowReferences.indexOf(e.source);
2761
+
2762
+ if (windowId === -1) {
2763
+ windowReferences.push(e.source);
2764
+ windowId = windowReferences.length - 1;
2765
+ }
2766
+
2767
+ const newMessage = { ...message,
2768
+ sourceToolInfo: {
2769
+ origin: e.origin,
2770
+ windowId
2771
+ },
2772
+ frameName: rceWindow.name
2773
+ };
2774
+ rceWindow.parent.postMessage(newMessage, rceWindow.origin);
2775
+ }
2776
+ };
2777
+
2719
2778
  this.fixToolbarKeyboardNavigation = () => {
2720
2779
  var _this$_elementRef$cur2;
2721
2780
 
@@ -2787,7 +2846,9 @@ class RCEWrapper extends React.Component {
2787
2846
  this.announcing = 0;
2788
2847
 
2789
2848
  this.initAutoSave = editor => {
2790
- this.storage = window.localStorage;
2849
+ var _this$props$userCache;
2850
+
2851
+ this.storage = new EncryptedStorage((_this$props$userCache = this.props.userCacheKey) !== null && _this$props$userCache !== void 0 ? _this$props$userCache : '');
2791
2852
 
2792
2853
  if (this.storage) {
2793
2854
  editor.on('change Undo Redo', this.doAutoSave);
@@ -2875,10 +2936,7 @@ class RCEWrapper extends React.Component {
2875
2936
  });
2876
2937
 
2877
2938
  try {
2878
- _this.storage.setItem(_this.autoSaveKey, JSON.stringify({
2879
- autosaveTimestamp: Date.now(),
2880
- content
2881
- }));
2939
+ _this.storage.setItem(_this.autoSaveKey, content);
2882
2940
  } catch (ex) {
2883
2941
  if (!retry) {
2884
2942
  // probably failed because there's not enough space
@@ -3733,7 +3791,7 @@ class RCEWrapper extends React.Component {
3733
3791
  let autosaved = null;
3734
3792
 
3735
3793
  try {
3736
- autosaved = this.storage && JSON.parse(this.storage.getItem(key));
3794
+ autosaved = this.storage && this.storage.getItem(key);
3737
3795
  } catch (_ex) {
3738
3796
  this.storage.removeItem(this.autoSaveKey);
3739
3797
  }
@@ -4199,6 +4257,7 @@ RCEWrapper.defaultProps = {
4199
4257
  canvasOrigin: ''
4200
4258
  };
4201
4259
  RCEWrapper.skinCssInjected = false;
4260
+ RCEWrapper.editorFrameName = 'active_rce_frame';
4202
4261
 
4203
4262
  function mergeMenuItems(standard, custom) {
4204
4263
  var _custom$trim;
@@ -125,5 +125,6 @@ export const rceWrapperPropTypes = {
125
125
  features: PropTypes.objectOf(PropTypes.bool),
126
126
  flashAlertTimeout: PropTypes.number,
127
127
  timezone: PropTypes.string,
128
+ userCacheKey: PropTypes.string,
128
129
  externalToolsConfig: externalToolsConfigPropType
129
130
  };
@@ -0,0 +1,124 @@
1
+ /*
2
+ * Copyright (C) 2023 - present Instructure, Inc.
3
+ *
4
+ * This file is part of Canvas.
5
+ *
6
+ * Canvas is free software: you can redistribute it and/or modify it under
7
+ * the terms of the GNU Affero General Public License as published by the Free
8
+ * Software Foundation, version 3 of the License.
9
+ *
10
+ * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
11
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
+ * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
+ * details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along
16
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ export default {
19
+ lib: {
20
+ Base: {},
21
+ WordArray: {},
22
+ BufferedBlockAlgorithm: {},
23
+ Hasher: {},
24
+ Cipher: {},
25
+ StreamCipher: {},
26
+ BlockCipherMode: {},
27
+ BlockCipher: {},
28
+ CipherParams: {},
29
+ SerializableCipher: {},
30
+ PasswordBasedCipher: {}
31
+ },
32
+ x64: {
33
+ Word: {},
34
+ WordArray: {}
35
+ },
36
+ enc: {
37
+ Hex: {},
38
+ Latin1: {},
39
+ Utf8: {
40
+ parse: () => {}
41
+ },
42
+ Utf16: {},
43
+ Utf16BE: {},
44
+ Utf16LE: {},
45
+ Base64: {},
46
+ Base64url: {}
47
+ },
48
+ algo: {
49
+ HMAC: {},
50
+ MD5: {},
51
+ SHA1: {},
52
+ SHA224: {},
53
+ SHA256: {},
54
+ SHA384: {},
55
+ SHA512: {},
56
+ SHA3: {},
57
+ RIPEMD160: {},
58
+ PBKDF2: {},
59
+ EvpKDF: {},
60
+ AES: {},
61
+ DES: {},
62
+ TripleDES: {},
63
+ Rabbit: {},
64
+ RabbitLegacy: {},
65
+ RC4: {},
66
+ RC4Drop: {},
67
+ Blowfish: {}
68
+ },
69
+ mode: {
70
+ CBC: {},
71
+ CFB: {},
72
+ CTR: {},
73
+ CTRGladman: {},
74
+ ECB: {},
75
+ OFB: {}
76
+ },
77
+ pad: {
78
+ Pkcs7: {},
79
+ AnsiX923: {},
80
+ Iso10126: {},
81
+ Iso97971: {},
82
+ NoPadding: {},
83
+ ZeroPadding: {}
84
+ },
85
+ format: {
86
+ OpenSSL: {},
87
+ Hex: {}
88
+ },
89
+ kdf: {
90
+ OpenSSL: {}
91
+ },
92
+ MD5: {},
93
+ HmacMD5: {},
94
+ SHA1: {},
95
+ HmacSHA1: {},
96
+ SHA224: {},
97
+ HmacSHA224: {},
98
+ SHA256: {},
99
+ HmacSHA256: {},
100
+ SHA384: {},
101
+ HmacSHA384: {},
102
+ SHA512: {},
103
+ HmacSHA512: {},
104
+ SHA3: {},
105
+ HmacSHA3: {},
106
+ RIPEMD160: {},
107
+ HmacRIPEMD160: {},
108
+ PBKDF2: {},
109
+ EvpKDF: {},
110
+ AES: {},
111
+ DES: {},
112
+ TripleDES: {},
113
+ Rabbit: {},
114
+ RabbitLegacy: {},
115
+ RC4: {
116
+ encrypt: () => {},
117
+ decrypt: () => {}
118
+ },
119
+ RC4Drop: {
120
+ encrypt: () => {},
121
+ decrypt: () => {}
122
+ },
123
+ Blowfish: {}
124
+ };
@@ -68,8 +68,6 @@ export const parseLatex = editor => {
68
68
  };
69
69
  } catch (ex) {
70
70
  // probably failed to create the new URL
71
- // eslint-disable-next-line no-console
72
- console.error(ex);
73
71
  return {};
74
72
  }
75
73
  } else if (wholeText) {
@@ -18,7 +18,6 @@
18
18
  * with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
  */
20
20
  import React from 'react';
21
- import { Flex } from '@instructure/ui-flex';
22
21
  import { Heading } from '@instructure/ui-heading';
23
22
  import { CloseButton } from '@instructure/ui-buttons';
24
23
  import { View } from '@instructure/ui-view';
@@ -33,12 +32,12 @@ export function ExternalToolDialogModal(props) {
33
32
  onOpen: props.onOpen,
34
33
  onClose: props.onClose,
35
34
  mountNode: props.mountNode
36
- }, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(Flex.Item, {
37
- grow: true
38
- }, /*#__PURE__*/React.createElement(Heading, null, props.name)), /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(CloseButton, {
35
+ }, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement(Heading, null, props.name), /*#__PURE__*/React.createElement(CloseButton, {
36
+ placement: "end",
37
+ offset: "medium",
39
38
  onClick: props.onCloseButton,
40
39
  screenReaderLabel: formatMessage('Close')
41
- })))), /*#__PURE__*/React.createElement(Modal.Body, {
40
+ })), /*#__PURE__*/React.createElement(Modal.Body, {
42
41
  padding: "0"
43
42
  }, /*#__PURE__*/React.createElement(View, {
44
43
  as: "div",
@@ -22,6 +22,7 @@ import { CloseButton, Button } from '@instructure/ui-buttons';
22
22
  import { Heading } from '@instructure/ui-heading';
23
23
  import { Spinner } from '@instructure/ui-spinner';
24
24
  import { Flex } from '@instructure/ui-flex';
25
+ import { View } from '@instructure/ui-view';
25
26
  import ErrorBoundary from './ErrorBoundary';
26
27
  import Bridge from '../../../bridge/Bridge';
27
28
  import formatMessage from '../../../format-message';
@@ -463,19 +464,18 @@ export default function CanvasContentTray(props) {
463
464
  }, /*#__PURE__*/React.createElement(Flex.Item, {
464
465
  padding: "medium",
465
466
  shadow: "above"
466
- }, /*#__PURE__*/React.createElement(Flex, {
467
+ }, /*#__PURE__*/React.createElement(View, {
468
+ as: "div",
467
469
  margin: "none none medium none"
468
- }, /*#__PURE__*/React.createElement(Flex.Item, {
469
- shouldgrow: true,
470
- shouldshrink: true
471
470
  }, /*#__PURE__*/React.createElement(Heading, {
472
471
  level: "h2"
473
- }, getHeader())), /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(CloseButton, {
472
+ }, getHeader()), /*#__PURE__*/React.createElement(CloseButton, {
474
473
  placement: "end",
474
+ offset: "medium",
475
475
  onClick: handleDismissTray,
476
476
  "data-testid": "CloseButton_ContentTray",
477
477
  screenReaderLabel: formatMessage('Close')
478
- }))), isEditTray && /*#__PURE__*/React.createElement(LinkDisplay, {
478
+ })), isEditTray && /*#__PURE__*/React.createElement(LinkDisplay, {
479
479
  linkText: linkText,
480
480
  placeholderText: (link === null || link === void 0 ? void 0 : link.title) || placeholderText,
481
481
  linkFileName: (link === null || link === void 0 ? void 0 : link.title) || '',
@@ -492,8 +492,8 @@ export default function CanvasContentTray(props) {
492
492
  isContentLoading: isLoading(storeProps),
493
493
  use_rce_icon_maker: props.use_rce_icon_maker
494
494
  }))), /*#__PURE__*/React.createElement(Flex.Item, {
495
- grow: true,
496
- shrink: true,
495
+ shouldGrow: true,
496
+ shouldShrink: true,
497
497
  margin: "xx-small xxx-small 0",
498
498
  elementRef: el => scrollingAreaRef.current = el
499
499
  }, /*#__PURE__*/React.createElement(Flex, {
@@ -32,7 +32,7 @@ export const DISPLAY_AS_EMBED = 'embed';
32
32
  export const DISPLAY_AS_EMBED_DISABLED = 'embed-disabled';
33
33
  export const DISPLAY_AS_DOWNLOAD_LINK = 'download-link';
34
34
  export function asImageEmbed($element) {
35
- const nodeName = $element.nodeName.toLowerCase();
35
+ const nodeName = $element === null || $element === void 0 ? void 0 : $element.nodeName.toLowerCase();
36
36
 
37
37
  if (nodeName !== 'img') {
38
38
  return null;
@@ -44,9 +44,11 @@ export function asImageEmbed($element) {
44
44
  };
45
45
  }
46
46
  export function asLink($element, editor) {
47
+ var _$link;
48
+
47
49
  let $link = $element;
48
50
 
49
- if ($link.tagName !== 'A') {
51
+ if (((_$link = $link) === null || _$link === void 0 ? void 0 : _$link.tagName) !== 'A') {
50
52
  // the user may have selected some text that is w/in a link
51
53
  // but didn't include the <a>. Let's see if that's true
52
54
  $link = editor.dom.getParent($link, 'a[href]');
@@ -213,7 +215,7 @@ function isMediaElement($element, mediaType) {
213
215
 
214
216
  // the video is hosted in an iframe, but tinymce
215
217
  // wraps it in a span with swizzled attribute names
216
- if (!($element !== null && $element !== void 0 && $element.getAttribute)) {
218
+ if (!($element !== null && $element !== void 0 && $element.getAttribute) || !$element) {
217
219
  return false;
218
220
  }
219
221
 
@@ -242,6 +244,8 @@ export function isAudioElement($element) {
242
244
  export function findMediaPlayerIframe(elem) {
243
245
  var _elem$firstElementChi;
244
246
 
247
+ if (!elem) return null;
248
+
245
249
  if (elem.tagName === 'IFRAME') {
246
250
  // we have the iframe
247
251
  return elem;
@@ -25,7 +25,6 @@ import { useMouseWheel } from './useMouseWheel';
25
25
  import { useKeyMouseTouchEvents } from './useKeyMouseEvents';
26
26
  import checkerboardStyle from '../CheckerboardStyling';
27
27
  import { View } from '@instructure/ui-view';
28
- import { getBrowser } from '../../../getBrowser';
29
28
  /**
30
29
  * Remove the node contents and append the svg element.
31
30
  */
@@ -86,17 +85,19 @@ export const Preview = _ref2 => {
86
85
  translateY: tempTranslateY,
87
86
  rotation,
88
87
  scaleRatio: tempScaleRatio
89
- }); // Clip is not supported in Safari until v16.
88
+ });
89
+
90
+ function isSafariVersion15OrLesser() {
91
+ const match = /Version\/(\d+).+Safari/.exec(navigator.userAgent);
92
+ return match ? parseInt(match[1], 10) < 16 : false;
93
+ } // Clip is not supported in Safari until v16.
90
94
  // It's needed here to prevent a strange screenreader
91
95
  // behavior that makes the cropper look bad. 'hidden'
92
96
  // suffices when clip is not available, although it's not perfect
93
97
  // TODO: remove when Safari versions >= 16 are more commonplace
94
98
 
95
- const {
96
- name,
97
- version
98
- } = getBrowser();
99
- const overflow = name === 'Safari' && parseFloat(version) < 16 ? 'hidden' : 'clip';
99
+
100
+ const overflow = isSafariVersion15OrLesser() ? 'hidden' : 'clip';
100
101
  return /*#__PURE__*/React.createElement("div", {
101
102
  style: {
102
103
  justifyContent: 'center',
@@ -81,8 +81,8 @@ export const LinkDisplay = _ref => {
81
81
  size: "x-small"
82
82
  }))), /*#__PURE__*/React.createElement(Flex.Item, {
83
83
  padding: "0 x-small 0 0",
84
- grow: true,
85
- shrink: true,
84
+ shouldGrow: true,
85
+ shouldShrink: true,
86
86
  textAlign: "start"
87
87
  }, /*#__PURE__*/React.createElement(View, {
88
88
  as: "div"
@@ -30,6 +30,15 @@ export default {
30
30
  return true;
31
31
  }
32
32
 
33
+ for (let e = elem; e; e = e.parentElement) {
34
+ const bgimage = window.getComputedStyle(e).getPropertyValue('background-image');
35
+
36
+ if (bgimage !== 'none' && bgimage !== '') {
37
+ // ignore background images and gradients
38
+ return true;
39
+ }
40
+ }
41
+
33
42
  return contrast(elem);
34
43
  },
35
44
  data: smallTextContrast.data,
@@ -32,6 +32,15 @@ export default {
32
32
  return true;
33
33
  }
34
34
 
35
+ for (let e = elem; e; e = e.parentElement) {
36
+ const bgimage = window.getComputedStyle(e).getPropertyValue('background-image');
37
+
38
+ if (bgimage !== 'none' && bgimage !== '') {
39
+ // ignore background images and gradients
40
+ return true;
41
+ }
42
+ }
43
+
35
44
  return contrast(elem);
36
45
  },
37
46
  data: elem => {
@@ -45,6 +45,9 @@ const locale = {
45
45
  "add_image_60b2de07": {
46
46
  "message": "Tilføj billede"
47
47
  },
48
+ "add_one_9e34a6f8": {
49
+ "message": "Tilføj en!"
50
+ },
48
51
  "additional_considerations_f3801683": {
49
52
  "message": "Yderligere overvejelser"
50
53
  },
@@ -1323,9 +1326,27 @@ const locale = {
1323
1326
  "no_accessibility_issues_were_detected_f8d3c875": {
1324
1327
  "message": "Der blev ikke fundet nogen tilgængelighedsproblemer."
1325
1328
  },
1329
+ "no_announcements_created_yet_c44a94f4": {
1330
+ "message": "Der er ikke oprettet beskeder endnu."
1331
+ },
1332
+ "no_announcements_found_20185afc": {
1333
+ "message": "Ingen beskeder fundet."
1334
+ },
1335
+ "no_assignments_created_yet_1b236d87": {
1336
+ "message": "Der er ikke oprettet opgaver endnu."
1337
+ },
1338
+ "no_assignments_found_79e46d7f": {
1339
+ "message": "Ingen opgaver fundet."
1340
+ },
1326
1341
  "no_changes_to_save_d29f6e91": {
1327
1342
  "message": "Ingen ændringer at gemme."
1328
1343
  },
1344
+ "no_discussions_created_yet_ff99abe3": {
1345
+ "message": "Der er ikke oprettet diskussioner endnu."
1346
+ },
1347
+ "no_discussions_found_9284063b": {
1348
+ "message": "Ingen diskussioner fundet."
1349
+ },
1329
1350
  "no_e16d9132": {
1330
1351
  "message": "Nej"
1331
1352
  },
@@ -1335,9 +1356,27 @@ const locale = {
1335
1356
  "no_headers_9bc7dc7f": {
1336
1357
  "message": "Ingen overskrifter"
1337
1358
  },
1359
+ "no_modules_created_yet_c71b6d4d": {
1360
+ "message": "Der er ikke oprettet forløb endnu."
1361
+ },
1362
+ "no_modules_found_2df43a40": {
1363
+ "message": "Ingen forløb fundet."
1364
+ },
1365
+ "no_pages_created_yet_c379fa6e": {
1366
+ "message": "Der er ikke oprettet sider endnu."
1367
+ },
1368
+ "no_pages_found_6799350": {
1369
+ "message": "Ingen sider fundet."
1370
+ },
1338
1371
  "no_preview_is_available_for_this_file_f940114a": {
1339
1372
  "message": "Der findes ikke forhåndsvisning for denne fil."
1340
1373
  },
1374
+ "no_quizzes_created_yet_1a2370b9": {
1375
+ "message": "Der er ikke oprettet nogen quizzer endnu."
1376
+ },
1377
+ "no_quizzes_found_c80c537a": {
1378
+ "message": "Der er ikke fundet nogen quizzer."
1379
+ },
1341
1380
  "no_results_940393cf": {
1342
1381
  "message": "Ingen resultater."
1343
1382
  },
@@ -373,7 +373,7 @@ const locale = {
373
373
  "message": "{ count, plural,\n one {# Objekt geladen}\n other {# Objekte geladen}\n}"
374
374
  },
375
375
  "course_documents_104d76e0": {
376
- "message": "Kursunterlagen"
376
+ "message": "Kursdokumente"
377
377
  },
378
378
  "course_files_62deb8f8": {
379
379
  "message": "Kursdateien"
@@ -2278,16 +2278,16 @@ const locale = {
2278
2278
  "message": "Wird von Screenreadern verwendet, um das Video zu beschreiben."
2279
2279
  },
2280
2280
  "user_documents_c206e61f": {
2281
- "message": "Benutzer*in Dokumente"
2281
+ "message": "Meine Dokumente"
2282
2282
  },
2283
2283
  "user_files_78e21703": {
2284
2284
  "message": "Benutzerdateien"
2285
2285
  },
2286
2286
  "user_images_b6490852": {
2287
- "message": "Benutzerbilder"
2287
+ "message": "Meine Bilder"
2288
2288
  },
2289
2289
  "user_media_14fbf656": {
2290
- "message": "Nutzer-Medien"
2290
+ "message": "Meine Medien"
2291
2291
  },
2292
2292
  "vector_notation_cf6086ab": {
2293
2293
  "message": "Vektor (Notation)"