From cc375400fb821a5afe39b395a71cfec2d33db9d5 Mon Sep 17 00:00:00 2001 From: Aaron Date: Thu, 30 Apr 2026 14:44:14 +0800 Subject: [PATCH] Restore annotation's original mounting logic --- .../javascripts/components/content/code/_/index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/templates/assets/javascripts/components/content/code/_/index.ts b/src/templates/assets/javascripts/components/content/code/_/index.ts index 66418ebdf6..a4e3815be8 100644 --- a/src/templates/assets/javascripts/components/content/code/_/index.ts +++ b/src/templates/assets/javascripts/components/content/code/_/index.ts @@ -27,6 +27,7 @@ import { Subject, asyncScheduler, defer, + distinctUntilChanged, distinctUntilKeyChanged, filter, finalize, @@ -245,12 +246,12 @@ export function mountCodeBlock( )) { const annotations$ = mountAnnotationList(list, el, options) content$.push( - watchElementVisibility(container) + watchElementSize(container) .pipe( takeUntil(done$), - filter(active => active), - take(1), - switchMap(() => annotations$) + map(({ width, height }) => width && height), + distinctUntilChanged(), + switchMap(active => active ? annotations$ : EMPTY) ) ) }