Annotation Tools: Adding try-catch in case Annotator is missing from LMS
This commit is contained in:
@@ -221,11 +221,17 @@
|
||||
if ("${annotation_mode}" == "instructor" && "${instructor_email}" == "" && !is_staff)
|
||||
osda.annotator.destroy();
|
||||
}
|
||||
|
||||
// if the following is true, template is being rendered in LMS, otherwise it is in Studio
|
||||
if (typeof Annotator !== 'undefined') {
|
||||
startosda();
|
||||
} else {
|
||||
require(["osda"], function(osda){
|
||||
startosda();
|
||||
});
|
||||
try {
|
||||
require(["osda"], function(osda){
|
||||
startosda();
|
||||
});
|
||||
} catch(error) {
|
||||
console.log("Error: " + error.message + " - Annotator not loaded in LMS.");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -204,11 +204,16 @@ ${static.css(group='style-xmodule-annotations', raw=True)}
|
||||
Catch = new CatchAnnotation($('#catchDIV'),catchOptions);
|
||||
}
|
||||
|
||||
// if the following is true, template is being rendered in LMS, otherwise it is in Studio
|
||||
if (typeof Annotator !== 'undefined') {
|
||||
startova();
|
||||
} else {
|
||||
require(["ova"], function(ova){
|
||||
startova();
|
||||
});
|
||||
try {
|
||||
require(["ova"], function(ova) {
|
||||
startova();
|
||||
});
|
||||
} catch(error) {
|
||||
console.log("Error: " + error.message + " - Annotator not loaded in LMS.");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -201,8 +201,12 @@ ${static.css(group='style-xmodule-annotations', raw=True)}
|
||||
if (typeof Annotator !== 'undefined') {
|
||||
startova();
|
||||
} else {
|
||||
require(["ova"], function(ova){
|
||||
startova();
|
||||
});
|
||||
try {
|
||||
require(["ova"], function(ova) {
|
||||
startova();
|
||||
});
|
||||
} catch(error) {
|
||||
console.log("Error: " + error.message + " - Annotator not loaded in LMS.");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user