@oat-sa/tao-core-ui 3.1.0 → 3.2.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.
@@ -909,7 +909,7 @@ define(['jquery', 'lodash', 'i18n', 'util/capitalize', 'ui/tooltip', 'jquery.aut
909
909
  * @returns {autocompleter} Returns the instance of the autocompleter component
910
910
  */
911
911
  function autocompleteFactory(element, options) {
912
- var autocomplete = _.clone(autocompleter, true);
912
+ var autocomplete = _.cloneDeep(autocompleter);
913
913
  _.defaults(autocomplete, defaults);
914
914
  return autocomplete.init(element, options);
915
915
  }
@@ -328,9 +328,9 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'mo
328
328
  }
329
329
  options = options || {};
330
330
  options.resourcemgr = options.resourcemgr || {};
331
- toolbars = _.clone(toolbarPresets, true);
331
+ toolbars = _.cloneDeep(toolbarPresets);
332
332
  dtdMode = options.dtdMode || 'html';
333
- const ckConfig = _.clone(ckConfigDefault, true);
333
+ const ckConfig = _.cloneDeep(ckConfigDefault);
334
334
 
335
335
  // modify DTD to either comply with QTI or XHTML
336
336
  if (dtdMode === 'qti' || toolbarType.indexOf('qti') === 0) {
@@ -449,19 +449,39 @@ define(['jquery', 'lodash', 'i18n', 'core/eventifier', 'core/polling', 'core/dat
449
449
  if (!config.url || !config.url.download) {
450
450
  throw new TypeError('config.url.download is not configured while download() is being called');
451
451
  }
452
- return new Promise(function (resolve, reject) {
453
- $.fileDownload(config.url.download, {
454
- httpMethod: 'POST',
455
- data: {
456
- taskId: taskId
457
- },
458
- successCallback: function (result) {
459
- resolve(result);
460
- },
461
- failCallback: function (err) {
462
- reject(err);
463
- }
464
- });
452
+ return this.getCached(taskId).then(function (taskData) {
453
+ let redirectUrl = (taskData || {}).redirectUrl;
454
+ if (redirectUrl) {
455
+ return new Promise(function (resolve) {
456
+ $.fileDownload(redirectUrl, {
457
+ httpMethod: 'GET',
458
+ data: {},
459
+ successCallback: function (result) {
460
+ resolve(result);
461
+ },
462
+ failCallback: function (err) {
463
+ resolve(err);
464
+ // Security issue : Failed to read a named property 'document' from 'Window':
465
+ // Blocked a frame with origin "https://[domain]" from accessing a cross-origin frame.
466
+ }
467
+ });
468
+ });
469
+ } else {
470
+ return new Promise(function (resolve, reject) {
471
+ $.fileDownload(config.url.download, {
472
+ httpMethod: 'POST',
473
+ data: {
474
+ taskId: taskId
475
+ },
476
+ successCallback: function (result) {
477
+ resolve(result);
478
+ },
479
+ failCallback: function (err) {
480
+ reject(err);
481
+ }
482
+ });
483
+ });
484
+ }
465
485
  });
466
486
  },
467
487
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -1019,7 +1019,7 @@ function toBoolean(value) {
1019
1019
  * @returns {autocompleter} Returns the instance of the autocompleter component
1020
1020
  */
1021
1021
  function autocompleteFactory(element, options) {
1022
- var autocomplete = _.clone(autocompleter, true);
1022
+ var autocomplete = _.cloneDeep(autocompleter);
1023
1023
  _.defaults(autocomplete, defaults);
1024
1024
  return autocomplete.init(element, options);
1025
1025
  }
@@ -601,10 +601,10 @@ const ckConfigurator = (function () {
601
601
 
602
602
  options.resourcemgr = options.resourcemgr || {};
603
603
 
604
- toolbars = _.clone(toolbarPresets, true);
604
+ toolbars = _.cloneDeep(toolbarPresets);
605
605
  dtdMode = options.dtdMode || 'html';
606
606
 
607
- const ckConfig = _.clone(ckConfigDefault, true);
607
+ const ckConfig = _.cloneDeep(ckConfigDefault);
608
608
 
609
609
  // modify DTD to either comply with QTI or XHTML
610
610
  if (dtdMode === 'qti' || toolbarType.indexOf('qti') === 0) {
@@ -496,17 +496,40 @@ export default function taskQueueModel(config) {
496
496
  throw new TypeError('config.url.download is not configured while download() is being called');
497
497
  }
498
498
 
499
- return new Promise(function(resolve, reject) {
500
- $.fileDownload(config.url.download, {
501
- httpMethod: 'POST',
502
- data: { taskId: taskId },
503
- successCallback: function(result) {
504
- resolve(result);
505
- },
506
- failCallback: function(err) {
507
- reject(err);
508
- }
509
- });
499
+ return this.getCached(taskId).then(function (taskData) {
500
+ let redirectUrl = (taskData || {}).redirectUrl;
501
+
502
+ if (redirectUrl) {
503
+ return new Promise(function (resolve) {
504
+ $.fileDownload(redirectUrl, {
505
+ httpMethod: 'GET',
506
+ data: {},
507
+ successCallback: function (result) {
508
+ resolve(result);
509
+ },
510
+ failCallback: function (err) {
511
+ resolve(err);
512
+ // Security issue : Failed to read a named property 'document' from 'Window':
513
+ // Blocked a frame with origin "https://[domain]" from accessing a cross-origin frame.
514
+ }
515
+ });
516
+ });
517
+ } else {
518
+ return new Promise(function (resolve, reject) {
519
+ $.fileDownload(config.url.download, {
520
+ httpMethod: 'POST',
521
+ data: {
522
+ taskId: taskId
523
+ },
524
+ successCallback: function (result) {
525
+ resolve(result);
526
+ },
527
+ failCallback: function (err) {
528
+ reject(err);
529
+ }
530
+ });
531
+ });
532
+ }
510
533
  });
511
534
  },
512
535