Fixes bug introduced in e819866

Table of content was made unavailable regardless of whether one was
provided by the page or not. This commit fixes this issue by making an
unavailable TOC only if one is not provided by the web page, otherwise
the TOC will be available.
This commit is contained in:
Lucien Cartier-Tilet 2020-05-09 14:45:26 +02:00
parent 90106df0f6
commit 3c942b4b8f
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -63,10 +63,11 @@ Future<void> reorganizeHtml() async {
linkifyImg(); linkifyImg();
// Add correct class to TOC // Add correct class to TOC
final toc = (querySelector('#table-of-contents') ?? Element.div() final toc = (querySelector('#table-of-contents') ??
..attributes['id'] = 'table-of-contents') (Element.div()
..classes.add('dropdown') ..attributes['id'] = 'table-of-contents'
..innerText = "Table of Contents Unavailable"; ..innerText = "Table of Contents Unavailable"))
..classes.add('dropdown');
querySelector('#toc-drop').append(toc); querySelector('#toc-drop').append(toc);
// Remove all <br> tags from HTML // Remove all <br> tags from HTML