Commit 76b8891b by lduarte1991

Annotation Tools: Adding try-catch in case Annotator is missing from LMS

parent 8cfdb8f1
......@@ -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>
\ No newline at end of file
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment