From b4ad011dc1cec22b088578ca019f76c0c9ba4612 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 15 Aug 2016 11:27:32 +0800 Subject: Fix toc id naming to avoid overlap with user toc --- public/js/extra.js | 8 ++++---- public/js/index.js | 6 +++--- public/js/pretty.js | 6 +++--- public/views/body.ejs | 4 ++-- public/views/html.hbs | 8 ++++---- public/views/pretty.ejs | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/public/js/extra.js b/public/js/extra.js index 824b78d1..714e2057 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -495,9 +495,9 @@ function exportToHTML(view) { var filename = renderFilename(ui.area.markdown) + '.html'; var src = generateCleanHTML(view); //generate toc - var toc = $('#toc').clone(); + var toc = $('#ui-toc').clone(); toc.find('*').removeClass('active'); - var tocAffix = $('#toc-affix').clone(); + var tocAffix = $('#ui-toc-affix').clone(); tocAffix.find('*').removeClass('active'); //generate html via template $.get(serverurl + '/css/html.min.css', function (css) { @@ -508,8 +508,8 @@ function exportToHTML(view) { title: title, css: css, html: src[0].outerHTML, - toc: toc.html(), - 'toc-affix': tocAffix.html(), + 'ui-toc': toc.html(), + 'ui-toc-affix': tocAffix.html(), lang: (md && md.meta && md.meta.lang) ? 'lang="' + md.meta.lang + '"' : null, dir: (md && md.meta && md.meta.dir) ? 'dir="' + md.meta.dir + '"' : null }; diff --git a/public/js/index.js b/public/js/index.js index a3581cfd..43b7525c 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -3157,7 +3157,7 @@ function updateViewInner() { } // only render again when meta changed if (JSON.stringify(md.meta) != JSON.stringify(lastMeta)) { - parseMeta(md, ui.area.codemirror, ui.area.markdown, $('#toc'), $('#toc-affix')); + parseMeta(md, ui.area.codemirror, ui.area.markdown, $('#ui-toc'), $('#ui-toc-affix')); rendered = md.render(value); } // prevent XSS @@ -3172,8 +3172,8 @@ function updateViewInner() { autoLinkify(ui.area.markdown); deduplicatedHeaderId(ui.area.markdown); renderTOC(ui.area.markdown); - generateToc('toc'); - generateToc('toc-affix'); + generateToc('ui-toc'); + generateToc('ui-toc-affix'); generateScrollspy(); updateScrollspy(); smoothHashScroll(); diff --git a/public/js/pretty.js b/public/js/pretty.js index adc8c741..0ca7ee18 100644 --- a/public/js/pretty.js +++ b/public/js/pretty.js @@ -21,7 +21,7 @@ if (md.meta.type && md.meta.type === 'slide') { } // only render again when meta changed if (JSON.stringify(md.meta) != JSON.stringify(lastMeta)) { - parseMeta(md, null, markdown, $('#toc'), $('#toc-affix')); + parseMeta(md, null, markdown, $('#ui-toc'), $('#ui-toc-affix')); rendered = md.render(text); } // prevent XSS @@ -34,8 +34,8 @@ finishView(markdown); autoLinkify(markdown); deduplicatedHeaderId(markdown); renderTOC(markdown); -generateToc('toc'); -generateToc('toc-affix'); +generateToc('ui-toc'); +generateToc('ui-toc-affix'); smoothHashScroll(); createtime = lastchangeui.time.attr('data-createtime'); lastchangetime = lastchangeui.time.attr('data-updatetime'); diff --git a/public/views/body.ejs b/public/views/body.ejs index d2010b4a..acf929ad 100644 --- a/public/views/body.ejs +++ b/public/views/body.ejs @@ -29,11 +29,11 @@ -