@oat-sa/tao-core-ui 3.19.0 → 3.19.2

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.
@@ -216,6 +216,39 @@ define(['jquery', 'util/urlParser', 'core/eventifier', 'ui/mediaplayer/support',
216
216
  }
217
217
  return (config.debug === true || config.debug === action) && window.console.log(getDebugContext(action), ...args);
218
218
  };
219
+ const isVerticalLayout = () => {
220
+ const $layoutContext = $container.closest('.qti-interaction, .custom-text-box');
221
+ return ($$1('body').hasClass('item-writing-mode-vertical-rl') || $layoutContext.hasClass('writing-mode-vertical-rl')) && !$layoutContext.hasClass('writing-mode-horizontal-tb');
222
+ };
223
+ const applyVideoSizing = () => {
224
+ if (type !== 'video' || !$media || !$media.length) {
225
+ return;
226
+ }
227
+ $container.css({
228
+ display: 'flex',
229
+ alignItems: 'center',
230
+ justifyContent: 'center',
231
+ overflow: 'hidden'
232
+ });
233
+ $media.css({
234
+ width: '100%',
235
+ height: '100%',
236
+ maxWidth: '100%',
237
+ maxHeight: '100%',
238
+ margin: '0 auto',
239
+ objectFit: 'contain',
240
+ objectPosition: 'center center',
241
+ boxSizing: 'border-box'
242
+ });
243
+ if (isVerticalLayout()) {
244
+ $media.css({
245
+ width: 'auto',
246
+ height: '100%',
247
+ maxWidth: 'none',
248
+ maxHeight: '100%'
249
+ });
250
+ }
251
+ };
219
252
  return eventifier({
220
253
  init() {
221
254
  const tpl = 'audio' === type ? audioTpl : videoTpl;
@@ -244,6 +277,7 @@ define(['jquery', 'util/urlParser', 'core/eventifier', 'ui/mediaplayer/support',
244
277
  link
245
278
  }));
246
279
  $container.append($media);
280
+ applyVideoSizing();
247
281
  media = $media.get(0);
248
282
  result = !!(media && support.checkSupport(media));
249
283
 
@@ -433,10 +467,7 @@ define(['jquery', 'util/urlParser', 'core/eventifier', 'ui/mediaplayer/support',
433
467
  $media.height($media.height());
434
468
  $media.on('loadedmetadata.recover', () => {
435
469
  $media.off('loadedmetadata.recover');
436
- $media.css({
437
- width: '',
438
- height: ''
439
- });
470
+ applyVideoSizing();
440
471
  });
441
472
  }
442
473
  media.load();
@@ -1804,7 +1804,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
1804
1804
  return acc;
1805
1805
  }
1806
1806
  function reduceNodes(nodeList) {
1807
- return _.sortBy(nodeList, ['label']).reduce(reduceNode, '');
1807
+ return _.sortBy(nodeList, ['type', 'label']).reduce(reduceNode, '');
1808
1808
  }
1809
1809
  if (this.is('rendered')) {
1810
1810
  $component = this.getElement();