Skip to content

Commit

Permalink
Merge branch 'release-30.22.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Nov 14, 2024
2 parents 05625f0 + 914ed92 commit 0add923
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 13 deletions.
2 changes: 1 addition & 1 deletion views/css/item-creator.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/css/item-creator.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItem.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItem.min.js.map

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions views/js/qtiCreator/editor/ckEditor/htmlEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ define([
'taoQtiItem/qtiCreator/widgets/helpers/content',
'taoQtiItem/qtiCreator/widgets/helpers/deletingState',
'taoQtiItem/qtiCreator/editor/ckEditor/featureFlag',
'taoQtiItem/qtiCreator/helper/languages'
'taoQtiItem/qtiCreator/helper/languages',
'taoQtiItem/qtiCreator/helper/elementSupport',
], function (
_,
__,
Expand All @@ -40,7 +41,8 @@ define([
contentHelper,
deletingHelper,
featureFlag,
languages
languages,
elementSupportHelper
) {
'use strict';

Expand Down Expand Up @@ -133,8 +135,7 @@ define([
const $newImgPlaceholder = $editable.find('[data-new="true"][data-qti-class="img"]');
if (
$newImgPlaceholder.length &&
!$editable.closest('.qti-choice, .qti-flow-container').length &&
!$newImgPlaceholder.closest('.qti-table caption').length
elementSupportHelper.isFigureSupportedInParent($newImgPlaceholder)
) {
// instead img will add figure element
$newImgPlaceholder.attr('data-qti-class', 'figure');
Expand Down
42 changes: 42 additions & 0 deletions views/js/qtiCreator/helper/elementSupport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; under version 2
* of the License (non-upgradable).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright (c) 2024 (original work) Open Assessment Technologies SA ;
*/

define([], function () {
'use strict';

/**
* Before inserting Figure widget, check if parent element supports it.
* If supported, image wrap will be implemented as `<figure class="wrap-right"><img></figure>`.
* If not supported, image wrap will be implemented as `<img class="wrap-right">`
* @param {JQuery} $container
* @returns {boolean}
*/
const isFigureSupportedInParent = ($container) => {
const notSupported = (
$container.closest('.qti-choice, .qti-flow-container').length ||
$container.closest('.qti-table caption').length ||
$container.closest('.qti-modalFeedback').length ||
($container.closest('.qti-customInteraction').length && !$container.closest('[data-element-support-figure="true"]').length)
);
return !notSupported;
};

return {
isFigureSupportedInParent
};
});
9 changes: 4 additions & 5 deletions views/js/qtiCreator/renderers/Img.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ define([
'taoQtiItem/qtiCreator/widgets/static/img/Widget',
'taoQtiItem/qtiCreator/widgets/static/figure/Widget',
'taoQtiItem/qtiCreator/model/Figure',
'taoQtiItem/qtiCreator/helper/findParentElement'
], function (_, context, Renderer, Widget, FigureWidget, FigureModel, findParentElement) {
'taoQtiItem/qtiCreator/helper/findParentElement',
'taoQtiItem/qtiCreator/helper/elementSupport',
], function (_, context, Renderer, Widget, FigureWidget, FigureModel, findParentElement, elementSupportHelper) {
'use strict';

const CreatorImg = _.clone(Renderer);
Expand Down Expand Up @@ -59,9 +60,7 @@ define([

if (
!DISABLE_FIGURE_WIDGET &&
!$container.closest('.qti-choice, .qti-flow-container').length &&
!$container.closest('.qti-table caption').length &&
!$container.closest('.qti-modalFeedback').length
elementSupportHelper.isFigureSupportedInParent($container)
) {
const parent = findParentElement(img.rootElement, img.serial);
parent.removeElement(img);
Expand Down
3 changes: 3 additions & 0 deletions views/js/qtiCreator/widgets/static/figure/Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ define([
$img.attr('width', '100%');
$img.removeAttr('style');
}

this.$container.attr('contenteditable', false); //case: textReaderInteraction PCI

return this;
};

Expand Down
3 changes: 3 additions & 0 deletions views/scss/item-creator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,9 @@ img.dragging.ui-draggable-dragging {
display: flex;
}
}
.cke_editable {
clear: both;
}
}
.qti-interaction {
.add-option {
Expand Down

0 comments on commit 0add923

Please sign in to comment.