CombodoBackofficeToolbox.InitCodeHighlighting: Add protection against not loaded lib

This commit is contained in:
Molkobain
2021-12-09 17:54:30 +01:00
parent 9acdb45482
commit 600a629734

View File

@@ -134,6 +134,12 @@ const CombodoBackofficeToolbox = {
* @constructor
*/
InitCodeHighlighting: function (oContainerElem = null, bForce = false) {
// Check if the lib is loaded
if (typeof hljs === 'undefined') {
CombodoJSConsole.Error('Cannot format code snippets as the highlight.js lib is not loaded');
return;
}
if (oContainerElem === null) {
oContainerElem = $('body');
}