Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to main #680

Merged
merged 5 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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