@foblex/m-render 2.6.6 → 2.6.7
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.
@@ -594,7 +594,11 @@ let HandleNavigationLinksHandler = class HandleNavigationLinksHandler {
|
|
594
594
|
_router = inject(Router);
|
595
595
|
_browser = inject(BrowserService);
|
596
596
|
handle(request) {
|
597
|
-
|
597
|
+
let target = this._getTargetElement(request.event);
|
598
|
+
if (!target) {
|
599
|
+
return;
|
600
|
+
}
|
601
|
+
target = this._getClosestAnchorTag(target);
|
598
602
|
if (target && this._hasHref(target)) {
|
599
603
|
request.event.preventDefault();
|
600
604
|
const href = target.getAttribute('href');
|
@@ -607,7 +611,7 @@ let HandleNavigationLinksHandler = class HandleNavigationLinksHandler {
|
|
607
611
|
}
|
608
612
|
}
|
609
613
|
_getTargetElement(event) {
|
610
|
-
return event
|
614
|
+
return event?.target;
|
611
615
|
}
|
612
616
|
_getClosestAnchorTag(element) {
|
613
617
|
return element.closest('a');
|
@@ -656,7 +660,7 @@ function provideComponents(components) {
|
|
656
660
|
}
|
657
661
|
function extractComponent(loader) {
|
658
662
|
return loader().then(module => {
|
659
|
-
const component = Object.values(module).find((v) => typeof v === 'function' && v
|
663
|
+
const component = Object.values(module).find((v) => typeof v === 'function' && Object.prototype.hasOwnProperty.call(v, 'ɵcmp'));
|
660
664
|
if (!component) {
|
661
665
|
throw new Error('Component not found');
|
662
666
|
}
|
@@ -2734,7 +2738,10 @@ class FMarkdownRendererComponent {
|
|
2734
2738
|
}
|
2735
2739
|
_subscribeOnRouteChanges() {
|
2736
2740
|
this._router.events
|
2737
|
-
.pipe(startWith(null), debounceTime(50), switchMap(() => this._markdown.parse(this._provider.getMarkdownUrl(this._markdownPath))), tap((x) => this.value.set(x)), catchError((e, data) =>
|
2741
|
+
.pipe(startWith(null), debounceTime(50), switchMap(() => this._markdown.parse(this._provider.getMarkdownUrl(this._markdownPath))), tap((x) => this.value.set(x)), catchError((e, data) => {
|
2742
|
+
console.error('[MarkdownRenderer] parse error:', e);
|
2743
|
+
return of(data);
|
2744
|
+
}), takeUntilDestroyed(this._destroyRef))
|
2738
2745
|
.subscribe();
|
2739
2746
|
}
|
2740
2747
|
_updateRenderDependencies() {
|
@@ -2742,7 +2749,7 @@ class FMarkdownRendererComponent {
|
|
2742
2749
|
const html = this.value();
|
2743
2750
|
if (html && this._browser.isBrowser()) {
|
2744
2751
|
untracked(() => {
|
2745
|
-
|
2752
|
+
raf(() => {
|
2746
2753
|
this._mediator.execute(new RenderDynamicComponentsRequest(this._hostElement));
|
2747
2754
|
this._mediator.execute(new CalculateTableOfContentDataRequest(this._hostElement));
|
2748
2755
|
});
|
@@ -2751,6 +2758,7 @@ class FMarkdownRendererComponent {
|
|
2751
2758
|
}, { injector: this._injector });
|
2752
2759
|
}
|
2753
2760
|
_onDocumentClick(event) {
|
2761
|
+
console.log('_onDocumentClick2');
|
2754
2762
|
this._mediator.execute(new HandleNavigationLinksRequest(event));
|
2755
2763
|
}
|
2756
2764
|
ngOnDestroy() {
|
@@ -2772,6 +2780,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
2772
2780
|
type: HostListener,
|
2773
2781
|
args: ['click', ['$event']]
|
2774
2782
|
}] } });
|
2783
|
+
const raf = typeof requestAnimationFrame === 'function'
|
2784
|
+
? requestAnimationFrame
|
2785
|
+
: (fn) => setTimeout(fn);
|
2775
2786
|
|
2776
2787
|
class MarkdownContainerComponent {
|
2777
2788
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MarkdownContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|