@eui/showcase 21.0.0-next.2 → 21.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { signal, Injectable, Input, Component, inject, HostBinding, ViewEncapsulation,
|
|
2
|
+
import { signal, Injectable, Input, Component, inject, ChangeDetectorRef, HostBinding, ViewEncapsulation, booleanAttribute, ViewChild, forwardRef, ContentChildren, Directive, HostListener, ContentChild, ElementRef } from '@angular/core';
|
|
3
3
|
import * as i2 from '@eui/components/eui-icon';
|
|
4
4
|
import { EUI_ICON } from '@eui/components/eui-icon';
|
|
5
5
|
import * as i2$1 from '@eui/components/eui-button';
|
|
@@ -119,6 +119,7 @@ class DocPageDevGuideComponent {
|
|
|
119
119
|
this.http = inject(HttpClient);
|
|
120
120
|
this.router = inject(Router);
|
|
121
121
|
this.route = inject(ActivatedRoute);
|
|
122
|
+
this.cdRef = inject((ChangeDetectorRef));
|
|
122
123
|
}
|
|
123
124
|
ngOnInit() {
|
|
124
125
|
this.subscription = this.route.url.subscribe((u) => {
|
|
@@ -142,6 +143,24 @@ class DocPageDevGuideComponent {
|
|
|
142
143
|
// }
|
|
143
144
|
// return `<h${depth}>${text}</h${depth}>`;
|
|
144
145
|
// };
|
|
146
|
+
this.markdownService.renderer.heading = (text, level, raw) => {
|
|
147
|
+
if (level === 2 || level === 3) {
|
|
148
|
+
const newHeader = `<h${level} id="${raw}">${text}</h${level}>`;
|
|
149
|
+
if (text.indexOf('<a ') === -1 && text.indexOf('<em>') === -1) {
|
|
150
|
+
this.headers.push({ id: raw, label: raw, level: level });
|
|
151
|
+
}
|
|
152
|
+
return newHeader;
|
|
153
|
+
}
|
|
154
|
+
return `<h${level}>${text}</h${level}>`;
|
|
155
|
+
};
|
|
156
|
+
// this.markdownService.renderer.heading = ({ text, level, raw }: Tokens.Heading) => {
|
|
157
|
+
// const escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
|
|
158
|
+
// return '<h' + level + '>' +
|
|
159
|
+
// '<a name="' + escapedText + '" class="anchor" href="#' + escapedText + '">' +
|
|
160
|
+
// '<span class="header-link"></span>' +
|
|
161
|
+
// '</a>' + text +
|
|
162
|
+
// '</h' + level + '>';
|
|
163
|
+
// };
|
|
145
164
|
}
|
|
146
165
|
ngAfterViewInit() {
|
|
147
166
|
this.route.fragment.pipe(take(1)).subscribe((fragment) => {
|
|
@@ -180,6 +199,7 @@ class DocPageDevGuideComponent {
|
|
|
180
199
|
const filePath = `${contextRoot}/assets/${mdPath}.md`;
|
|
181
200
|
this.http.get(filePath, { responseType: 'text' }).pipe(map((md) => md.replace(new RegExp(`assets/${this.rootDocsFolder}`, 'g'), `${contextRoot}/assets/${this.rootDocsFolder}`))).subscribe((md) => {
|
|
182
201
|
this.markdown = md;
|
|
202
|
+
this.cdRef.detectChanges();
|
|
183
203
|
const top = document.getElementById('top');
|
|
184
204
|
top.scrollIntoView();
|
|
185
205
|
});
|