Skip to content

Comments

Fix intersection observer life cycle#8077

Merged
mejo- merged 6 commits intomainfrom
fix/anchor-observer
Dec 18, 2025
Merged

Fix intersection observer life cycle#8077
mejo- merged 6 commits intomainfrom
fix/anchor-observer

Conversation

@max-nextcloud
Copy link
Collaborator

  • cleanup unused heading.previous
  • headings: keep anchors and intersection observer
  • headings: lookup anchors within current editor

Copy link
Member

@mejo- mejo- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I skimmed through the code changes and have two comments so far 😊

@max-nextcloud max-nextcloud force-pushed the fix/anchor-observer branch 2 times, most recently from 0952139 to 21efc34 Compare December 17, 2025 14:47
Also type headingAnchor and extractHeadings

Signed-off-by: Max <max@nextcloud.com>
No need to create all heading anchors from scratch if one changes.

This also allows us to keep the intersection observer
and only adjust the targets when headings are added / removed.

Signed-off-by: Max <max@nextcloud.com>
The element id should be unique according to the html spec
- but we cannot guarantee this
as multiple editors may be rendered at the same time.

Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
@max-nextcloud max-nextcloud marked this pull request as ready for review December 18, 2025 11:49
Script setup does not expose vm internals by default.
So we cannot rely on them for tests.

Otherwise would have to expose them with
[defineExpose](https://vuejs.org/api/sfc-script-setup.html#defineexpose).
But it seems better to test for actual dom changes in components
and test state with composable tests.

Signed-off-by: Max <max@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
@max-nextcloud max-nextcloud requested a review from mejo- December 18, 2025 12:55
Copy link
Member

@mejo- mejo- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work, thanks so much ❤️

@mejo- mejo- merged commit f6e6251 into main Dec 18, 2025
62 of 63 checks passed
@mejo- mejo- deleted the fix/anchor-observer branch December 18, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants