Skip to content

Commit

Permalink
Merge pull request #2651 from oat-sa/fix/AUT-3890/multiple-hottext-wh…
Browse files Browse the repository at this point in the history
…en-disallowhtmlinhottext-enabled

fix: multiple hottext support when disallowHTMLInHottext is enabled
  • Loading branch information
viktar-dzmitryieu-tao authored Dec 20, 2024
2 parents 34b9431 + 81c2bf8 commit 13c4026
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions views/js/qtiCreator/widgets/helpers/selectionWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ define(['jquery'], function ($) {
* @param {jQuery} $wrapper - the element that will wrap the selection
* @returns {boolean}
*/
wrapWith: function wrapWith($wrapper) {
const range = selection.getRangeAt(0);
wrapWith: function wrapWith($wrapper, providedRange) {
const range = providedRange || selection.getRangeAt(0);

if (this.canWrap()) {
if (this.canWrap(range)) {
try {
range.surroundContents($wrapper[0]);
selection.removeAllRanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ define([
} else {
if (
$cloneContent.text() === $cloneContent.html() &&
wrapper.wrapWith($newHottextClone)
wrapper.wrapWith($newHottextClone, range)
) {
await this.createNewHottext($newHottextClone);
} else {
Expand Down

0 comments on commit 13c4026

Please sign in to comment.