only create toc for topics ignore replies

This commit is contained in:
Joe 2019-03-09 10:34:30 +08:00 committed by GitHub
parent 82915d7ff0
commit 6133da21d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -267,7 +267,11 @@ I18n.translations[I18n.currentLocale()].js.composer.contains_dtoc = I18n.t(
$.fn.dtoc = $elem => { $.fn.dtoc = $elem => {
run.scheduleOnce("sync", () => { run.scheduleOnce("sync", () => {
if ($elem.hasClass("d-editor-preview")) return; if ($elem.hasClass("d-editor-preview")) return;
if (!$elem.parents("article#post_1").length) return
const dToc = $elem.find(`[data-theme-toc="true"]`); const dToc = $elem.find(`[data-theme-toc="true"]`);
if (!dToc.length) return this; if (!dToc.length) return this;