From 600a6297349a9d2a4dbcd40ce08049430e45ea8f Mon Sep 17 00:00:00 2001 From: Molkobain Date: Thu, 9 Dec 2021 17:54:30 +0100 Subject: [PATCH] CombodoBackofficeToolbox.InitCodeHighlighting: Add protection against not loaded lib --- js/pages/backoffice/toolbox.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/pages/backoffice/toolbox.js b/js/pages/backoffice/toolbox.js index 7b67bd086..82d003aca 100644 --- a/js/pages/backoffice/toolbox.js +++ b/js/pages/backoffice/toolbox.js @@ -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'); }