-
Notifications
You must be signed in to change notification settings - Fork 112
fix: math equation width #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reviewer's guide (collapsed on small PRs)Reviewer's GuideStandardizes the block popover popup to use a consistent fixed width of 400px for math, image, and video blocks, removing the previous mixed width/max-width behavior. Flow diagram for block popover width selectionflowchart TD
A[Render BlockPopover] --> B{Block type}
B --> C[MathEquationPopoverContent]
B --> D[ImageBlock]
B --> E[VideoBlock]
C --> F[Set popover width 400px]
D --> F
E --> F
F --> G[Render popover with fixed width 400px]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- The popup width values (400) are now hard-coded in multiple places; consider extracting these into a shared constant or config to avoid divergence if the design changes later.
- By removing the
max-w-[964px]and forcing a fixed width, the math equation popover may behave poorly on smaller viewports; consider using responsive classes or a max-width constraint to keep it usable on narrow screens.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The popup width values (400) are now hard-coded in multiple places; consider extracting these into a shared constant or config to avoid divergence if the design changes later.
- By removing the `max-w-[964px]` and forcing a fixed width, the math equation popover may behave poorly on smaller viewports; consider using responsive classes or a max-width constraint to keep it usable on narrow screens.
## Individual Comments
### Comment 1
<location> `src/components/editor/components/block-popover/MathEquationPopoverContent.tsx:60` </location>
<code_context>
return (
- <div className={'flex flex-col p-4 gap-3 w-[560px] max-w-[964px]'}>
+ <div className={'flex flex-col p-4 gap-3 w-[400px]'}>
<TextField
inputRef={(input: HTMLTextAreaElement) => {
</code_context>
<issue_to_address>
**suggestion:** Avoid hardcoding the width here; derive it from a shared constant or popover config to keep it in sync.
This `400px` value should match the width passed to `positionPopover` in `block-popover/index.tsx`. Right now the same magic number lives in two places. Please extract a shared constant (e.g. `MATH_EQUATION_POPOVER_WIDTH`) or otherwise use a single source of truth so the container and inner content stay aligned.
Suggested implementation:
```typescript
import { MATH_EQUATION_POPOVER_WIDTH } from './constants';
const inputRef = useRef<HTMLTextAreaElement | null>(null);
return (
<div
className={'flex flex-col p-4 gap-3'}
style={{ width: MATH_EQUATION_POPOVER_WIDTH }}
>
```
```typescript
return (
<div
className={'flex flex-col p-4 gap-3'}
style={{ width: MATH_EQUATION_POPOVER_WIDTH }}
>
<TextField
inputRef={(input: HTMLTextAreaElement) => {
if (!input) return;
```
1. Create a shared constants file for the popover width, for example:
- `src/components/editor/components/block-popover/constants.ts`
```ts
export const MATH_EQUATION_POPOVER_WIDTH = 400;
```
2. In `src/components/editor/components/block-popover/index.tsx`, replace the hardcoded `400` (or similar) passed to `positionPopover` with `MATH_EQUATION_POPOVER_WIDTH` from the same constants file:
```ts
import { MATH_EQUATION_POPOVER_WIDTH } from './constants';
positionPopover({
// ...
width: MATH_EQUATION_POPOVER_WIDTH,
});
```
3. If Tailwind JIT is required for width, you may alternatively define a Tailwind-safe class and map it from the constant (e.g., via a config or mapping), but the simplest alignment is using a numeric constant for both the style width and the popover positioning.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
josue693
pushed a commit
to josue693/AppFlowy-Web
that referenced
this pull request
Dec 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Checklist
General
Testing
Feature-Specific
Summary by Sourcery
Standardize the block popover to use a narrower, consistent width across math equation and media popups.
Enhancements: