From 7124c0aee5486aab74272c81ceb3e383b2e3a7f7 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Thu, 30 Jun 2016 21:50:38 -0400 Subject: Replace homemade table of content generator with existing jQuery plugin. Now toc is linked to document headings. --- view/tpl/wiki.tpl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'view/tpl') diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl index 1d8570828..7617808f4 100644 --- a/view/tpl/wiki.tpl +++ b/view/tpl/wiki.tpl @@ -190,6 +190,7 @@ $(document).ready(function () { wiki_refresh_page_list(); + $("#wiki-toc").toc({content: "#wiki-preview", headings: "h1,h2,h3,h4"}); // Show Edit tab first. Otherwise the Ace editor does not load. $("#wiki-nav-tabs li:eq(1) a").tab('show'); }); @@ -203,6 +204,7 @@ $.post("wiki/{{$channel}}/preview", {content: editor.getValue(), resource_id: window.wiki_resource_id}, function (data) { if (data.success) { $('#wiki-preview').html(data.html); + $("#wiki-toc").toc({content: "#wiki-preview", headings: "h1,h2,h3,h4"}); } else { window.console.log('Error previewing page.'); } -- cgit v1.2.3