@foblex/m-render 2.6.5 → 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
|
}
|
@@ -1020,7 +1024,6 @@ class MarkCodeFocusedBlocksPostProcessor {
|
|
1020
1024
|
handle(element) {
|
1021
1025
|
const html = element.innerHTML;
|
1022
1026
|
if (!FOCUS_REGEX.test(html)) {
|
1023
|
-
console.warn('[MarkCodeFocusedBlocksPostProcessor] No focus markers found in the code block.', html);
|
1024
1027
|
return of(element);
|
1025
1028
|
}
|
1026
1029
|
element.innerHTML = html.replace(FOCUS_REGEX, (_match, content) => {
|
@@ -2735,7 +2738,10 @@ class FMarkdownRendererComponent {
|
|
2735
2738
|
}
|
2736
2739
|
_subscribeOnRouteChanges() {
|
2737
2740
|
this._router.events
|
2738
|
-
.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))
|
2739
2745
|
.subscribe();
|
2740
2746
|
}
|
2741
2747
|
_updateRenderDependencies() {
|
@@ -2743,7 +2749,7 @@ class FMarkdownRendererComponent {
|
|
2743
2749
|
const html = this.value();
|
2744
2750
|
if (html && this._browser.isBrowser()) {
|
2745
2751
|
untracked(() => {
|
2746
|
-
|
2752
|
+
raf(() => {
|
2747
2753
|
this._mediator.execute(new RenderDynamicComponentsRequest(this._hostElement));
|
2748
2754
|
this._mediator.execute(new CalculateTableOfContentDataRequest(this._hostElement));
|
2749
2755
|
});
|
@@ -2752,6 +2758,7 @@ class FMarkdownRendererComponent {
|
|
2752
2758
|
}, { injector: this._injector });
|
2753
2759
|
}
|
2754
2760
|
_onDocumentClick(event) {
|
2761
|
+
console.log('_onDocumentClick2');
|
2755
2762
|
this._mediator.execute(new HandleNavigationLinksRequest(event));
|
2756
2763
|
}
|
2757
2764
|
ngOnDestroy() {
|
@@ -2773,6 +2780,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
2773
2780
|
type: HostListener,
|
2774
2781
|
args: ['click', ['$event']]
|
2775
2782
|
}] } });
|
2783
|
+
const raf = typeof requestAnimationFrame === 'function'
|
2784
|
+
? requestAnimationFrame
|
2785
|
+
: (fn) => setTimeout(fn);
|
2776
2786
|
|
2777
2787
|
class MarkdownContainerComponent {
|
2778
2788
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: MarkdownContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|