fix toc with > 10 items on the same level, closes #3182

This commit is contained in:
zadam 2022-10-09 22:20:11 +02:00
parent c2308b7a5d
commit c6d4eb486e

View File

@ -23,7 +23,7 @@ const TPL = `<div class="toc-widget">
.toc-widget {
padding: 10px;
contain: none;
overflow:auto;
overflow: auto;
}
.toc ol {
@ -31,7 +31,15 @@ const TPL = `<div class="toc-widget">
}
.toc > ol {
padding-left: 10px;
padding-left: 20px;
}
.toc li {
cursor: pointer;
}
.toc li:hover {
font-weight: bold;
}
</style>
@ -154,13 +162,7 @@ export default class TocWidget extends CollapsibleWidget {
//
const headingText = $("<div>").html(m[2]).text();
const $li = $('<li style="cursor:pointer">').text(headingText);
// XXX Do this with CSS? How to inject CSS in doRender?
$li.hover(function () {
$(this).css("font-weight", "bold");
}).mouseout(function () {
$(this).css("font-weight", "normal");
});
const $li = $('<li>').text(headingText);
$li.on("click", () => this.jumpToHeading(headingIndex));
$ols[$ols.length - 1].append($li);
headingCount = headingIndex;