File tree 1 file changed +10
-11
lines changed
common/templates/xblock_v2
1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change 215
215
}
216
216
return url ;
217
217
} ,
218
- notify : ( ) => {
219
- /**
220
- * Used in `studio_view`
221
- *
222
- * TODO: Do nothing for now
223
- * **/
218
+ notify : ( eventName , data ) => {
219
+ /**
220
+ * Used in `studio_view` to notify events and errors
221
+ **/
222
+ if ( eventName == 'save' && data . state == 'end' ) {
223
+ window . parent . postMessage ( 'save-end' , '*' ) ;
224
+ } else if ( eventName == 'error' ) {
225
+ window . parent . postMessage ( 'error' , '*' ) ;
226
+ }
224
227
}
225
228
} ;
226
229
267
270
}
268
271
269
272
if ( '{{ view_name | safe }}' === 'studio_view' ) {
270
- // Used when rendering the `studio_view`, in order to intercept and handle the cancel/save button event
273
+ // Used when rendering the `studio_view`, in order to intercept and handle the cancel button event
271
274
document . querySelector ( '.cancel-button' ) . addEventListener ( 'click' , function ( ) {
272
275
event . preventDefault ( ) ;
273
276
window . parent . postMessage ( 'cancel-clicked' , '*' ) ;
274
277
} ) ;
275
- document . querySelector ( '.save-button' ) . addEventListener ( 'click' , function ( ) {
276
- event . preventDefault ( ) ;
277
- window . parent . postMessage ( 'save-clicked' , '*' ) ;
278
- } ) ;
279
278
}
280
279
}
281
280
You can’t perform that action at this time.
0 commit comments