mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°4674 Fix code highlighter calls
This commit is contained in:
@@ -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');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user