summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorWu Cheng-Han2016-08-15 11:27:32 +0800
committerWu Cheng-Han2016-08-15 11:27:32 +0800
commitb4ad011dc1cec22b088578ca019f76c0c9ba4612 (patch)
treecc879b775b9538bbfe2a3cbdaa4c23cb1d20ebb8 /public/js
parenta013c9d3bc0eb98c935e80bdb694c1a1cf7bd4c4 (diff)
Fix toc id naming to avoid overlap with user toc
Diffstat (limited to 'public/js')
-rw-r--r--public/js/extra.js8
-rw-r--r--public/js/index.js6
-rw-r--r--public/js/pretty.js6
3 files changed, 10 insertions, 10 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');