-
Notifications
You must be signed in to change notification settings - Fork 7
Add custom preview support with nodes #115
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
Conversation
WalkthroughThe preview system now supports both text (BBCode string) and node (Control) previews. Signal and virtual method types were widened (String → untyped/Variant). The preview panel was refactored to a tabbed UI to handle both modes. Main scene UI offsets and About version text were updated. Changelog entry added. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Editor as Editor/Mode
participant Signals as Signals (autoload)
participant Panel as PreviewPanel (tabbed)
rect rgba(200,230,255,0.3)
Note over User,Editor: Edit triggers preview generation
User->>Editor: Edit text
Editor->>Editor: _generate_preview(text) -> Variant<br/>(String BBCode or Control)
end
rect rgba(220,255,220,0.3)
Editor->>Signals: emit preview_updated(new)
Signals-->>Panel: preview_updated(new)
alt new is String
Panel->>Panel: Enable text mode<br/>Update RichTextLabel (bbcode)
Panel->>Panel: Switch TabContainer to Preview tab
else new is Control
Panel->>Panel: Enable node mode<br/>Clear and add Control to preview_node
Panel->>Panel: Switch TabContainer to Node tab
end
end
rect rgba(255,230,200,0.3)
Note over Panel: Handles enable/disable and default tab selection
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🔇 Additional comments (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 |
WalkthroughAdds support for non-text previews by changing signal and method types, and refactors the preview panel to a tab-based UI that can display either BBCode text or an embedded Control. Updates scene layout and About text to Mode API v2.1, and adds a changelog entry. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User
participant Mode as TextForgeMode
participant Signals as Autoload Signals
participant Panel as Preview Panel
participant UI as TabContainer/Preview Area
User->>Mode: Trigger preview generation
Mode-->>Mode: _generate_preview(text) -> Variant (String or Control)
Mode-->>Signals: emit preview_updated(new)
Signals-->>Panel: preview_updated(new)
Panel->>Panel: _update_preview(_preview)
alt _preview is non-empty String
Panel->>UI: _set_preview_enabled(true, as_text=true)
Panel->>UI: Set RichTextLabel.bbcode_text
UI->>UI: Switch to tab: Preview (text)
else _preview is Control
Panel->>UI: Clear preview_node children
Panel->>UI: AddChild(Control) into preview_node
Panel->>UI: _set_preview_enabled(true, as_text=false)
UI->>UI: Switch to tab: Custom (control)
else no preview
Panel->>UI: _set_preview_enabled(false, as_text=false)
UI->>UI: Switch to tab: Message
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~55 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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 |
Type of Change
Description
Adds support for Godot nodes to generate previews. These changes include modifications to the EditorAPI, TextForgeMode class, and Preview panel, which collectively bump the TFM API version to 2.1.
Testing
All changes are backwards compatible, and the new functionality has been tested with a newly created SVG mode that will be released soon.
Impact
Nothing
Additional Information
Nothing
Checklist
Summary by CodeRabbit
New Features
Documentation
Refactor