N°4674 Fix code highlighter calls

This commit is contained in:
Stephen Abello
2022-02-02 10:35:50 +01:00
parent de053eed72
commit 7df27de5c1
6 changed files with 17 additions and 11 deletions

View File

@@ -141,25 +141,27 @@ const CombodoBackofficeToolbox = {
const sComplementarySelector = bForce ? '' : ':not(.hljs)';
// AttributeHTML and HTML AttributeText
let oCodeElements = oContainerElem.find('[data-attribute-type="AttributeHTML"], [data-attribute-type="AttributeText"], [data-attribute-type="AttributeTemplateHTML"]').find('.HTML pre'+sComplementarySelector+' > code');
let oCodeElements = oContainerElem.find('[data-attribute-type="AttributeHTML"], [data-attribute-type="AttributeText"], [data-attribute-type="AttributeTemplateHTML"]').find('.HTML pre > code'+sComplementarySelector);
if (oCodeElements.length > 0) {
if (typeof hljs === 'undefined') {
CombodoJSConsole.Error('Cannot format code snippets in HTML fields as the highlight.js lib is not loaded');
} else {
oCodeElements.parent().each(function (iIdx, oElem) {
oCodeElements.each(function (iIdx, oElem) {
hljs.highlightBlock(oElem);
$(oElem).parent().addClass('ibo-hljs-container');
});
}
}
// CaseLogs
oCodeElements = oContainerElem.find('[data-role="ibo-activity-entry--main-information-content"] pre'+sComplementarySelector+' > code');
oCodeElements = oContainerElem.find('[data-role="ibo-activity-entry--main-information-content"] pre > code'+sComplementarySelector);
if (oCodeElements.length > 0) {
if (typeof hljs === 'undefined') {
CombodoJSConsole.Error('Cannot format code snippets in log entries as the highlight.js lib is not loaded');
} else {
oCodeElements.parent().each(function (iIdx, oElem) {
oCodeElements.each(function (iIdx, oElem) {
hljs.highlightBlock(oElem);
$(oElem).parent().addClass('ibo-hljs-container');
});
}
}