File tree Expand file tree Collapse file tree 16 files changed +123
-28
lines changed
components/dynamic-component Expand file tree Collapse file tree 16 files changed +123
-28
lines changed Original file line number Diff line number Diff line change @@ -45,18 +45,23 @@ export class AddonQtypeDdImageOrTextComponent
4545 */
4646 init ( ) : void {
4747 if ( ! this . question ) {
48+ this . onReadyPromise . resolve ( ) ;
49+
4850 return ;
4951 }
5052
5153 const questionElement = this . initComponent ( ) ;
5254 if ( ! questionElement ) {
55+ this . onReadyPromise . resolve ( ) ;
56+
5357 return ;
5458 }
5559
5660 // Get D&D area and question text.
5761 const ddArea = questionElement . querySelector ( '.ddarea' ) ;
5862 if ( ! ddArea ) {
5963 this . logger . warn ( 'Aborting because of an error parsing question.' , this . question . slot ) ;
64+ this . onReadyPromise . resolve ( ) ;
6065
6166 return CoreQuestionHelper . showComponentError ( this . onAbort ) ;
6267 }
@@ -84,6 +89,7 @@ export class AddonQtypeDdImageOrTextComponent
8489 }
8590
8691 this . question . loaded = false ;
92+ this . onReadyPromise . resolve ( ) ;
8793 }
8894
8995 /**
Original file line number Diff line number Diff line change @@ -51,11 +51,15 @@ export class AddonQtypeDdMarkerComponent
5151 */
5252 init ( ) : void {
5353 if ( ! this . question ) {
54+ this . onReadyPromise . resolve ( ) ;
55+
5456 return ;
5557 }
5658
5759 const questionElement = this . initComponent ( ) ;
5860 if ( ! questionElement ) {
61+ this . onReadyPromise . resolve ( ) ;
62+
5963 return ;
6064 }
6165
@@ -65,6 +69,7 @@ export class AddonQtypeDdMarkerComponent
6569
6670 if ( ! ddArea || ! ddForm ) {
6771 this . logger . warn ( 'Aborting because of an error parsing question.' , this . question . slot ) ;
72+ this . onReadyPromise . resolve ( ) ;
6873
6974 return CoreQuestionHelper . showComponentError ( this . onAbort ) ;
7075 }
@@ -107,6 +112,7 @@ export class AddonQtypeDdMarkerComponent
107112 }
108113
109114 this . question . loaded = false ;
115+ this . onReadyPromise . resolve ( ) ;
110116 }
111117
112118 /**
Original file line number Diff line number Diff line change @@ -47,11 +47,15 @@ export class AddonQtypeDdwtosComponent extends CoreQuestionBaseComponent<AddonMo
4747 */
4848 init ( ) : void {
4949 if ( ! this . question ) {
50+ this . onReadyPromise . resolve ( ) ;
51+
5052 return ;
5153 }
5254
5355 const questionElement = this . initComponent ( ) ;
5456 if ( ! questionElement ) {
57+ this . onReadyPromise . resolve ( ) ;
58+
5559 return ;
5660 }
5761
@@ -65,6 +69,7 @@ export class AddonQtypeDdwtosComponent extends CoreQuestionBaseComponent<AddonMo
6569 const answerContainer = questionElement . querySelector ( '.answercontainer' ) ;
6670 if ( ! answerContainer ) {
6771 this . logger . warn ( 'Aborting because of an error parsing question.' , this . question . slot ) ;
72+ this . onReadyPromise . resolve ( ) ;
6873
6974 return CoreQuestionHelper . showComponentError ( this . onAbort ) ;
7075 }
@@ -98,6 +103,7 @@ export class AddonQtypeDdwtosComponent extends CoreQuestionBaseComponent<AddonMo
98103 this . question . text = questionText ;
99104
100105 this . question . loaded = false ;
106+ this . onReadyPromise . resolve ( ) ;
101107 }
102108
103109 /**
Original file line number Diff line number Diff line change @@ -36,12 +36,16 @@ export class AddonQtypeDescriptionComponent extends CoreQuestionBaseComponent {
3636 init ( ) : void {
3737 const questionEl = this . initComponent ( ) ;
3838 if ( ! questionEl ) {
39+ this . onReadyPromise . resolve ( ) ;
40+
3941 return ;
4042 }
4143
4244 // Get the "seen" hidden input.
4345 const input = questionEl . querySelector < HTMLInputElement > ( 'input[type="hidden"][name*=seen]' ) ;
4446 if ( ! input ) {
47+ this . onReadyPromise . resolve ( ) ;
48+
4549 return ;
4650 }
4751
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ export class AddonQtypeEssayComponent extends CoreQuestionBaseComponent<AddonMod
4545 */
4646 init ( ) : void {
4747 if ( ! this . question ) {
48+ this . onReadyPromise . resolve ( ) ;
49+
4850 return ;
4951 }
5052
@@ -57,6 +59,7 @@ export class AddonQtypeEssayComponent extends CoreQuestionBaseComponent<AddonMod
5759 if ( this . question ?. allowsAttachments && this . uploadFilesSupported && ! this . review ) {
5860 this . loadAttachments ( ) ;
5961 }
62+ this . onReadyPromise . resolve ( ) ;
6063 }
6164
6265 /**
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export class AddonQtypeGapSelectComponent extends CoreQuestionBaseComponent {
3636 */
3737 init ( ) : void {
3838 this . initOriginalTextComponent ( '.qtext' ) ;
39+ this . onReadyPromise . resolve ( ) ;
3940 }
4041
4142 /**
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export class AddonQtypeMatchComponent extends CoreQuestionBaseComponent<AddonMod
3535 */
3636 init ( ) : void {
3737 this . initMatchComponent ( ) ;
38+ this . onReadyPromise . resolve ( ) ;
3839 }
3940
4041}
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export class AddonQtypeMultiAnswerComponent extends CoreQuestionBaseComponent {
3535 */
3636 init ( ) : void {
3737 this . initOriginalTextComponent ( '.formulation' ) ;
38+ this . onReadyPromise . resolve ( ) ;
3839 }
3940
4041 /**
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export class AddonQtypeMultichoiceComponent extends CoreQuestionBaseComponent<Ad
3535 */
3636 init ( ) : void {
3737 this . initMultichoiceComponent ( ) ;
38+ this . onReadyPromise . resolve ( ) ;
3839 }
3940
4041 /**
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export class AddonQtypeNumericalComponent extends CoreQuestionBaseComponent<Addo
3535 */
3636 init ( ) : void {
3737 this . initCalculatedComponent ( ) ;
38+ this . onReadyPromise . resolve ( ) ;
3839 }
3940
4041}
You can’t perform that action at this time.
0 commit comments