← All changes
|
assets/src/js/frontend/course-builder/builder-question/builder-tab-question.js
+6
-5
4.4.6
→
4.4.10
View file →
| @@ -456,12 +456,13 @@ | ||
| 456 | 456 | replaceItemHtml( elQuestion, html ) { |
| 457 | 457 | if ( ! elQuestion || ! html ) { |
| 458 | 458 | return; |
| 459 | 459 | } |
| 460 | - const tmp = document.createElement( 'div' ); | |
| 461 | - tmp.innerHTML = html; | |
| 462 | - const newEl = tmp.firstElementChild; | |
| 463 | - if ( newEl ) { | |
| 464 | - elQuestion.replaceWith( newEl ); | |
| 460 | + | |
| 461 | + const nextQuestion = elQuestion.nextElementSibling; | |
| 462 | + elQuestion.insertAdjacentHTML( 'afterend', html.trim() ); | |
| 463 | + const newQuestion = elQuestion.nextElementSibling; | |
| 464 | + if ( newQuestion && newQuestion !== nextQuestion ) { | |
| 465 | + elQuestion.remove(); | |
| 465 | 466 | } |
| 466 | 467 | } |
| 467 | 468 | } |