1
0
mirror of synced 2026-05-22 18:33:15 +00:00

Merge branch 'feature/add-expand-all-button' of https://github.com/discourse/DiscoTOC into feature/add-expand-all-button

This commit is contained in:
chapoi
2025-07-24 15:08:56 +02:00
12 changed files with 508 additions and 479 deletions
+1
View File
@@ -1,3 +1,4 @@
< 3.5.0.beta5-dev: 8bd98f0288a152b4e06a46dbb3bb73e6bc26f013
< 3.5.0.beta1-dev: 05d454d1dbea9688d76ae037c5b7077f75c15fea
< 3.4.0.beta2-dev: f1d183eaac44b647978cdd481ec06407f4008d7c
< 3.4.0.beta1-dev: 51f099289db87d3f0e5fe89298afaeaf899bebc7
+21 -19
View File
@@ -14,30 +14,31 @@ GEM
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
ast (2.4.2)
ast (2.4.3)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.9)
bigdecimal (3.2.0)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
drb (2.2.1)
connection_pool (2.5.3)
drb (2.2.3)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.10.2)
language_server-protocol (3.17.0.4)
json (2.12.2)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.6.6)
logger (1.7.0)
minitest (5.25.5)
parallel (1.26.3)
parser (3.3.7.1)
parallel (1.27.0)
parser (3.3.8.0)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
prism (1.4.0)
racc (1.8.1)
rack (3.1.12)
rack (3.1.16)
rainbow (3.1.1)
regexp_parser (2.10.0)
rubocop (1.74.0)
rubocop (1.75.8)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
@@ -45,11 +46,12 @@ GEM
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-ast (>= 1.44.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.1)
parser (>= 3.3.1.0)
rubocop-ast (1.44.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-capybara (2.22.1)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
@@ -65,13 +67,13 @@ GEM
rubocop-factory_bot (2.27.1)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rails (2.30.3)
rubocop-rails (2.32.0)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
rubocop (>= 1.72.1, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rspec (3.5.0)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.44.0, < 2.0)
rubocop-rspec (3.6.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rspec_rails (2.31.0)
@@ -97,4 +99,4 @@ DEPENDENCIES
syntax_tree
BUNDLED WITH
2.6.6
2.6.9
+2 -2
View File
@@ -2,7 +2,7 @@
$padding-basis: 0.75em;
@media screen and (min-width: 925px) {
@media screen and (width >= 925px) {
.container.posts {
// needs to be static, otherwise we get content shifts when the TOC shows/hides
grid-template-columns: 75% 25%;
@@ -312,7 +312,7 @@ body.toc-for-replies-enabled .d-editor-preview [data-theme-toc] {
// on shorter screens, we can keep this consistently in the same location
// this is kind of far away for tall screens, so the more variable position below might be better
@media screen and (max-height: 950px) {
@media screen and (height <= 950px) {
.timeline-toggle {
position: fixed;
bottom: 0;
@@ -0,0 +1,11 @@
import Component from "@ember/component";
import { classNames, tagName } from "@ember-decorators/component";
import TocTimeline from "../../components/toc-timeline";
@tagName("div")
@classNames("below-docs-topic-outlet", "d-toc-wrapper")
export default class DTocWrapper extends Component {
<template>
<TocTimeline @topic={{@outletArgs.topic}} @renderTimeline={{true}} />
</template>
}
@@ -1 +0,0 @@
<TocTimeline @topic={{@outletArgs.topic}} @renderTimeline={{true}} />
@@ -0,0 +1,15 @@
import Component from "@ember/component";
import { classNames, tagName } from "@ember-decorators/component";
import TocTimeline from "../../components/toc-timeline";
@tagName("div")
@classNames("topic-navigation-outlet", "d-toc-wrapper")
export default class DTocWrapper extends Component {
<template>
<TocTimeline
@topic={{@outletArgs.topic}}
@renderTimeline={{@outletArgs.renderTimeline}}
@topicProgressExpanded={{@outletArgs.topicProgressExpanded}}
/>
</template>
}
@@ -1,5 +0,0 @@
<TocTimeline
@topic={{@outletArgs.topic}}
@renderTimeline={{@outletArgs.renderTimeline}}
@topicProgressExpanded={{@outletArgs.topicProgressExpanded}}
/>
+4 -4
View File
@@ -1,11 +1,11 @@
{
"private": true,
"devDependencies": {
"@discourse/lint-configs": "2.11.1",
"ember-template-lint": "7.0.1",
"eslint": "9.22.0",
"@discourse/lint-configs": "2.21.0",
"ember-template-lint": "7.7.0",
"eslint": "9.27.0",
"prettier": "3.5.3",
"stylelint": "16.16.0"
"stylelint": "16.19.1"
},
"engines": {
"node": ">= 22",
+435 -437
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
# frozen_string_literal: true
RSpec.describe "Core features", type: :system do
before { upload_theme_or_component }
it_behaves_like "having working core features"
end
+10 -10
View File
@@ -22,17 +22,17 @@ RSpec.describe "DiscoTOC", system: true do
visit("/c/#{category.id}")
find("#create-topic").click
find(".toolbar-popup-menu-options").click
find(".toolbar-menu__options-trigger").click
expect(page).to have_css("[data-name='Insert table of contents']")
expect(page).to have_css("button[title='Insert table of contents']")
end
it "table of contents button inserts markup into composer" do
visit("/c/#{category.id}")
find("#create-topic").click
find(".toolbar-popup-menu-options").click
find("[data-name='Insert table of contents']").click
find(".toolbar-menu__options-trigger").click
find("button[title='Insert table of contents']").click
expect(page).to have_css(".d-editor-preview [data-theme-toc='true']")
end
@@ -44,18 +44,18 @@ RSpec.describe "DiscoTOC", system: true do
visit("/c/#{category.id}")
find("#create-topic").click
find(".toolbar-popup-menu-options").click
find(".toolbar-menu__options-trigger").click
expect(page).to have_no_css("[data-name='Insert table of contents']")
expect(page).to have_no_css("button[title='Insert table of contents']")
end
it "table of contents button does not appear on replies" do
visit("/t/#{topic_1.id}")
find(".reply").click
find(".toolbar-popup-menu-options").click
find(".toolbar-menu__options-trigger").click
expect(page).to have_no_css("[data-name='Insert table of contents']")
expect(page).to have_no_css("button[title='Insert table of contents']")
end
context "when enable TOC for replies" do
@@ -68,9 +68,9 @@ RSpec.describe "DiscoTOC", system: true do
visit("/t/#{topic_1.id}")
find(".reply").click
find(".toolbar-popup-menu-options").click
find(".toolbar-menu__options-trigger").click
expect(page).to have_css("[data-name='Insert table of contents']")
expect(page).to have_css("button[title='Insert table of contents']")
end
end
end
+2 -1
View File
@@ -108,7 +108,8 @@ RSpec.describe "DiscoTOC", system: true do
expect(page).to have_css(
".d-toc-item.d-toc-h1.active a[data-d-toc='toc-h1-heading-1-on-the-source-topic']",
)
find("a[href='/t/#{topic_1.slug}/#{topic_1.id}'").click
find("a[href='/t/#{topic_1.slug}/#{topic_1.id}']").click
expect(page).to have_css(".d-toc-item.d-toc-h1.active a[data-d-toc='toc-h1-heading-1']")
expect(page).to have_no_css("a[data-d-toc='toc-h1-heading-1-on-the-source-topic']")