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

@ -31,7 +31,15 @@ const TPL = `<div class="toc-widget">
} }
.toc > ol { .toc > ol {
padding-left: 10px; padding-left: 20px;
}
.toc li {
cursor: pointer;
}
.toc li:hover {
font-weight: bold;
} }
</style> </style>
@ -154,13 +162,7 @@ export default class TocWidget extends CollapsibleWidget {
// //
const headingText = $("<div>").html(m[2]).text(); const headingText = $("<div>").html(m[2]).text();
const $li = $('<li style="cursor:pointer">').text(headingText); const $li = $('<li>').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");
});
$li.on("click", () => this.jumpToHeading(headingIndex)); $li.on("click", () => this.jumpToHeading(headingIndex));
$ols[$ols.length - 1].append($li); $ols[$ols.length - 1].append($li);
headingCount = headingIndex; headingCount = headingIndex;