Skip to content

Staging#56

Merged
will-lp1 merged 4 commits intomainfrom
staging
Jul 20, 2025
Merged

Staging#56
will-lp1 merged 4 commits intomainfrom
staging

Conversation

@will-lp1
Copy link
Copy Markdown
Owner

@will-lp1 will-lp1 commented Jul 20, 2025

Summary by CodeRabbit

  • New Features

    • Added support for document diff previews, allowing users to preview, cancel, or apply changes before finalizing edits.
    • Introduced real-time tracking of active text formatting (e.g., headings, lists, bold, italic) in the editor toolbar.
    • Enhanced inline suggestion capabilities with improved streaming and application of suggestions.
  • Improvements

    • Simplified and streamlined the text editor for better performance and maintainability.
    • Improved placeholder styling and behavior within the editor.
    • Enhanced save functionality with robust validation and force-save support.
  • Bug Fixes

    • Improved validation and error handling when applying suggestions.
  • Refactor

    • Consolidated editor plugin management for a cleaner and more maintainable codebase.
    • Delegated complex editor logic to external modules, reducing in-component complexity.
  • Chores

    • Cleaned up unused utilities and removed obsolete code for improved maintainability.

@locadex-agent
Copy link
Copy Markdown

locadex-agent bot commented Jul 20, 2025

🚀 Locadex i18n Started

Locadex is now analyzing your changes and generating localizations for this pull request.

What's happening:

  • 🔍 Analyzing your code changes for translatable content
  • 🌐 Generating translations for supported languages
  • 📝 Adding localization commits directly to this PR

Estimated time: 2-10 minutes depending on the size of your changes.


You'll receive another comment when the localization is complete.

@vercel
Copy link
Copy Markdown

vercel bot commented Jul 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cursorforwriting-wkur ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 20, 2025 4:21pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces major refactoring and modularization of the rich text editor in the Snow Leopard app. Core editor logic, plugin management, formatting state tracking, diff preview, inline suggestions, and save handling are moved into dedicated modules. Several new plugins and utility functions are added, and obsolete or redundant code is removed for clarity and maintainability.

Changes

File(s) Change Summary
components/document/text-editor.tsx Refactored to delegate editor logic, plugins, formatting, and save handling to new helper modules; removed direct plugin and event handler code; simplified state management.
components/suggestion-overlay-provider.tsx Updated import sources for suggestion context constants.
lib/editor/config.ts Removed the exported handleTransaction function and related types.
lib/editor/diff-plugin.ts New: Implements a ProseMirror plugin for diff preview, cancel, and apply via custom events.
lib/editor/editor-plugins.ts New: Exports EditorPluginOptions and createEditorPlugins to configure and assemble editor plugins.
lib/editor/format-plugin.ts New: Exports FormatState, formatPluginKey, and formatPlugin for tracking active formatting in the editor.
lib/editor/functions.tsx Removed text position, extraction, and decoration creation utilities for diffs and streaming.
lib/editor/inline-suggestion-plugin.ts Added createInlineSuggestionCallback for streaming inline suggestions; made requestSuggestion optional in the plugin.
lib/editor/placeholder-plugin.ts Injects placeholder CSS via a view method for dynamic styling; no change to decoration logic.
lib/editor/react-renderer.tsx Deleted: Removed the ReactRenderer class for rendering React components into the DOM.
lib/editor/save-plugin.ts Added document ID validation, createSaveFunction, and createForceSaveHandler for robust save logic and external save triggers.
lib/editor/suggestion-plugin.ts Updated selectionContextPlugin to accept documentId, added custom event handling for external suggestion application, improved validation.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EditorComponent
    participant EditorPlugins
    participant SavePlugin
    participant InlineSuggestionPlugin
    participant DiffPlugin

    User->>EditorComponent: Types/edits in editor
    EditorComponent->>EditorPlugins: Initializes plugins (save, inline suggestion, diff, format)
    EditorComponent->>SavePlugin: Calls performSave via createSaveFunction
    EditorComponent->>InlineSuggestionPlugin: Requests inline suggestion via callback
    InlineSuggestionPlugin->>EditorComponent: Streams suggestion updates
    User->>DiffPlugin: Triggers preview/cancel/apply via custom events
    DiffPlugin->>EditorComponent: Updates doc for preview/apply/cancel
    EditorPlugins->>EditorComponent: Updates formatting state via formatPlugin
Loading

Poem

A hop, a skip, a modular leap,
The editor’s logic, now tidy and neat!
Plugins for diff, for save, for style,
Suggestions stream in, making rabbits smile.
Out with the clutter, in with the flow—
Snow Leopard’s editing, ready to go!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 81aa7ee and 42e5732.

📒 Files selected for processing (12)
  • apps/snow-leopard/components/document/text-editor.tsx (8 hunks)
  • apps/snow-leopard/components/suggestion-overlay-provider.tsx (1 hunks)
  • apps/snow-leopard/lib/editor/config.ts (0 hunks)
  • apps/snow-leopard/lib/editor/diff-plugin.ts (1 hunks)
  • apps/snow-leopard/lib/editor/editor-plugins.ts (1 hunks)
  • apps/snow-leopard/lib/editor/format-plugin.ts (1 hunks)
  • apps/snow-leopard/lib/editor/functions.tsx (1 hunks)
  • apps/snow-leopard/lib/editor/inline-suggestion-plugin.ts (2 hunks)
  • apps/snow-leopard/lib/editor/placeholder-plugin.ts (2 hunks)
  • apps/snow-leopard/lib/editor/react-renderer.tsx (0 hunks)
  • apps/snow-leopard/lib/editor/save-plugin.ts (3 hunks)
  • apps/snow-leopard/lib/editor/suggestion-plugin.ts (5 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@will-lp1 will-lp1 merged commit 6614e08 into main Jul 20, 2025
4 of 6 checks passed
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.

1 participant