@oat-sa/tao-core-ui 1.63.1 → 1.64.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 (101) hide show
  1. package/dist/actionbar.js +2 -109
  2. package/dist/animable/absorbable/absorbable.js +2 -109
  3. package/dist/animable/pulsable/pulsable.js +2 -109
  4. package/dist/badge/badge.js +2 -109
  5. package/dist/breadcrumbs.js +2 -109
  6. package/dist/bulkActionPopup.js +2 -108
  7. package/dist/button.js +2 -110
  8. package/dist/cascadingComboBox.js +2 -108
  9. package/dist/class/selector.js +2 -108
  10. package/dist/component/windowed.js +2 -108
  11. package/dist/component.js +2 -109
  12. package/dist/contextualPopup.js +2 -109
  13. package/dist/dashboard.js +2 -108
  14. package/dist/datalist.js +2 -108
  15. package/dist/datatable.js +3 -108
  16. package/dist/dateRange/dateRange.js +2 -108
  17. package/dist/datetime/picker.js +2 -108
  18. package/dist/deleter.js +2 -108
  19. package/dist/destination/selector.js +2 -108
  20. package/dist/dialog/confirmDelete.js +2 -108
  21. package/dist/dialog.js +2 -108
  22. package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +2 -110
  23. package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +2 -109
  24. package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +2 -110
  25. package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +2 -109
  26. package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +2 -109
  27. package/dist/documentViewer/providers/pdfViewer.js +2 -109
  28. package/dist/documentViewer.js +2 -109
  29. package/dist/dropdown.js +2 -109
  30. package/dist/dynamicComponent.js +2 -109
  31. package/dist/feedback.js +2 -109
  32. package/dist/figure/FigureStateActive.js +2 -108
  33. package/dist/filter.js +2 -108
  34. package/dist/form/dropdownForm.js +2 -108
  35. package/dist/form/form.js +2 -109
  36. package/dist/form/validator/renderer.js +2 -109
  37. package/dist/form/widget/providers/checkBox.js +2 -108
  38. package/dist/form/widget/providers/comboBox.js +2 -110
  39. package/dist/form/widget/providers/hidden.js +2 -110
  40. package/dist/form/widget/providers/hiddenBox.js +2 -108
  41. package/dist/form/widget/providers/radioBox.js +2 -110
  42. package/dist/form/widget/providers/textArea.js +2 -110
  43. package/dist/form/widget/widget.js +2 -108
  44. package/dist/generis/form/form.js +2 -108
  45. package/dist/generis/validator/validator.js +2 -109
  46. package/dist/generis/widget/checkBox/checkBox.js +2 -108
  47. package/dist/generis/widget/comboBox/comboBox.js +2 -109
  48. package/dist/generis/widget/hiddenBox/hiddenBox.js +2 -109
  49. package/dist/generis/widget/textBox/textBox.js +2 -109
  50. package/dist/generis/widget/widget.js +2 -108
  51. package/dist/groupedComboBox.js +2 -108
  52. package/dist/itemButtonList.js +2 -110
  53. package/dist/listbox.js +2 -108
  54. package/dist/loadingButton/loadingButton.js +2 -109
  55. package/dist/lock.js +2 -108
  56. package/dist/login/login.js +2 -108
  57. package/dist/maths/calculator/basicCalculator.js +2 -109
  58. package/dist/maths/calculator/core/board.js +2 -108
  59. package/dist/maths/calculator/core/expression.js +2 -109
  60. package/dist/maths/calculator/core/labels.js +2 -109
  61. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +2 -109
  62. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +2 -109
  63. package/dist/maths/calculator/scientificCalculator.js +2 -108
  64. package/dist/mediaEditor/mediaEditorComponent.js +2 -109
  65. package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +2 -109
  66. package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +2 -109
  67. package/dist/mediaplayer/players/html5.js +2 -110
  68. package/dist/mediaplayer/players/youtube.js +2 -110
  69. package/dist/mediaplayer.js +2 -109
  70. package/dist/mediasizer.js +2 -109
  71. package/dist/pageSizeSelector.js +2 -109
  72. package/dist/pagination/providers/pages.js +2 -109
  73. package/dist/pagination/providers/simple.js +2 -110
  74. package/dist/propertySelector/propertySelector.js +2 -110
  75. package/dist/report.js +2 -109
  76. package/dist/resource/filters.js +2 -108
  77. package/dist/resource/list.js +29 -119
  78. package/dist/resource/selector.js +2 -108
  79. package/dist/resource/tree.js +29 -119
  80. package/dist/resourcemgr/fileBrowser.js +478 -585
  81. package/dist/resourcemgr/fileSelector.js +2 -108
  82. package/dist/resourcemgr.js +2 -109
  83. package/dist/searchModal/advancedSearch.js +2 -109
  84. package/dist/searchModal.js +16 -107
  85. package/dist/switch/switch.js +2 -108
  86. package/dist/tabs.js +2 -109
  87. package/dist/taskQueue/status.js +2 -108
  88. package/dist/taskQueue/table.js +2 -108
  89. package/dist/taskQueueButton/taskable.js +2 -108
  90. package/dist/taskQueueButton/treeButton.js +2 -109
  91. package/dist/tooltip.js +2 -109
  92. package/dist/tristateCheckboxGroup.js +2 -108
  93. package/dist/uploader.js +2 -108
  94. package/package.json +2 -2
  95. package/scss/.DS_Store +0 -0
  96. package/scss/ckeditor/.DS_Store +0 -0
  97. package/scss/ckeditor/skins/.DS_Store +0 -0
  98. package/scss/ckeditor/skins/tao/.DS_Store +0 -0
  99. package/scss/ckeditor/skins/tao/scss/.DS_Store +0 -0
  100. package/scss/font/.DS_Store +0 -0
  101. package/scss/inc/.DS_Store +0 -0
@@ -1,117 +1,11 @@
1
- define(['lodash', 'i18n', 'ui/component', 'ui/generis/form/form', 'handlebars', 'lib/dompurify/purify'], function (_, __, component, generisFormFactory, Handlebars, DOMPurify) { 'use strict';
1
+ define(['lodash', 'i18n', 'ui/component', 'ui/generis/form/form', 'handlebars', 'lib/handlebars/helpers'], function (_, __, component, generisFormFactory, Handlebars, Helpers0) { 'use strict';
2
2
 
3
3
  _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
4
4
  __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
5
5
  component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
6
6
  generisFormFactory = generisFormFactory && Object.prototype.hasOwnProperty.call(generisFormFactory, 'default') ? generisFormFactory['default'] : generisFormFactory;
7
7
  Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
8
- DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
9
-
10
- /**
11
- * This program is free software; you can redistribute it and/or
12
- * modify it under the terms of the GNU General Public License
13
- * as published by the Free Software Foundation; under version 2
14
- * of the License (non-upgradable).
15
- *
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU General Public License
22
- * along with this program; if not, write to the Free Software
23
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24
- *
25
- * Copyright (c) 2013-2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
26
- *
27
- *
28
- */
29
- function Helpers0 (hb) {
30
- //register a i18n helper
31
- hb.registerHelper('__', function (key) {
32
- return __(key);
33
- });
34
-
35
- /**
36
- * Register dompurify helper
37
- *
38
- * https://github.com/cure53/DOMPurify
39
- * with config SAFE_FOR_TEMPLATES: true
40
- * to make output safe for template systems
41
- */
42
- hb.registerHelper('dompurify', function (context) {
43
- return DOMPurify.sanitize(context);
44
- });
45
-
46
- /**
47
- * Register join helper
48
- *
49
- * Example :
50
- * var values = {a:v1, b:v2, c:v3};
51
- * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
52
- * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
53
- */
54
- hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
55
- var fragments = [];
56
- keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
57
- fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
58
- wrapper = typeof wrapper === 'string' ? wrapper : '"';
59
- _.forIn(arr, function (value, key) {
60
- var fragment = '';
61
- if (value !== null || value !== undefined) {
62
- if (typeof value === 'boolean') {
63
- value = value ? 'true' : 'false';
64
- } else if (typeof value === 'object') {
65
- value = _.values(value).join(' ');
66
- }
67
- } else {
68
- value = '';
69
- }
70
- if (keyValueGlue !== undefined) {
71
- fragment += key + keyValueGlue;
72
- }
73
- fragment += wrapper + value + wrapper;
74
- fragments.push(fragment);
75
- });
76
- return fragments.join(fragmentGlue);
77
- });
78
-
79
- //register a classic "for loop" helper
80
- //it also adds a local variable "i" as the index in each iteration loop
81
- hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
82
- var ret = '';
83
- startIndex = parseInt(startIndex);
84
- stopIndex = parseInt(stopIndex);
85
- increment = parseInt(increment);
86
- for (var i = startIndex; i < stopIndex; i += increment) {
87
- ret += options.fn(_.extend({}, this, {
88
- i: i
89
- }));
90
- }
91
- return ret;
92
- });
93
- hb.registerHelper('equal', function (var1, var2, options) {
94
- if (var1 == var2) {
95
- return options.fn(this);
96
- } else {
97
- return options.inverse(this);
98
- }
99
- });
100
-
101
- // register a "get property" helper
102
- // it gets the named property from the provided context
103
- hb.registerHelper('property', function (name, context) {
104
- return context[name] || '';
105
- });
106
-
107
- // register an 'includes' helper
108
- // it checks if value is in array
109
- hb.registerHelper('includes', function (haystack, needle, options) {
110
- if (_.contains(haystack, needle)) {
111
- return options.fn(this);
112
- }
113
- });
114
- }
8
+ Helpers0 = Helpers0 && Object.prototype.hasOwnProperty.call(Helpers0, 'default') ? Helpers0['default'] : Helpers0;
115
9
 
116
10
  if (!Helpers0.__initialized) {
117
11
  Helpers0(Handlebars);
@@ -1,4 +1,4 @@
1
- define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider', 'handlebars', 'i18n', 'lib/dompurify/purify'], function ($$1, _, component, selectable, hider, Handlebars, __, DOMPurify) { 'use strict';
1
+ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider', 'handlebars', 'lib/handlebars/helpers'], function ($$1, _, component, selectable, hider, Handlebars, Helpers0) { 'use strict';
2
2
 
3
3
  $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
4
  _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
@@ -6,114 +6,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
6
6
  selectable = selectable && Object.prototype.hasOwnProperty.call(selectable, 'default') ? selectable['default'] : selectable;
7
7
  hider = hider && Object.prototype.hasOwnProperty.call(hider, 'default') ? hider['default'] : hider;
8
8
  Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
9
- __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
10
- DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
11
-
12
- /**
13
- * This program is free software; you can redistribute it and/or
14
- * modify it under the terms of the GNU General Public License
15
- * as published by the Free Software Foundation; under version 2
16
- * of the License (non-upgradable).
17
- *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License
24
- * along with this program; if not, write to the Free Software
25
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
- *
27
- * Copyright (c) 2013-2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
28
- *
29
- *
30
- */
31
- function Helpers0 (hb) {
32
- //register a i18n helper
33
- hb.registerHelper('__', function (key) {
34
- return __(key);
35
- });
36
-
37
- /**
38
- * Register dompurify helper
39
- *
40
- * https://github.com/cure53/DOMPurify
41
- * with config SAFE_FOR_TEMPLATES: true
42
- * to make output safe for template systems
43
- */
44
- hb.registerHelper('dompurify', function (context) {
45
- return DOMPurify.sanitize(context);
46
- });
47
-
48
- /**
49
- * Register join helper
50
- *
51
- * Example :
52
- * var values = {a:v1, b:v2, c:v3};
53
- * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
54
- * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
55
- */
56
- hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
57
- var fragments = [];
58
- keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
59
- fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
60
- wrapper = typeof wrapper === 'string' ? wrapper : '"';
61
- _.forIn(arr, function (value, key) {
62
- var fragment = '';
63
- if (value !== null || value !== undefined) {
64
- if (typeof value === 'boolean') {
65
- value = value ? 'true' : 'false';
66
- } else if (typeof value === 'object') {
67
- value = _.values(value).join(' ');
68
- }
69
- } else {
70
- value = '';
71
- }
72
- if (keyValueGlue !== undefined) {
73
- fragment += key + keyValueGlue;
74
- }
75
- fragment += wrapper + value + wrapper;
76
- fragments.push(fragment);
77
- });
78
- return fragments.join(fragmentGlue);
79
- });
80
-
81
- //register a classic "for loop" helper
82
- //it also adds a local variable "i" as the index in each iteration loop
83
- hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
84
- var ret = '';
85
- startIndex = parseInt(startIndex);
86
- stopIndex = parseInt(stopIndex);
87
- increment = parseInt(increment);
88
- for (var i = startIndex; i < stopIndex; i += increment) {
89
- ret += options.fn(_.extend({}, this, {
90
- i: i
91
- }));
92
- }
93
- return ret;
94
- });
95
- hb.registerHelper('equal', function (var1, var2, options) {
96
- if (var1 == var2) {
97
- return options.fn(this);
98
- } else {
99
- return options.inverse(this);
100
- }
101
- });
102
-
103
- // register a "get property" helper
104
- // it gets the named property from the provided context
105
- hb.registerHelper('property', function (name, context) {
106
- return context[name] || '';
107
- });
108
-
109
- // register an 'includes' helper
110
- // it checks if value is in array
111
- hb.registerHelper('includes', function (haystack, needle, options) {
112
- if (_.contains(haystack, needle)) {
113
- return options.fn(this);
114
- }
115
- });
116
- }
9
+ Helpers0 = Helpers0 && Object.prototype.hasOwnProperty.call(Helpers0, 'default') ? Helpers0['default'] : Helpers0;
117
10
 
118
11
  if (!Helpers0.__initialized) {
119
12
  Helpers0(Handlebars);
@@ -203,7 +96,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
203
96
  return (asString || true) ? html : $(html);
204
97
  }
205
98
 
206
- /*! @license DOMPurify 2.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.0/LICENSE */
99
+ /*! @license DOMPurify 2.4.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.1/LICENSE */
207
100
 
208
101
  function _typeof(obj) {
209
102
  "@babel/helpers - typeof";
@@ -308,6 +201,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
308
201
  var arrayPop = unapply(Array.prototype.pop);
309
202
  var arrayPush = unapply(Array.prototype.push);
310
203
  var stringToLowerCase = unapply(String.prototype.toLowerCase);
204
+ var stringToString = unapply(String.prototype.toString);
311
205
  var stringMatch = unapply(String.prototype.match);
312
206
  var stringReplace = unapply(String.prototype.replace);
313
207
  var stringIndexOf = unapply(String.prototype.indexOf);
@@ -414,6 +308,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
414
308
  var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
415
309
 
416
310
  var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
311
+ var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
417
312
  var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
418
313
 
419
314
  var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
@@ -478,7 +373,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
478
373
  * if DOMPurify is up to date or not
479
374
  */
480
375
 
481
- DOMPurify.version = '2.4.0';
376
+ DOMPurify.version = '2.4.1';
482
377
  /**
483
378
  * Array of elements that DOMPurify removed during sanitation.
484
379
  * Empty if nothing was removed.
@@ -540,6 +435,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
540
435
  DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9;
541
436
  var MUSTACHE_EXPR$1 = MUSTACHE_EXPR,
542
437
  ERB_EXPR$1 = ERB_EXPR,
438
+ TMPLIT_EXPR$1 = TMPLIT_EXPR,
543
439
  DATA_ATTR$1 = DATA_ATTR,
544
440
  ARIA_ATTR$1 = ARIA_ATTR,
545
441
  IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,
@@ -679,6 +575,10 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
679
575
 
680
576
  var NAMESPACE = HTML_NAMESPACE;
681
577
  var IS_EMPTY_INPUT = false;
578
+ /* Allowed XHTML+XML namespaces */
579
+
580
+ var ALLOWED_NAMESPACES = null;
581
+ var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
682
582
  /* Parsing of strict XHTML documents */
683
583
 
684
584
  var PARSER_MEDIA_TYPE;
@@ -719,13 +619,12 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
719
619
  // eslint-disable-next-line unicorn/prefer-includes
720
620
  SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
721
621
 
722
- transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
723
- return x;
724
- } : stringToLowerCase;
622
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
725
623
  /* Set configuration parameters */
726
624
 
727
625
  ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
728
626
  ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
627
+ ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
729
628
  URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),
730
629
  // eslint-disable-line indent
731
630
  cfg.ADD_URI_SAFE_ATTR,
