@oat-sa/tao-core-ui 1.66.0 → 1.66.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.
- package/dist/figure/FigureStateActive.js +5 -23
- package/dist/mediaEditor/plugins/mediaAlignment/helper.js +2 -49
- package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +1 -0
- package/dist/pageSizeSelector.js +19 -24
- package/package.json +1 -1
- package/scss/inc/_feedback.scss +0 -4
- package/src/css/basic.css +0 -4
- package/src/css/basic.css.map +1 -1
- package/src/figure/FigureStateActive.js +5 -15
- package/src/mediaEditor/plugins/mediaAlignment/helper.js +0 -48
- package/src/pageSizeSelector.js +19 -28
- package/scss/.DS_Store +0 -0
- package/scss/ckeditor/.DS_Store +0 -0
- package/scss/ckeditor/skins/.DS_Store +0 -0
- package/scss/ckeditor/skins/tao/.DS_Store +0 -0
- package/scss/ckeditor/skins/tao/scss/.DS_Store +0 -0
- package/scss/font/.DS_Store +0 -0
- package/scss/inc/.DS_Store +0 -0
|
@@ -446,13 +446,11 @@ define(['jquery', 'nouislider', 'ui/resourcemgr', 'ui/tooltip', 'lodash', 'i18n'
|
|
|
446
446
|
} = _ref2;
|
|
447
447
|
const imageElem = getImageElement(widget);
|
|
448
448
|
const figcaptionElem = getCaptionElement(widget);
|
|
449
|
-
const showFigure = widget.element.attr('showFigure');
|
|
450
449
|
widget.$form.html(formTpl({
|
|
451
450
|
baseUrl: widget.options.baseUrl || '',
|
|
452
451
|
src: imageElem.attr('src'),
|
|
453
452
|
alt: imageElem.attr('alt'),
|
|
454
|
-
figcaption: figcaptionElem ? figcaptionElem.body() : ''
|
|
455
|
-
showFigure: showFigure
|
|
453
|
+
figcaption: figcaptionElem ? figcaptionElem.body() : ''
|
|
456
454
|
}));
|
|
457
455
|
widget.$form.find('textarea#figcaption').on('focus.qti-widget', () => widget.$container.addClass('edit-figcaption')).on('blur.qti-widget', () => widget.$container.removeClass('edit-figcaption'));
|
|
458
456
|
|
|
@@ -470,23 +468,7 @@ define(['jquery', 'nouislider', 'ui/resourcemgr', 'ui/tooltip', 'lodash', 'i18n'
|
|
|
470
468
|
togglePlaceholder
|
|
471
469
|
}));
|
|
472
470
|
};
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* @param {Object} stateFactory
|
|
476
|
-
* @param {Object} ActiveState
|
|
477
|
-
* @param {Object} formTpl
|
|
478
|
-
* @param {Object} formElement
|
|
479
|
-
* @param {Object} inlineHelper
|
|
480
|
-
* @returns
|
|
481
|
-
*/
|
|
482
|
-
function FigureStateActive (_ref3) {
|
|
483
|
-
let {
|
|
484
|
-
stateFactory,
|
|
485
|
-
ActiveState,
|
|
486
|
-
formTpl,
|
|
487
|
-
formElement,
|
|
488
|
-
inlineHelper
|
|
489
|
-
} = _ref3;
|
|
471
|
+
function FigureStateActive (stateFactory, ActiveState, formTpl, formElement, inlineHelper) {
|
|
490
472
|
/**
|
|
491
473
|
* media Editor instance if has been initialized
|
|
492
474
|
* @type {null}
|
|
@@ -494,7 +476,7 @@ define(['jquery', 'nouislider', 'ui/resourcemgr', 'ui/tooltip', 'lodash', 'i18n'
|
|
|
494
476
|
let mediaEditor = null;
|
|
495
477
|
let textareaObserver = null;
|
|
496
478
|
let texareaHTMLElem = null;
|
|
497
|
-
const
|
|
479
|
+
const ImgStateActive = stateFactory.extend(ActiveState, function () {
|
|
498
480
|
this.initForm();
|
|
499
481
|
}, function () {
|
|
500
482
|
this.widget.$form.find('textarea#figcaption').off('.qti-widget');
|
|
@@ -503,7 +485,7 @@ define(['jquery', 'nouislider', 'ui/resourcemgr', 'ui/tooltip', 'lodash', 'i18n'
|
|
|
503
485
|
}
|
|
504
486
|
this.widget.$form.empty();
|
|
505
487
|
});
|
|
506
|
-
|
|
488
|
+
ImgStateActive.prototype.initForm = function () {
|
|
507
489
|
initForm({
|
|
508
490
|
widget: this.widget,
|
|
509
491
|
formElement,
|
|
@@ -524,7 +506,7 @@ define(['jquery', 'nouislider', 'ui/resourcemgr', 'ui/tooltip', 'lodash', 'i18n'
|
|
|
524
506
|
}
|
|
525
507
|
}
|
|
526
508
|
};
|
|
527
|
-
return
|
|
509
|
+
return ImgStateActive;
|
|
528
510
|
}
|
|
529
511
|
|
|
530
512
|
return FigureStateActive;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
define(['exports'
|
|
2
|
-
|
|
3
|
-
_ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
|
|
1
|
+
define(['exports'], function (exports) { 'use strict';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* This program is free software; you can redistribute it and/or
|
|
@@ -19,30 +17,9 @@ define(['exports', 'lodash'], function (exports, _) { 'use strict';
|
|
|
19
17
|
*
|
|
20
18
|
* Copyright (c) 2021-2022 (original work) Open Assessment Technologies SA;
|
|
21
19
|
*/
|
|
20
|
+
|
|
22
21
|
const FLOAT_LEFT_CLASS = 'wrap-left';
|
|
23
22
|
const FLOAT_RIGHT_CLASS = 'wrap-right';
|
|
24
|
-
const searchRecurse = (parentElement, serial) => {
|
|
25
|
-
if (!parentElement) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
if (parentElement.serial === serial) {
|
|
29
|
-
return parentElement;
|
|
30
|
-
}
|
|
31
|
-
let found = null;
|
|
32
|
-
_.some(parentElement['elements'], childElement => {
|
|
33
|
-
if (childElement.serial === serial) {
|
|
34
|
-
found = parentElement;
|
|
35
|
-
} else if (childElement['elements']) {
|
|
36
|
-
found = searchRecurse(childElement, serial);
|
|
37
|
-
} else if (childElement['prompt']) {
|
|
38
|
-
found = searchRecurse(childElement.prompt.bdy, serial);
|
|
39
|
-
}
|
|
40
|
-
if (found) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return found;
|
|
45
|
-
};
|
|
46
23
|
const positionFloat = function positionFloat(widget, position) {
|
|
47
24
|
if (!position) {
|
|
48
25
|
return;
|
|
@@ -64,35 +41,11 @@ define(['exports', 'lodash'], function (exports, _) { 'use strict';
|
|
|
64
41
|
// Update DOM
|
|
65
42
|
widget.$container.addClass(className);
|
|
66
43
|
// Update model
|
|
67
|
-
const prevClassName = widget.element.attr('class') || '';
|
|
68
44
|
if (className) {
|
|
69
45
|
widget.element.attr('class', className);
|
|
70
46
|
} else {
|
|
71
47
|
widget.element.removeAttr('class');
|
|
72
48
|
}
|
|
73
|
-
if (prevClassName !== className) {
|
|
74
|
-
// Re-build Figure widget to toggle between inline/block
|
|
75
|
-
const parent = searchRecurse(widget.element.bdy.rootElement.bdy, widget.serial);
|
|
76
|
-
// avoid changes on Figure in a prompt
|
|
77
|
-
if (parent.contentModel && parent.contentModel === 'inlineStatic') {
|
|
78
|
-
_.defer(() => {
|
|
79
|
-
widget.element.data('widget').refresh();
|
|
80
|
-
});
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
widget.element.data('widget').changeState('sleep');
|
|
84
|
-
_.defer(() => {
|
|
85
|
-
if (parent && parent.data('widget')) {
|
|
86
|
-
parent.data('widget').changeState('active');
|
|
87
|
-
_.defer(() => {
|
|
88
|
-
parent.data('widget').changeState('sleep');
|
|
89
|
-
_.defer(() => {
|
|
90
|
-
widget.element.data('widget').changeState('active');
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
49
|
widget.$original.trigger('contentChange.qti-widget');
|
|
97
50
|
};
|
|
98
51
|
const initAlignment = function initAlignment(widget) {
|
package/dist/pageSizeSelector.js
CHANGED
|
@@ -71,7 +71,7 @@ define(['jquery', 'i18n', 'ui/component', 'handlebars', 'lib/handlebars/helpers'
|
|
|
71
71
|
* Default config values
|
|
72
72
|
* @type {Object}
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
const defaults = {
|
|
75
75
|
defaultSize: 25,
|
|
76
76
|
options: [{
|
|
77
77
|
label: '25 ' + __('items per page'),
|
|
@@ -99,14 +99,14 @@ define(['jquery', 'i18n', 'ui/component', 'handlebars', 'lib/handlebars/helpers'
|
|
|
99
99
|
* @param {Object} [config.items] - available options
|
|
100
100
|
* @returns {pageSizeSelector}
|
|
101
101
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
setSelectedOption
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
options.forEach(
|
|
109
|
-
if (option.value === defaultSize) {
|
|
102
|
+
function pageSizeSelectorFactory(config) {
|
|
103
|
+
const pageSizeSelectorSpecs = {
|
|
104
|
+
setSelectedOption() {
|
|
105
|
+
const options = this.config.options;
|
|
106
|
+
const defaultSize = parseInt(this.config.defaultSize, 10);
|
|
107
|
+
let selectedOption;
|
|
108
|
+
options.forEach(option => {
|
|
109
|
+
if (parseInt(option.value, 10) === defaultSize) {
|
|
110
110
|
selectedOption = option;
|
|
111
111
|
option.selected = true;
|
|
112
112
|
} else {
|
|
@@ -120,27 +120,22 @@ define(['jquery', 'i18n', 'ui/component', 'handlebars', 'lib/handlebars/helpers'
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
return component(pageSizeSelectorSpecs, defaults).setTemplate(pageSizeSelectorTpl).on('init', function () {
|
|
123
|
+
return component(pageSizeSelectorSpecs, defaults).setTemplate(pageSizeSelectorTpl).on('init', function onInit() {
|
|
124
124
|
this.setSelectedOption();
|
|
125
|
-
}).on('render', function () {
|
|
126
|
-
|
|
127
|
-
var $component = this.getElement();
|
|
128
|
-
$$1('.select2', $component).select2({
|
|
125
|
+
}).on('render', function onRender() {
|
|
126
|
+
$$1('.select2', this.getElement()).select2({
|
|
129
127
|
dropdownCssClass: 'page-size-dropdown',
|
|
130
128
|
minimumResultsForSearch: Infinity
|
|
131
|
-
}).on('change',
|
|
132
|
-
|
|
129
|
+
}).on('change', e => {
|
|
130
|
+
this.trigger('change', e.val);
|
|
133
131
|
});
|
|
134
|
-
}).after('render', function () {
|
|
135
|
-
var $component = this.getElement();
|
|
136
|
-
|
|
132
|
+
}).after('render', function afterRender() {
|
|
137
133
|
// Notify about the default value after render
|
|
138
|
-
this.trigger('change', $$1('select',
|
|
139
|
-
}).on('destroy', function () {
|
|
140
|
-
|
|
141
|
-
$$1('.select2', $component).select2('destroy');
|
|
134
|
+
this.trigger('change', $$1('select', this.getElement()).val());
|
|
135
|
+
}).on('destroy', function onDestroy() {
|
|
136
|
+
$$1('.select2', this.getElement()).select2('destroy');
|
|
142
137
|
}).init(config);
|
|
143
|
-
}
|
|
138
|
+
}
|
|
144
139
|
|
|
145
140
|
return pageSizeSelectorFactory;
|
|
146
141
|
|
package/package.json
CHANGED
package/scss/inc/_feedback.scss
CHANGED
package/src/css/basic.css
CHANGED
|
@@ -1843,10 +1843,6 @@ html .txt-user-highlight {
|
|
|
1843
1843
|
background-color: #f1d0d5;
|
|
1844
1844
|
}
|
|
1845
1845
|
|
|
1846
|
-
textarea + .feedback-info, textarea + .tooltip-blue {
|
|
1847
|
-
padding: 5px;
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
1846
|
[class*=" col-"], [class^="col-"] {
|
|
1851
1847
|
float: left;
|
|
1852
1848
|
min-height: 1rem;
|