Skip to content

Conversation

acelaya
Copy link
Collaborator

@acelaya acelaya commented Aug 11, 2025

Part of hypothesis/h#9808

Extract Excerpt component from the client so that we can have collapsible annotation bodies and quotes in h moderation queue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Extracted from the client verbatim

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Extracted from the client, with the only difference that in there we inject the app settings i order to resolve the inline control styles.

In here I removed any reference to the settings and added a new inlineControlsLinkStyle optional prop that serves the same purpose.

Copy link
Collaborator Author

@acelaya acelaya Aug 11, 2025

Choose a reason for hiding this comment

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

I brought this utility from the client, and left it as an unexposed internal hook, because it is currently used only by the Excerpt component.

However, it is referenced in a comment inside another component, as something that could be potentially used there.

We may want to eventually expose it from here, or just duplicate the code, since it's not a huge piece of logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

This utility was originally written before ResizeObserver existed, so it had a more complex implementation. With the current implementation, the code might come out better if you just used ResizeObserver directly in the calling component.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I'll keep it for now, to avoid having to refactor the Excerpt tests where observeElementSize is currently mocked.

I'll create an issue to simplify this separately.

Copy link
Contributor

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

LGTM. I noted that the code might be simplified by removing observeElementSize and just using ResizeObserver directly. That utility was originally more complex because it was created before ResizeObserver support became ubiquitous.

Copy link
Contributor

Choose a reason for hiding this comment

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

This utility was originally written before ResizeObserver existed, so it had a more complex implementation. With the current implementation, the code might come out better if you just used ResizeObserver directly in the calling component.

@acelaya acelaya force-pushed the excerpt-component branch from ffa1cd8 to 5a33d39 Compare August 11, 2025 09:36
@acelaya acelaya merged commit fa738f0 into main Aug 11, 2025
2 checks passed
@acelaya acelaya deleted the excerpt-component branch August 11, 2025 09:38
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