From 1ee43956c236200224de786861adb7cbd5258aeb Mon Sep 17 00:00:00 2001 From: Joe Date: Sun, 14 Apr 2019 13:47:22 -0700 Subject: [PATCH] DiscoTOC v0.2 --- common/common.scss | 67 +++-- common/header.html | 682 ++++++++++++++++++++++++--------------------- locales/en.yml | 1 - settings.yml | 15 + 4 files changed, 420 insertions(+), 345 deletions(-) diff --git a/common/common.scss b/common/common.scss index 5ff428a..9229214 100644 --- a/common/common.scss +++ b/common/common.scss @@ -1,23 +1,6 @@ @import "common/foundation/variables"; .d-toc-regular { - .cooked { - h1, - h2, - h3, - h4, - h5, - h6 { - &:before { - display: block; - content: ""; - height: 70px; - margin-top: -70px; - pointer-events: none; - opacity: 0; - } - } - } [data-theme-toc] { display: none; } @@ -38,9 +21,9 @@ margin: 0; padding: 0; border: none; - line-height: 30px; } .d-toc-item { + padding: 6px 0; a { color: $primary-high; } @@ -149,14 +132,20 @@ font-size: 0.8em; } } - .d-toc-anchor-link { - font-size: initial; - color: $primary-medium; - :not(.rtl) & { - margin-left: 5px; + .d-toc-post-heading { + .d-toc-anchor-link { + font-size: initial; + color: transparent; + transition: color 0.15s linear; + :not(.rtl) & { + margin-left: 5px; + } + .rtl & { + margin-right: 5px; + } } - .rtl & { - margin-right: 5px; + &:hover .d-toc-anchor-link { + color: rgba($primary-medium, 0.6); } } } @@ -179,7 +168,7 @@ max-height: 85vh; padding-left: 0; margin-top: 50px; - + position: -webkit-sticky; position: sticky; top: 75px; margin-bottom: 135px; @@ -197,6 +186,12 @@ } .d-toc-article { display: flex; + .post-notice { + display: none; + } + .topic-map { + margin-bottom: 0; + } > .row { :not(.rtl) & { border-right: 1px solid $primary-low; @@ -260,6 +255,7 @@ background: $secondary; margin-bottom: 1em; + position: -webkit-sticky; position: sticky; top: 0; display: flex; @@ -303,14 +299,33 @@ } } +.d-toc-timeline { + .timeline-container, + #topic-progress-wrapper { + opacity: 0; + pointer-events: none; + } + &.d-toc-timeline-visible { + .timeline-container, + #topic-progress-wrapper { + opacity: 1; + pointer-events: initial; + } + } +} + .edit-title .d-editor-preview [data-theme-toc] { background: $tertiary; color: $secondary; border-top: 2px solid $secondary; + position: -webkit-sticky; position: sticky; top: 0; height: 30px; display: flex; align-items: center; justify-content: center; + &:before { + content: "#{$composer_toc_text}"; + } } diff --git a/common/header.html b/common/header.html index 8fdd97b..b561e3d 100644 --- a/common/header.html +++ b/common/header.html @@ -1,345 +1,391 @@ diff --git a/locales/en.yml b/locales/en.yml index ffb6ecb..3f16910 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -1,4 +1,3 @@ en: table_of_contents: "table of contents" insert_table_of_contents: "Insert table of contents" - topic_will_contain_a_table_of_contents: "This topic will contain a table of contents" diff --git a/settings.yml b/settings.yml index 02e28d4..348b9de 100644 --- a/settings.yml +++ b/settings.yml @@ -1,2 +1,17 @@ +minimum_trust_level_to_create_TOC: + default: 1 + type: enum + choices: + - 0 + - 1 + - 2 + - 3 + - 4 + description: + en: "The minimum trust level a user must have in order to see the TOC button in the composer" +composer_toc_text: + default: "This topic will contain a table of contents" table_of_contents_icon: default: "align-left" +anchor_icon: + default: "hashtag"