@@ -889,19 +788,22 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
889
788
 
890
789
  if (!parent || !parent.tagName) {
891
790
  parent = {
892
- namespaceURI: HTML_NAMESPACE,
791
+ namespaceURI: NAMESPACE,
893
792
  tagName: 'template'
894
793
  };
895
794
  }
896
795
  var tagName = stringToLowerCase(element.tagName);
897
796
  var parentTagName = stringToLowerCase(parent.tagName);
797
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
798
+ return false;
799
+ }
898
800
  if (element.namespaceURI === SVG_NAMESPACE) {
899
801
  // The only way to switch from HTML namespace to SVG
900
802
  // is via <svg>. If it happens via any other tag, then
901
803
  // it should be killed.
902
804
  if (parent.namespaceURI === HTML_NAMESPACE) {
903
805
  return tagName === 'svg';
904
- } // The only way to switch from MathML to SVG is via
806
+ } // The only way to switch from MathML to SVG is via`
905
807
  // svg if parent is either <annotation-xml> or MathML
906
808
  // text integration points.
907
809
 
@@ -941,9 +843,14 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
941
843
  // or SVG and should never appear in HTML namespace
942
844
 
943
845
  return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
846
+ } // For XHTML and XML documents that support custom namespaces
847
+
848
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
849
+ return true;
944
850
  } // The code should never reach this place (this means
945
851
  // that the element somehow got namespace that is not
946
- // HTML, SVG or MathML). Return false just in case.
852
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
853
+ // Return false just in case.
947
854
 
948
855
  return false;
949
856
  };
@@ -1019,7 +926,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
1019
926
  var matches = stringMatch(dirty, /^[\r\n\t ]+/);
1020
927
  leadingWhitespace = matches && matches[0];
1021
928
  }
1022
- if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') {
929
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
1023
930
  // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
1024
931
  dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
1025
932
  }
@@ -1074,7 +981,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
1074
981
  */
1075
982
 
1076
983
  var _isClobbered = function _isClobbered(elm) {
1077
- return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function');
984
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
1078
985
  };
1079
986
  /**
1080
987
  * _isNode
@@ -1192,6 +1099,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
1192
1099
  content = currentNode.textContent;
1193
1100
  content = stringReplace(content, MUSTACHE_EXPR$1, ' ');
1194
1101
  content = stringReplace(content, ERB_EXPR$1, ' ');
1102
+ content = stringReplace(content, TMPLIT_EXPR$1, ' ');
1195
1103
  if (currentNode.textContent !== content) {
1196
1104
  arrayPush(DOMPurify.removed, {
1197
1105
  element: currentNode.cloneNode()
@@ -1325,6 +1233,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
1325
1233
  if (SAFE_FOR_TEMPLATES) {
1326
1234
  value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
1327
1235
  value = stringReplace(value, ERB_EXPR$1, ' ');
1236
+ value = stringReplace(value, TMPLIT_EXPR$1, ' ');
1328
1237
  }
1329
1238
  /* Is `value` valid for this attribute? */
1330
1239
 
@@ -1577,6 +1486,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
1577
1486
  if (SAFE_FOR_TEMPLATES) {
1578
1487
  serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$1, ' ');
1579
1488
  serializedHTML = stringReplace(serializedHTML, ERB_EXPR$1, ' ');
1489
+ serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR$1, ' ');
1580
1490
  }
1581
1491
  return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1582
1492
  };
@@ -1,4 +1,4 @@
1
- define(['jquery', 'lodash', 'i18n', 'ui/component', 'ui/hider', 'ui/class/selector', 'ui/resource/tree', 'ui/resource/list', 'ui/resource/filters', 'handlebars', 'lib/dompurify/purify', 'css!ui/resource/css/selector.css'], function ($$1, _, __, component, hider, classesSelectorFactory, treeFactory, listFactory, filtersFactory, Handlebars, DOMPurify, selector_css) { 'use strict';
1
+ define(['jquery', 'lodash', 'i18n', 'ui/component', 'ui/hider', 'ui/class/selector', 'ui/resource/tree', 'ui/resource/list', 'ui/resource/filters', 'handlebars', 'lib/handlebars/helpers', 'css!ui/resource/css/selector.css'], function ($$1, _, __, component, hider, classesSelectorFactory, treeFactory, listFactory, filtersFactory, Handlebars, Helpers0, selector_css) { 'use strict';
2
2
 
3
3
  $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
4
  _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
@@ -10,113 +10,7 @@ define(['jquery', 'lodash', 'i18n', 'ui/component', 'ui/hider', 'ui/class/select
10
10
  listFactory = listFactory && Object.prototype.hasOwnProperty.call(listFactory, 'default') ? listFactory['default'] : listFactory;
11
11
  filtersFactory = filtersFactory && Object.prototype.hasOwnProperty.call(filtersFactory, 'default') ? filtersFactory['default'] : filtersFactory;
12
12
  Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
13
- DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
14
-
15
- /**
16
- * This program is free software; you can redistribute it and/or
17
- * modify it under the terms of the GNU General Public License
18
- * as published by the Free Software Foundation; under version 2
19
- * of the License (non-upgradable).
20
- *
21
- * This program is distributed in the hope that it will be useful,
22
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
- * GNU General Public License for more details.
25
- *
26
- * You should have received a copy of the GNU General Public License
27
- * along with this program; if not, write to the Free Software
28
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
- *
30
- * Copyright (c) 2013-2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
31
- *
32
- *
33
- */
34
- function Helpers0 (hb) {
35
- //register a i18n helper
36
- hb.registerHelper('__', function (key) {
37
- return __(key);
38
- });
39
-
40
- /**
41
- * Register dompurify helper
42
- *
43
- * https://github.com/cure53/DOMPurify
44
- * with config SAFE_FOR_TEMPLATES: true
45
- * to make output safe for template systems
46
- */
47
- hb.registerHelper('dompurify', function (context) {
48
- return DOMPurify.sanitize(context);
49
- });
50
-
51
- /**
52
- * Register join helper
53
- *
54
- * Example :
55
- * var values = {a:v1, b:v2, c:v3};
56
- * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
57
- * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
58
- */
59
- hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
60
- var fragments = [];
61
- keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
62
- fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
63
- wrapper = typeof wrapper === 'string' ? wrapper : '"';
64
- _.forIn(arr, function (value, key) {
65
- var fragment = '';
66
- if (value !== null || value !== undefined) {
67
- if (typeof value === 'boolean') {
68
- value = value ? 'true' : 'false';
69
- } else if (typeof value === 'object') {
70
- value = _.values(value).join(' ');
71
- }
72
- } else {
73
- value = '';
74
- }
75
- if (keyValueGlue !== undefined) {
76
- fragment += key + keyValueGlue;
77
- }
78
- fragment += wrapper + value + wrapper;
79
- fragments.push(fragment);
80
- });
81
- return fragments.join(fragmentGlue);
82
- });
83
-
84
- //register a classic "for loop" helper
85
- //it also adds a local variable "i" as the index in each iteration loop
86
- hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
87
- var ret = '';
88
- startIndex = parseInt(startIndex);
89
- stopIndex = parseInt(stopIndex);
90
- increment = parseInt(increment);
91
- for (var i = startIndex; i < stopIndex; i += increment) {
92
- ret += options.fn(_.extend({}, this, {
93
- i: i
94
- }));
95
- }
96
- return ret;
97
- });
98
- hb.registerHelper('equal', function (var1, var2, options) {
99
- if (var1 == var2) {
100
- return options.fn(this);
101
- } else {
102
- return options.inverse(this);
103
- }
104
- });
105
-
106
- // register a "get property" helper
107
- // it gets the named property from the provided context
108
- hb.registerHelper('property', function (name, context) {
109
- return context[name] || '';
110
- });
111
-
112
- // register an 'includes' helper
113
- // it checks if value is in array
114
- hb.registerHelper('includes', function (haystack, needle, options) {
115
- if (_.contains(haystack, needle)) {
116
- return options.fn(this);
117
- }
118
- });
119
- }
13
+ Helpers0 = Helpers0 && Object.prototype.hasOwnProperty.call(Helpers0, 'default') ? Helpers0['default'] : Helpers0;
120
14
 
121
15
  if (!Helpers0.__initialized) {
122
16
  Helpers0(Handlebars);