Commit 76b8891b by lduarte1991

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

parent 8cfdb8f1
...@@ -221,11 +221,17 @@ ...@@ -221,11 +221,17 @@
if ("${annotation_mode}" == "instructor" && "${instructor_email}" == "" && !is_staff) if ("${annotation_mode}" == "instructor" && "${instructor_email}" == "" && !is_staff)
osda.annotator.destroy(); osda.annotator.destroy();
} }
// if the following is true, template is being rendered in LMS, otherwise it is in Studio
if (typeof Annotator !== 'undefined') { if (typeof Annotator !== 'undefined') {
startosda(); startosda();
} else { } else {
require(["osda"], function(osda){ try {
startosda(); require(["osda"], function(osda){
}); startosda();
});
} catch(error) {
console.log("Error: " + error.message + " - Annotator not loaded in LMS.");
}
} }
</script> </script>
\ No newline at end of file
...@@ -204,11 +204,16 @@ ${static.css(group='style-xmodule-annotations', raw=True)} ...@@ -204,11 +204,16 @@ ${static.css(group='style-xmodule-annotations', raw=True)}
Catch = new CatchAnnotation($('#catchDIV'),catchOptions); 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') { if (typeof Annotator !== 'undefined') {
startova(); startova();
} else { } else {
require(["ova"], function(ova){ try {
startova(); require(["ova"], function(ova) {
}); startova();
});
} catch(error) {
console.log("Error: " + error.message + " - Annotator not loaded in LMS.");
}
} }
</script> </script>
...@@ -201,8 +201,12 @@ ${static.css(group='style-xmodule-annotations', raw=True)} ...@@ -201,8 +201,12 @@ ${static.css(group='style-xmodule-annotations', raw=True)}
if (typeof Annotator !== 'undefined') { if (typeof Annotator !== 'undefined') {
startova(); startova();
} else { } else {
require(["ova"], function(ova){ try {
startova(); require(["ova"], function(ova) {
}); startova();
});
} catch(error) {
console.log("Error: " + error.message + " - Annotator not loaded in LMS.");
}
} }
</script> </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