-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: remove insert modes #2982
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
fix: remove insert modes #2982
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Caution Review failedThe pull request is closed. WalkthroughIntroduces a new InsertMode enum and state field, migrates insert-related logic from editorMode to insertMode across canvas gestures, hotkeys, and image drag/drop. Adjusts UI visibility: bottom bar and DesignPanel now show in DESIGN and PAN. Refactors mode toggle x-position calculation. Chat context merge now preserves image contexts. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant HK as Hotkeys
participant SM as StateManager
participant GH as GestureHandler (Canvas)
participant IM as InsertManager
participant UI as UI Components
U->>HK: Press "Insert Div/Text" hotkey
HK->>SM: set insertMode = INSERT_DIV/INSERT_TEXT
Note right of SM: editorMode unchanged
U->>GH: Move/MouseDown on canvas
GH->>SM: read insertMode
alt insertMode active
GH->>GH: Show crosshair/text cursor, measures
GH->>IM: getDefaultProperties(insertMode)
GH->>GH: Create element on drop
GH->>SM: set insertMode = null
GH->>SM: set editorMode = DESIGN
else no insertMode
GH->>GH: Normal move/hover behavior
end
U->>UI: Toggle PAN/DESIGN
UI->>SM: update editorMode
UI->>UI: Bottom bar + DesignPanel visible when DESIGN or PAN
sequenceDiagram
autonumber
participant U as User
participant Img as Image Drag/Drop Hook
participant SM as StateManager
participant GH as GestureHandler
U->>Img: Start dragging image
Img->>SM: set insertMode = INSERT_IMAGE
U->>GH: Drop on canvas
GH->>SM: read insertMode INSERT_IMAGE
GH->>GH: Handle image insert
GH->>SM: set insertMode = null
GH->>SM: set editorMode = DESIGN
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (10)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| label: t(transKeys.editor.toolbar.tools.insertText.name), | ||
| tooltip: t(transKeys.editor.toolbar.tools.insertText.tooltip), | ||
| }, | ||
| // { |
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.
Remove commented-out insert mode items if they are no longer needed.
| } | ||
| if (mode === EditorMode.CODE) { | ||
| return '100%'; | ||
| }; |
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.
Typographical: Unnecessary semicolon after the closing brace for the if statement. Consider removing it for cleaner code style.
| }; | |
| } |
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Important
Refactor editor to separate insert operations using a new
InsertModeenum, removing old insert modes fromEditorMode.INSERT_DIVandINSERT_TEXTfromTOOLBAR_ITEMSinindex.tsx.BottomBarandGestureScreento useInsertModefor insert operations.HotkeysAreanow setsinsertModeinstead ofeditorModefor insert hotkeys.use-image-drag-drop.tsxusesInsertMode.INSERT_IMAGEfor image drag operations.LeftPanelvisibility logic updated to includeEditorMode.PAN.ModeTogglerefactored to usegetXPosition()for animation.insertModetoStateManagerinstate/index.ts.InsertManagerrefactored to useInsertModefor element insertion.InsertModeenum inmodels/src/editor/index.ts.This description was created by
for 982dee3. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit
New Features
Refactor