From eb501a14411c522df260f77878df99998646d578 Mon Sep 17 00:00:00 2001 From: Pawel Korczak Date: Mon, 4 Dec 2023 06:56:54 +0100 Subject: [PATCH 1/2] chore: update methods to lodash 4 verios --- views/js/qtiCreator/editor/ckEditor/htmlEditor.js | 6 +++--- views/js/qtiCreator/editor/containerEditor.js | 2 +- views/js/qtiCreator/editor/styleEditor/fontSizeChanger.js | 2 +- views/js/qtiCreator/widgets/helpers/content.js | 2 +- views/js/qtiCreator/widgets/item/Widget.js | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/views/js/qtiCreator/editor/ckEditor/htmlEditor.js b/views/js/qtiCreator/editor/ckEditor/htmlEditor.js index ab2a554d7..aed247ee8 100755 --- a/views/js/qtiCreator/editor/ckEditor/htmlEditor.js +++ b/views/js/qtiCreator/editor/ckEditor/htmlEditor.js @@ -343,7 +343,7 @@ define([ options = options || {}; //re-init all widgets: - _.each(_.values(container.elements), function (elt) { + _.forEach(_.values(container.elements), function (elt) { const widget = elt.data('widget'), currentState = widget.getCurrentState().name; @@ -387,7 +387,7 @@ define([ const deleted = []; const container = $container.data('qti-container'); - _.each(widgets, function (w) { + _.forEach(widgets, function (w) { if (!w.element.data('removed')) { const $widget = _findWidgetContainer($container, w.serial); if (!$widget.length) { @@ -402,7 +402,7 @@ define([ $messageBox .on('confirm.deleting', function () { - _.each(deleted, function (w) { + _.forEach(deleted, function (w) { w.element.remove(); w.destroy(); }); diff --git a/views/js/qtiCreator/editor/containerEditor.js b/views/js/qtiCreator/editor/containerEditor.js index ae588f937..a6aa49379 100644 --- a/views/js/qtiCreator/editor/containerEditor.js +++ b/views/js/qtiCreator/editor/containerEditor.js @@ -126,7 +126,7 @@ define([ container.setRootElement(item); if (options.metadata) { - _.each(options.metadata, function (value, name) { + _.forEach(options.metadata, function (value, name) { item.data(name, value); }); } diff --git a/views/js/qtiCreator/editor/styleEditor/fontSizeChanger.js b/views/js/qtiCreator/editor/styleEditor/fontSizeChanger.js index c4019a61f..5b3d6237f 100755 --- a/views/js/qtiCreator/editor/styleEditor/fontSizeChanger.js +++ b/views/js/qtiCreator/editor/styleEditor/fontSizeChanger.js @@ -102,7 +102,7 @@ define(['jquery', 'lodash', 'taoMediaManager/qtiCreator/editor/styleEditor/style if (c === 13) { $input.trigger('blur'); } - return _.contains([8, 37, 39, 46], c) || (c >= 48 && c <= 57) || (c >= 96 && c <= 105); + return _.includes([8, 37, 39, 46], c) || (c >= 48 && c <= 57) || (c >= 96 && c <= 105); }); /** diff --git a/views/js/qtiCreator/widgets/helpers/content.js b/views/js/qtiCreator/widgets/helpers/content.js index 3634a9f02..8f0105b95 100644 --- a/views/js/qtiCreator/widgets/helpers/content.js +++ b/views/js/qtiCreator/widgets/helpers/content.js @@ -47,7 +47,7 @@ define([ creatorRenderer.get().load(function(){ - _.each(newElts, function(serial) { + _.forEach(newElts, function(serial) { let $placeholder, $widget, widget; diff --git a/views/js/qtiCreator/widgets/item/Widget.js b/views/js/qtiCreator/widgets/item/Widget.js index 644b50341..86d587240 100755 --- a/views/js/qtiCreator/widgets/item/Widget.js +++ b/views/js/qtiCreator/widgets/item/Widget.js @@ -223,7 +223,7 @@ define([ const _detachElements = function(container, elements) { const containerElements = {}; - _.each(elements, function(elementSerial){ + _.forEach(elements, function(elementSerial){ containerElements[elementSerial] = container.elements[elementSerial]; delete container.elements[elementSerial]; }); @@ -317,7 +317,7 @@ define([ } else { - _.each(newElts, function(container){ + _.forEach(newElts, function(container){ const containerData = subContainers.shift();//get data in order const containerElements = _detachElements(itemBody, containerData.elements); From 07357ff589b879330da1c3e6e242b75191cbfbfe Mon Sep 17 00:00:00 2001 From: Sergei Mikhailov Date: Thu, 1 Feb 2024 17:48:04 +0100 Subject: [PATCH 2/2] chore: add an explicit dependency on tao-core that is introducing lodash v4 Signed-off-by: Sergei Mikhailov --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 468b76152..b0a16afc7 100755 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "oat-sa/oatbox-extension-installer": "~1.1||dev-master", "oat-sa/lib-generis-search": "^2.1.2", "oat-sa/generis": ">=15.24", - "oat-sa/tao-core": ">=53.12", + "oat-sa/tao-core": ">=54.0.0", "oat-sa/extension-tao-item": ">=v12.1.0", "oat-sa/extension-tao-itemqti": ">=29.14.5", "oat-sa/extension-tao-test": ">=15.16",