@oat-sa/tao-core-ui 1.48.0 → 1.49.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.
- package/dist/actionbar.js +5 -11
- package/dist/animable/absorbable/absorbable.js +5 -11
- package/dist/animable/pulsable/pulsable.js +5 -11
- package/dist/badge/badge.js +5 -11
- package/dist/breadcrumbs.js +5 -11
- package/dist/bulkActionPopup.js +5 -11
- package/dist/button.js +5 -11
- package/dist/cascadingComboBox.js +5 -11
- package/dist/ckeditor/ckConfigurator.js +22 -6
- package/dist/class/selector.js +5 -11
- package/dist/component/windowed.js +5 -11
- package/dist/component.js +5 -11
- package/dist/contextualPopup.js +5 -11
- package/dist/dashboard.js +5 -11
- package/dist/datalist.js +5 -11
- package/dist/datatable.js +5 -11
- package/dist/dateRange/dateRange.js +5 -11
- package/dist/datetime/picker.js +5 -11
- package/dist/deleter.js +5 -11
- package/dist/destination/selector.js +5 -11
- package/dist/dialog/confirmDelete.js +5 -11
- package/dist/dialog.js +5 -11
- package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +5 -11
- package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +5 -11
- package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +5 -11
- package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +5 -11
- package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +5 -11
- package/dist/documentViewer/providers/pdfViewer.js +5 -11
- package/dist/documentViewer.js +5 -11
- package/dist/dropdown.js +5 -11
- package/dist/dynamicComponent.js +5 -11
- package/dist/feedback.js +5 -11
- package/dist/filter.js +5 -11
- package/dist/form/dropdownForm.js +5 -11
- package/dist/form/form.js +5 -11
- package/dist/form/validator/renderer.js +5 -11
- package/dist/form/widget/providers/checkBox.js +5 -11
- package/dist/form/widget/providers/comboBox.js +5 -11
- package/dist/form/widget/providers/hidden.js +5 -11
- package/dist/form/widget/providers/hiddenBox.js +5 -11
- package/dist/form/widget/providers/radioBox.js +5 -11
- package/dist/form/widget/providers/textArea.js +5 -11
- package/dist/form/widget/widget.js +5 -11
- package/dist/generis/form/form.js +5 -11
- package/dist/generis/validator/validator.js +5 -11
- package/dist/generis/widget/checkBox/checkBox.js +5 -11
- package/dist/generis/widget/comboBox/comboBox.js +5 -11
- package/dist/generis/widget/hiddenBox/hiddenBox.js +5 -11
- package/dist/generis/widget/textBox/textBox.js +5 -11
- package/dist/generis/widget/widget.js +5 -11
- package/dist/groupedComboBox.js +5 -11
- package/dist/highlighter.js +5 -11
- package/dist/itemButtonList.js +5 -11
- package/dist/listbox.js +5 -11
- package/dist/loadingButton/loadingButton.js +5 -11
- package/dist/lock.js +5 -11
- package/dist/login/login.js +5 -11
- package/dist/maths/calculator/basicCalculator.js +5 -11
- package/dist/maths/calculator/core/board.js +5 -11
- package/dist/maths/calculator/core/expression.js +5 -11
- package/dist/maths/calculator/core/labels.js +5 -11
- package/dist/maths/calculator/core/tokens.js +5 -11
- package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +5 -11
- package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +5 -11
- package/dist/maths/calculator/scientificCalculator.js +5 -11
- package/dist/mediaEditor/mediaEditorComponent.js +5 -11
- package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +5 -11
- package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +5 -11
- package/dist/mediaplayer/players/html5.js +5 -11
- package/dist/mediaplayer/players/youtube.js +5 -11
- package/dist/mediaplayer.js +5 -11
- package/dist/mediasizer.js +5 -11
- package/dist/pageSizeSelector.js +5 -11
- package/dist/pagination/providers/pages.js +5 -11
- package/dist/pagination/providers/simple.js +5 -11
- package/dist/report.js +5 -11
- package/dist/resource/filters.js +5 -11
- package/dist/resource/list.js +5 -11
- package/dist/resource/selector.js +5 -11
- package/dist/resource/tree.js +5 -11
- package/dist/resourcemgr/fileBrowser.js +5 -11
- package/dist/resourcemgr/fileSelector.js +5 -11
- package/dist/resourcemgr.js +5 -11
- package/dist/searchModal/advancedSearch.js +5 -11
- package/dist/searchModal.js +14 -32
- package/dist/switch/switch.js +5 -11
- package/dist/tabs.js +5 -11
- package/dist/taskQueue/status.js +5 -11
- package/dist/taskQueue/table.js +5 -11
- package/dist/taskQueueButton/taskable.js +5 -11
- package/dist/taskQueueButton/treeButton.js +5 -11
- package/dist/tooltip.js +5 -11
- package/dist/tristateCheckboxGroup.js +5 -11
- package/dist/uploader.js +5 -11
- package/dist/validator.js +5 -11
- package/package.json +2 -3
- package/src/ckeditor/ckConfigurator.js +46 -26
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* along with this program; if not, write to the Free Software
|
|
14
14
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
15
15
|
*
|
|
16
|
-
* Copyright (c) 2015 (original work) Open Assessment Technologies SA ;
|
|
16
|
+
* Copyright (c) 2015-2022 (original work) Open Assessment Technologies SA ;
|
|
17
17
|
*/
|
|
18
18
|
import $ from 'jquery';
|
|
19
19
|
import _ from 'lodash';
|
|
@@ -23,23 +23,23 @@ import 'ckeditor';
|
|
|
23
23
|
/**
|
|
24
24
|
* Cache original config
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
const originalConfig = _.cloneDeep(window.CKEDITOR.config);
|
|
27
27
|
|
|
28
28
|
function getUserLanguage() {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const documentLang = window.document.documentElement.getAttribute('lang');
|
|
30
|
+
const documentLocale = documentLang && documentLang.split('-')[0];
|
|
31
31
|
|
|
32
32
|
return documentLocale;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const lang = getUserLanguage();
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
const ckConfigurator = (function () {
|
|
38
38
|
/**
|
|
39
39
|
* Toolbar presets that you normally never would need to change, they can however be overridden with options.toolbar.
|
|
40
40
|
* The argument 'toolbarType' determines which toolbar to use
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
const toolbarPresets = {
|
|
43
43
|
inline: [
|
|
44
44
|
{
|
|
45
45
|
name: 'basicstyles',
|
|
@@ -166,13 +166,31 @@ var ckConfigurator = (function() {
|
|
|
166
166
|
name: 'insert',
|
|
167
167
|
items: ['Link', 'SpecialChar']
|
|
168
168
|
}
|
|
169
|
+
],
|
|
170
|
+
table: [
|
|
171
|
+
{
|
|
172
|
+
name: 'basicstyles',
|
|
173
|
+
items: ['Bold', 'Italic', 'Subscript', 'Superscript']
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'insert',
|
|
177
|
+
items: ['SpecialChar', 'TaoQtiTable', 'TaoTooltip']
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'links',
|
|
181
|
+
items: ['Link']
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'paragraph',
|
|
185
|
+
items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']
|
|
186
|
+
}
|
|
169
187
|
]
|
|
170
188
|
};
|
|
171
189
|
|
|
172
190
|
/**
|
|
173
191
|
* defaults for editor configuration
|
|
174
192
|
*/
|
|
175
|
-
|
|
193
|
+
const ckConfigDefault = {
|
|
176
194
|
disableAutoInline: true,
|
|
177
195
|
entities: false,
|
|
178
196
|
entities_processNumerical: true,
|
|
@@ -416,11 +434,11 @@ var ckConfigurator = (function() {
|
|
|
416
434
|
/**
|
|
417
435
|
* Insert positioned plugins at position specified in options.positionedPlugins
|
|
418
436
|
*
|
|
419
|
-
* @param ckConfig
|
|
420
|
-
* @param positionedPlugins
|
|
437
|
+
* @param {Object} ckConfig
|
|
438
|
+
* @param {Object} positionedPlugins
|
|
421
439
|
*/
|
|
422
|
-
|
|
423
|
-
|
|
440
|
+
const _updatePlugins = function (ckConfig, positionedPlugins) {
|
|
441
|
+
let itCnt,
|
|
424
442
|
tbCnt = ckConfig.toolbar.length,
|
|
425
443
|
itLen,
|
|
426
444
|
method,
|
|
@@ -435,9 +453,9 @@ var ckConfigurator = (function() {
|
|
|
435
453
|
positionedPlugins = positionedPlugins || {};
|
|
436
454
|
|
|
437
455
|
// add positioned plugins to extraPlugins and let CKEDITOR take care of their registration
|
|
438
|
-
ckConfig.extraPlugins = (function(positionedPluginArr, extraPlugins) {
|
|
439
|
-
|
|
440
|
-
|
|
456
|
+
ckConfig.extraPlugins = (function (positionedPluginArr, extraPlugins) {
|
|
457
|
+
let pluginIndex = positionedPluginArr.length;
|
|
458
|
+
let extraPluginArr = extraPlugins.split(',');
|
|
441
459
|
|
|
442
460
|
while (pluginIndex--) {
|
|
443
461
|
positionedPluginArr[pluginIndex] = positionedPluginArr[pluginIndex].toLowerCase();
|
|
@@ -460,8 +478,8 @@ var ckConfigurator = (function() {
|
|
|
460
478
|
|
|
461
479
|
// add positioned plugins to toolbar
|
|
462
480
|
for (plugin in positionedPlugins) {
|
|
463
|
-
method = (function(pluginProps) {
|
|
464
|
-
|
|
481
|
+
method = (function (pluginProps) {
|
|
482
|
+
let propIndex = pluginProps.length;
|
|
465
483
|
while (propIndex--) {
|
|
466
484
|
if (pluginProps[propIndex].indexOf('insert') === 0 || pluginProps[propIndex] === 'replace') {
|
|
467
485
|
return pluginProps[propIndex];
|
|
@@ -511,7 +529,7 @@ var ckConfigurator = (function() {
|
|
|
511
529
|
}
|
|
512
530
|
};
|
|
513
531
|
|
|
514
|
-
|
|
532
|
+
const _switchDtd = function _switchDtd(dtdMode) {
|
|
515
533
|
dtdHandler.setMode(dtdMode);
|
|
516
534
|
window.CKEDITOR.dtd = dtdHandler.getDtd();
|
|
517
535
|
};
|
|
@@ -536,13 +554,13 @@ var ckConfigurator = (function() {
|
|
|
536
554
|
*
|
|
537
555
|
* @see http://docs.ckeditor.com/#!/api/CKEDITOR.config
|
|
538
556
|
*/
|
|
539
|
-
|
|
540
|
-
|
|
557
|
+
const getConfig = function (editor, toolbarType, options) {
|
|
558
|
+
let toolbar, toolbars, config, dtdMode;
|
|
541
559
|
|
|
542
560
|
// This is different from CKEDITOR.config.extraPlugins since it also allows to position the button
|
|
543
561
|
// Valid positioning keys are insertAfter | insertBefore | replace followed by the button name, e.g. 'Anchor'
|
|
544
562
|
// separator bool, defaults to false
|
|
545
|
-
|
|
563
|
+
let positionedPlugins = {};
|
|
546
564
|
|
|
547
565
|
if (toolbarType === 'reset') {
|
|
548
566
|
return originalConfig;
|
|
@@ -555,6 +573,8 @@ var ckConfigurator = (function() {
|
|
|
555
573
|
toolbars = _.clone(toolbarPresets, true);
|
|
556
574
|
dtdMode = options.dtdMode || 'html';
|
|
557
575
|
|
|
576
|
+
const ckConfig = _.clone(ckConfigDefault, true);
|
|
577
|
+
|
|
558
578
|
// modify DTD to either comply with QTI or XHTML
|
|
559
579
|
if (dtdMode === 'qti' || toolbarType.indexOf('qti') === 0) {
|
|
560
580
|
toolbarType = toolbarType.slice(3).toLowerCase();
|
|
@@ -597,7 +617,7 @@ var ckConfigurator = (function() {
|
|
|
597
617
|
|
|
598
618
|
// add toolbars to config
|
|
599
619
|
for (toolbar in toolbars) {
|
|
600
|
-
if (
|
|
620
|
+
if (Object.prototype.hasOwnProperty.call(toolbars, toolbar)) {
|
|
601
621
|
ckConfig['toolbar_' + toolbar] = toolbars[toolbar];
|
|
602
622
|
}
|
|
603
623
|
}
|
|
@@ -640,7 +660,7 @@ var ckConfigurator = (function() {
|
|
|
640
660
|
|
|
641
661
|
// toggle global DTD depending on the CK instance which is receiving the focus
|
|
642
662
|
// I know that this is rather ugly <= don't worry, we'll keep this a secret ;)
|
|
643
|
-
editor.on('focus', function() {
|
|
663
|
+
editor.on('focus', function () {
|
|
644
664
|
_switchDtd(dtdMode);
|
|
645
665
|
// should be 1 on html, undefined on qti
|
|
646
666
|
// console.log(CKEDITOR.dtd.pre.img)
|
|
@@ -648,13 +668,13 @@ var ckConfigurator = (function() {
|
|
|
648
668
|
|
|
649
669
|
// remove title 'Rich Text Editor, instance n' that CKE sets by default
|
|
650
670
|
// ref: http://tinyurl.com/keedruc
|
|
651
|
-
editor.on('instanceReady', function(e) {
|
|
671
|
+
editor.on('instanceReady', function (e) {
|
|
652
672
|
$(e.editor.element.$).removeAttr('title');
|
|
653
673
|
});
|
|
654
674
|
|
|
655
675
|
// This fixes bug #2855. Unfortunately this can be done on the global object only, not on the instance
|
|
656
|
-
window.CKEDITOR.on('dialogDefinition', function(e) {
|
|
657
|
-
|
|
676
|
+
window.CKEDITOR.on('dialogDefinition', function (e) {
|
|
677
|
+
let linkTypes, wanted, linkIndex;
|
|
658
678
|
|
|
659
679
|
if (e.data.name !== 'link') {
|
|
660
680
|
return;
|