From 014efac09f1b652c6bc89e58ede652eff0801ad7 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Tue, 27 May 2025 11:46:36 +0100 Subject: [PATCH] fix cheat sheet toc --- preview-src/ui-model.yml | 2 ++ src/js/02-on-this-page.js | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/preview-src/ui-model.yml b/preview-src/ui-model.yml index 55fa091c..9eecd05e 100644 --- a/preview-src/ui-model.yml +++ b/preview-src/ui-model.yml @@ -314,6 +314,8 @@ page: class: 'aura-dbp' - name: 'AuraDB Virtual Dedicated Cloud' class: 'aura-dbe' + - name: 'AuraDB Business Critical' + class: 'aura-dbc' - name: 'AuraDS Professional' class: 'aura-dsp' - name: 'AuraDS Enterprise' diff --git a/src/js/02-on-this-page.js b/src/js/02-on-this-page.js index 08e47a32..8cf02ba4 100644 --- a/src/js/02-on-this-page.js +++ b/src/js/02-on-this-page.js @@ -30,8 +30,13 @@ var list = headings.reduce(function (accum, heading) { var link = document.createElement('a') var headingClone = heading.cloneNode(true) - headingClone.querySelectorAll('div, a').forEach(function (el) { el.remove() }) - link.innerHTML = headingClone.innerHTML + // console.log(headingClone) + headingClone.querySelectorAll('div, a.anchor').forEach(function (el) { el.remove() }) + if (headingClone.querySelector('a')) { + link.textContent = headingClone.textContent + } else { + link.innerHTML = headingClone.innerHTML + } links[(link.href = '#' + heading.id)] = link var listItem = document.createElement('li') listItem.dataset.level = parseInt(heading.nodeName.slice(1)) - 1