mirror of
https://github.com/discourse/DiscoTOC.git
synced 2026-11-01 01:48:38 -05:00
Merge branch 'main' into feature/add-expand-all-button
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
< 3.5.0.beta1-dev: 05d454d1dbea9688d76ae037c5b7077f75c15fea
|
||||
< 3.4.0.beta2-dev: f1d183eaac44b647978cdd481ec06407f4008d7c
|
||||
< 3.4.0.beta1-dev: 51f099289db87d3f0e5fe89298afaeaf899bebc7
|
||||
< 3.3.0.beta1-dev: 3179e886a366e15fb0de3c869990c2292763bd89
|
||||
|
||||
+53
-39
@@ -1,8 +1,9 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (7.2.1.1)
|
||||
activesupport (8.0.2)
|
||||
base64
|
||||
benchmark (>= 0.3)
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||
connection_pool (>= 2.2.5)
|
||||
@@ -12,68 +13,81 @@ GEM
|
||||
minitest (>= 5.1)
|
||||
securerandom (>= 0.3)
|
||||
tzinfo (~> 2.0, >= 2.0.5)
|
||||
uri (>= 0.13.1)
|
||||
ast (2.4.2)
|
||||
base64 (0.2.0)
|
||||
bigdecimal (3.1.8)
|
||||
concurrent-ruby (1.3.4)
|
||||
connection_pool (2.4.1)
|
||||
benchmark (0.4.0)
|
||||
bigdecimal (3.1.9)
|
||||
concurrent-ruby (1.3.5)
|
||||
connection_pool (2.5.0)
|
||||
drb (2.2.1)
|
||||
i18n (1.14.6)
|
||||
i18n (1.14.7)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (2.7.2)
|
||||
language_server-protocol (3.17.0.3)
|
||||
logger (1.6.1)
|
||||
minitest (5.25.1)
|
||||
json (2.10.2)
|
||||
language_server-protocol (3.17.0.4)
|
||||
lint_roller (1.1.0)
|
||||
logger (1.6.6)
|
||||
minitest (5.25.5)
|
||||
parallel (1.26.3)
|
||||
parser (3.3.5.0)
|
||||
parser (3.3.7.1)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
prettier_print (1.2.1)
|
||||
racc (1.8.1)
|
||||
rack (3.1.8)
|
||||
rack (3.1.12)
|
||||
rainbow (3.1.1)
|
||||
regexp_parser (2.9.2)
|
||||
rubocop (1.67.0)
|
||||
regexp_parser (2.10.0)
|
||||
rubocop (1.74.0)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (>= 3.17.0)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 2.4, < 3.0)
|
||||
rubocop-ast (>= 1.32.2, < 2.0)
|
||||
regexp_parser (>= 2.9.3, < 3.0)
|
||||
rubocop-ast (>= 1.38.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 3.0)
|
||||
rubocop-ast (1.32.3)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.38.1)
|
||||
parser (>= 3.3.1.0)
|
||||
rubocop-capybara (2.21.0)
|
||||
rubocop (~> 1.41)
|
||||
rubocop-discourse (3.8.2)
|
||||
rubocop-capybara (2.22.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-discourse (3.12.1)
|
||||
activesupport (>= 6.1)
|
||||
rubocop (>= 1.59.0)
|
||||
rubocop-capybara (>= 2.0.0)
|
||||
rubocop-factory_bot (>= 2.0.0)
|
||||
rubocop-rails (>= 2.25.0)
|
||||
lint_roller (>= 1.1.0)
|
||||
rubocop (>= 1.73.2)
|
||||
rubocop-capybara (>= 2.22.0)
|
||||
rubocop-factory_bot (>= 2.27.0)
|
||||
rubocop-rails (>= 2.30.3)
|
||||
rubocop-rspec (>= 3.0.1)
|
||||
rubocop-rspec_rails (>= 2.30.0)
|
||||
rubocop-factory_bot (2.26.1)
|
||||
rubocop (~> 1.61)
|
||||
rubocop-rails (2.26.2)
|
||||
rubocop-rspec_rails (>= 2.31.0)
|
||||
rubocop-factory_bot (2.27.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rails (2.30.3)
|
||||
activesupport (>= 4.2.0)
|
||||
lint_roller (~> 1.1)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 1.52.0, < 2.0)
|
||||
rubocop-ast (>= 1.31.1, < 2.0)
|
||||
rubocop-rspec (3.1.0)
|
||||
rubocop (~> 1.61)
|
||||
rubocop-rspec_rails (2.30.0)
|
||||
rubocop (~> 1.61)
|
||||
rubocop-rspec (~> 3, >= 3.0.1)
|
||||
rubocop (>= 1.72.1, < 2.0)
|
||||
rubocop-ast (>= 1.38.0, < 2.0)
|
||||
rubocop-rspec (3.5.0)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rspec_rails (2.31.0)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop-rspec (~> 3.5)
|
||||
ruby-progressbar (1.13.0)
|
||||
securerandom (0.3.1)
|
||||
securerandom (0.4.1)
|
||||
syntax_tree (6.2.0)
|
||||
prettier_print (>= 1.2.0)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (2.6.0)
|
||||
unicode-display_width (3.1.4)
|
||||
unicode-emoji (~> 4.0, >= 4.0.4)
|
||||
unicode-emoji (4.0.4)
|
||||
uri (1.0.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
@@ -83,4 +97,4 @@ DEPENDENCIES
|
||||
syntax_tree
|
||||
|
||||
BUNDLED WITH
|
||||
2.5.21
|
||||
2.6.6
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 Discourse
|
||||
Copyright (c) Civilized Discourse Construction Kit, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
+43
-20
@@ -7,44 +7,56 @@ $padding-basis: 0.75em;
|
||||
}
|
||||
}
|
||||
|
||||
.overlay .d-toc-main {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.d-toc-main {
|
||||
min-width: 6em;
|
||||
max-width: 13em;
|
||||
|
||||
word-wrap: break-word;
|
||||
box-sizing: border-box;
|
||||
|
||||
.overlay & {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: 0.15em 0;
|
||||
color: var(--primary-medium);
|
||||
|
||||
&.scroll-to-bottom {
|
||||
padding-left: $padding-basis;
|
||||
}
|
||||
}
|
||||
|
||||
.timeline-toggle {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
#d-toc {
|
||||
border-left: 1px solid var(--primary-low);
|
||||
max-height: calc(100vh - 4.5em - var(--header-offset));
|
||||
overflow: auto;
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li.d-toc-item {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
padding-left: $padding-basis;
|
||||
line-height: var(--line-height-large);
|
||||
|
||||
> ul {
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
opacity: 0.5;
|
||||
transition: opacity 0.3s ease-in-out, max-height 0.3s ease-in-out;
|
||||
transition:
|
||||
opacity 0.3s ease-in-out,
|
||||
max-height 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
&.active,
|
||||
&.expand-all,
|
||||
.d-toc-wrapper.overlay & {
|
||||
@@ -54,6 +66,7 @@ $padding-basis: 0.75em;
|
||||
opacity: 1;
|
||||
animation: hide-scroll 0.3s backwards;
|
||||
}
|
||||
|
||||
// hides the scrollbar while subsection expands
|
||||
@keyframes hide-scroll {
|
||||
from,
|
||||
@@ -62,13 +75,16 @@ $padding-basis: 0.75em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> a:hover {
|
||||
color: var(--primary-high);
|
||||
}
|
||||
|
||||
&.direct-active > a {
|
||||
position: relative;
|
||||
color: var(--primary);
|
||||
&:before {
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
width: 1px;
|
||||
margin-top: -1px;
|
||||
@@ -81,13 +97,16 @@ $padding-basis: 0.75em;
|
||||
|
||||
> ul > li > ul {
|
||||
font-size: var(--font-down-1);
|
||||
|
||||
> li:first-child {
|
||||
padding-top: 0.25em;
|
||||
}
|
||||
|
||||
> li {
|
||||
padding-bottom: 0.15em;
|
||||
}
|
||||
li.direct-active > a:before {
|
||||
|
||||
li.direct-active > a::before {
|
||||
// it's odd that we need this
|
||||
margin-left: -1px;
|
||||
}
|
||||
@@ -133,16 +152,17 @@ html.rtl SELECTOR {
|
||||
}
|
||||
}
|
||||
}
|
||||
// END active line marker
|
||||
|
||||
// END active line marker
|
||||
.d-toc-mini {
|
||||
height: 100%;
|
||||
|
||||
button {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
// overlayed timeline (on mobile and narrow screens)
|
||||
// overlaid timeline (on mobile and narrow screens)
|
||||
.topic-navigation.with-topic-progress {
|
||||
.d-toc-wrapper {
|
||||
position: fixed;
|
||||
@@ -157,18 +177,22 @@ html.rtl SELECTOR {
|
||||
box-shadow: var(--shadow-dropdown);
|
||||
z-index: z("modal", "overlay");
|
||||
transition: all 0.2s ease-in-out;
|
||||
|
||||
.d-toc-main {
|
||||
width: 100%;
|
||||
padding: 0.5em;
|
||||
height: 100%;
|
||||
|
||||
#d-toc {
|
||||
max-height: calc(100% - 3em);
|
||||
}
|
||||
}
|
||||
|
||||
&.overlay {
|
||||
right: 0;
|
||||
width: 75vw;
|
||||
opacity: 1;
|
||||
|
||||
.d-toc-main #d-toc li.d-toc-item ul {
|
||||
transition: none;
|
||||
}
|
||||
@@ -189,7 +213,7 @@ html.rtl SELECTOR {
|
||||
// core sets first child's top margin to 0
|
||||
// ensure it's also 0 when TOC markup is first
|
||||
.cooked > div[data-theme-toc]:first-child + * {
|
||||
margin-top: 0px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
// RTL Support
|
||||
@@ -208,6 +232,7 @@ html.rtl SELECTOR {
|
||||
.topic-navigation.with-topic-progress .d-toc-wrapper {
|
||||
right: unset;
|
||||
left: -100vw;
|
||||
|
||||
&.overlay {
|
||||
right: unset;
|
||||
left: 0;
|
||||
@@ -227,7 +252,8 @@ body.toc-for-replies-enabled .d-editor-preview [data-theme-toc] {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
&:before {
|
||||
|
||||
&::before {
|
||||
content: "#{$composer_toc_text}";
|
||||
}
|
||||
}
|
||||
@@ -237,9 +263,11 @@ body.toc-for-replies-enabled .d-editor-preview [data-theme-toc] {
|
||||
position: sticky;
|
||||
top: calc(var(--header-offset, 60px) + 1em);
|
||||
max-height: calc(100vh - 2em - var(--header-offset, 60px));
|
||||
|
||||
.mobile-view & {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.d-toc-main {
|
||||
display: block;
|
||||
}
|
||||
@@ -257,21 +285,16 @@ body.toc-for-replies-enabled .d-editor-preview [data-theme-toc] {
|
||||
}
|
||||
}
|
||||
|
||||
// toggle in timeline dtoc
|
||||
.d-toc-main {
|
||||
.timeline-toggle {
|
||||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
// jump to bottom in timeline
|
||||
.d-toc-footer-icons {
|
||||
font-size: var(--font-down-1);
|
||||
margin-top: 0.5em;
|
||||
|
||||
button {
|
||||
color: var(--tertiary);
|
||||
|
||||
.d-icon {
|
||||
color: currentColor;
|
||||
color: currentcolor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import didInsert from "@ember/render-modifiers/modifiers/did-insert";
|
||||
import didUpdate from "@ember/render-modifiers/modifiers/did-update";
|
||||
import { service } from "@ember/service";
|
||||
import DButton from "discourse/components/d-button";
|
||||
import { debounce } from "discourse/lib/decorators";
|
||||
import { headerOffset } from "discourse/lib/offset-calculator";
|
||||
import { debounce } from "discourse-common/utils/decorators";
|
||||
import TocHeading from "../components/toc-heading";
|
||||
import TocLargeButtons from "../components/toc-large-buttons";
|
||||
import TocMiniButtons from "../components/toc-mini-buttons";
|
||||
|
||||
@@ -2,7 +2,7 @@ import Component from "@glimmer/component";
|
||||
import { action } from "@ember/object";
|
||||
import { service } from "@ember/service";
|
||||
import DButton from "discourse/components/d-button";
|
||||
import i18n from "discourse-common/helpers/i18n";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
export default class TocLargeButtons extends Component {
|
||||
@service tocProcessor;
|
||||
|
||||
@@ -10,6 +10,7 @@ import TocToggle from "../components/toc-toggle";
|
||||
|
||||
export default class TocTimeline extends Component {
|
||||
@service tocProcessor;
|
||||
|
||||
@tracked
|
||||
isTocVisible = localStorage.getItem("tocVisibility") === "true" || true;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { service } from "@ember/service";
|
||||
import DButton from "discourse/components/d-button";
|
||||
import i18n from "discourse-common/helpers/i18n";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
export default class TocToggle extends Component {
|
||||
@service tocProcessor;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import I18n from "I18n";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
export default {
|
||||
name: "disco-toc-composer",
|
||||
|
||||
@@ -5,6 +5,7 @@ import { slugify } from "discourse/lib/utilities";
|
||||
|
||||
export default class TocProcessor extends Service {
|
||||
@service router;
|
||||
|
||||
@tracked hasTOC = false;
|
||||
@tracked postContent = null;
|
||||
@tracked postID = null;
|
||||
|
||||
+9
-7
@@ -1,15 +1,17 @@
|
||||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@discourse/lint-configs": "2.2.2",
|
||||
"ember-template-lint": "6.0.0",
|
||||
"eslint": "9.15.0",
|
||||
"prettier": "2.8.8"
|
||||
"@discourse/lint-configs": "2.11.1",
|
||||
"ember-template-lint": "7.0.1",
|
||||
"eslint": "9.22.0",
|
||||
"prettier": "3.5.3",
|
||||
"stylelint": "16.16.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18",
|
||||
"node": ">= 22",
|
||||
"npm": "please-use-pnpm",
|
||||
"yarn": "please-use-pnpm",
|
||||
"pnpm": ">= 9"
|
||||
}
|
||||
"pnpm": "9.x"
|
||||
},
|
||||
"packageManager": "[email protected]"
|
||||
}
|
||||
|
||||
Generated
+1572
-1559
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
export default {
|
||||
extends: ["@discourse/lint-configs/stylelint"],
|
||||
};
|
||||
Reference in New Issue
Block a user