mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
feat(docs-infra): Adds copy link to anchor functionality
Enables copying a direct link to any section by clicking its anchor. Also updates the aria-label to remove the code tag
This commit is contained in:
committed by
Pawel Kozlowski
parent
c0d8be7fa1
commit
4e89bc6244
@@ -44,7 +44,10 @@ export class TableOfContentsLoader {
|
||||
|
||||
private getHeadingTitle(heading: HTMLHeadingElement): string {
|
||||
const div: HTMLDivElement = this.document.createElement('div');
|
||||
|
||||
div.innerHTML = heading.innerHTML;
|
||||
// Remove any existing copy link buttons to avoid including their text in the title
|
||||
div.querySelectorAll('docs-copy-link-button').forEach((el) => el.remove());
|
||||
|
||||
return (div.textContent || '').trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user