Skip to content

Commit

Permalink
Merge pull request #680 from City-of-Helsinki/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrsky authored Aug 16, 2024
2 parents 874125c + b77b616 commit 86fb9ef
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .platform/schema
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7
8
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"drupal/raven": "^5.0",
"drupal/redis": "^1.5",
"drupal/search_api": "^1.23",
"drupal/stage_file_proxy": "^2.0",
"drupal/ultimate_cron": "^2.0@alpha",
"drupal/views_rss": "^2.0@RC",
"drush/drush": "^12",
Expand Down
69 changes: 37 additions & 32 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ global-styling:
updating-news-table-of-contents:
js:
dist/js/updatingNewsTableOfContents.min.js: {}
version: 1.0
version: 1.0.1
dependencies:
- core/once
- helfi_toc/table_of_contents
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,13 @@
reservedElems.forEach(function (elem) {
Drupal.tableOfContents.reservedIds.push(elem.id);
});
let exclusions = Drupal.tableOfContents.exclusions();

// Add exclusions for the news updates table of contents. NOTICE: The text paragraph is the only one that
// has paragraph as a prefix, so it might look a bit silly compared to the other selectors.
exclusions +=
':not(.components--upper *)' +
':not(.component--remote-video *)' +
':not(.component--paragraph-text *)' +
':not(.component--banner *)' +
':not(.component--image *)' +
':not(.block--news-of-interest *)' +
':not(#helfi-toc-table-of-contents-news-updates *)';
// Instead of targeting all headings on page, lets focus on only news update headings.
// This will generate selector like: .component--news-update h2.component__title, .component--news-update h3.component__title...
const titleComponents = Drupal.tableOfContents.titleComponents('.component__title').map(el => '.component--news-update ' + el);

// Craft table of contents for news item.
once('updating-news-table-of-contents', Drupal.tableOfContents.titleComponents(exclusions).join(','), mainContent)
once('updating-news-table-of-contents', titleComponents.join(','), mainContent)
.forEach(function (content) {

const { nodeName, anchorName} = Drupal.tableOfContents.createTableOfContentElements(content, []);
Expand Down

0 comments on commit 86fb9ef

Please sign in to comment.