Skip to content

[WIKI-539] refactor: remove lite text read only editor#7481

Merged
pushya22 merged 2 commits intopreviewfrom
refactor/lite-text-read-only
Jul 29, 2025
Merged

[WIKI-539] refactor: remove lite text read only editor#7481
pushya22 merged 2 commits intopreviewfrom
refactor/lite-text-read-only

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Jul 25, 2025

Description

This PR gets rid of the lite text read only editor.

Type of Change

  • Code refactoring

Summary by CodeRabbit

  • New Features

    • Editor components now use a unified editable prop to control editability, allowing both editable and read-only modes within the same component.
    • The editor reference API has been expanded with new helper methods for improved interaction and real-time collaboration.
  • Refactor

    • Read-only editor components and related types have been removed and merged into the main editor, simplifying usage and maintenance.
    • File handler and mention handler types are now unified, streamlining extension and handler integration.
  • Bug Fixes

    • Editor now consistently enforces required props based on editability, reducing potential runtime errors.
  • Chores

    • Cleaned up exports and removed unused files and types to reduce codebase complexity.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 25, 2025

Walkthrough

This change removes all code, types, and exports related to "read-only" editor components and APIs across the codebase. The editor's editable state is now managed via a single editable prop and unified handler types. All read-only editor wrappers, types, and extension logic are deleted. Editor APIs, handler types, and component props are consolidated, and all usage sites are updated to use the new unified editor interface with explicit editable control.

Changes

File(s) / Path(s) Change Summary
Exports Removal
apps/space/core/components/editor/index.ts, apps/web/core/components/editor/lite-text/index.ts, packages/editor/src/ce/extensions/core/index.ts, packages/editor/src/core/extensions/index.ts, packages/editor/src/core/components/editors/index.ts, packages/editor/src/core/components/editors/lite-text/index.ts, packages/editor/src/core/extensions/callout/index.ts, packages/editor/src/core/extensions/index.ts, packages/editor/src/index.ts
Removed exports for read-only editor modules and related components.
Deleted Read-Only Components & Hooks
apps/space/core/components/editor/lite-text-read-only-editor.tsx, apps/web/core/components/editor/lite-text/read-only-editor.tsx, packages/editor/src/core/components/editors/lite-text/read-only-editor.tsx, packages/editor/src/core/components/editors/read-only-editor-wrapper.tsx, packages/editor/src/core/hooks/use-read-only-editor.ts, packages/editor/src/core/props/read-only.tsx, packages/editor/src/core/props/index.ts, packages/editor/src/core/extensions/core/read-only-extensions.ts, packages/editor/src/core/extensions/rich-text/read-only-extensions.tsx, packages/editor/src/core/extensions/callout/read-only-extension.tsx
Deleted all read-only editor component files, hooks, and extension logic.
Editor Components & Usage Updates
apps/space/core/components/editor/lite-text-editor.tsx, apps/space/core/components/issues/peek-overview/comment/add-comment.tsx, apps/space/core/components/issues/peek-overview/comment/comment-detail-card.tsx, apps/web/core/components/comments/card/display.tsx, apps/web/core/components/comments/card/edit-form.tsx, apps/web/core/components/comments/card/root.tsx, apps/web/core/components/comments/comment-create.tsx, apps/web/core/components/editor/lite-text/editor.tsx, apps/web/core/components/editor/rich-text/editor.tsx, apps/web/core/components/editor/sticky-editor/editor.tsx, packages/editor/src/core/components/editors/lite-text/editor.tsx
Updated usage to unified LiteTextEditor with explicit editable prop; removed read-only editor usage.
Editor Ref & Hook Refactoring
packages/editor/src/core/helpers/editor-ref.ts, packages/editor/src/core/hooks/use-editor.ts
Consolidated file handler logic, merged and expanded editor ref API, delegated imperative handle logic to helpers.
File Handler Types Unification
apps/core/hooks/editor/use-editor-config.ts, packages/editor/src/core/extensions/custom-image/extension.tsx, packages/editor/src/core/extensions/image/extension.tsx, packages/editor/src/core/extensions/utility.ts, packages/editor/src/core/plugins/file/root.ts
Unified file handler types, removed references to read-only file handler types.
Type Definitions & Props Consolidation
packages/editor/src/core/types/config.ts, packages/editor/src/core/types/editor.ts, packages/editor/src/core/types/hook.ts, packages/editor/src/core/types/mention.ts, packages/editor/src/core/props.ts
Removed all read-only types/interfaces; consolidated handler and ref APIs; updated editor prop interfaces; renamed prop types for clarity.
Import Path & Minor Cleanup
packages/editor/src/core/extensions/rich-text/editor.tsx, packages/editor/src/core/extensions/callout/extension.tsx
Updated import paths; removed unused imports and redundant code.

Sequence Diagram(s)

sequenceDiagram
    participant UI as UI Component
    participant Editor as LiteTextEditor
    participant FileHandler as FileHandler
    participant MentionHandler as MentionHandler

    UI->>Editor: Render LiteTextEditor with editable={true|false}
    alt editable = true
        Editor->>FileHandler: Use provided uploadFile for file uploads
    else editable = false
        Editor->>FileHandler: Use no-op uploadFile (uploads disabled)
    end
    Editor->>MentionHandler: Use unified mention handler for mentions
    Editor-->>UI: Rendered editor (editable or read-only as per prop)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • Palanikannan1437
  • prateekshourya29

Poem

In burrows deep, the code did grow,
With read-only paths now set to go.
One editor stands, both strong and light,
Editable or not, it gets it right!
Types and handlers, all made neat,
A unified field for rabbits to greet. 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 58ecf9e and a1e97fb.

📒 Files selected for processing (2)
  • apps/space/core/components/editor/lite-text-editor.tsx (2 hunks)
  • packages/editor/src/core/types/editor.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/editor/src/core/types/editor.ts
  • apps/space/core/components/editor/lite-text-editor.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Build and lint web apps
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/lite-text-read-only

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 generate unit tests to generate unit tests for 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.

@makeplane
Copy link

makeplane bot commented Jul 25, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
packages/editor/src/core/extensions/callout/extension.tsx (2)

66-68: Simplify NodeView renderer – avoid the manual type-cast

ReactNodeViewRenderer can accept the component directly; the extra wrapper and cast are unnecessary and lose type-safety.

-    return ReactNodeViewRenderer((props) => (
-      <CustomCalloutBlock {...props} node={props.node as CustomCalloutNodeViewProps["node"]} />
-    ));
+    // The component already satisfies NodeViewProps; no additional cast required.
+    return ReactNodeViewRenderer(CustomCalloutBlock);

42-60: Backspace shortcut: narrow the try / catch and surface unexpected errors

Catching every error and merely logging it risks masking genuine editor bugs.
Consider restricting the try block to only the line that can throw (the findParentNodeClosestToPos call) or re-throw after logging so upstream error handlers (e.g. Sentry) are triggered.

apps/web/core/components/comments/card/root.tsx (1)

6-6: LGTM: Editor API unification implemented correctly.

The change from EditorReadOnlyRefApi to EditorRefApi aligns with the unified editor API approach. Consider renaming readOnlyEditorRef to editorRef in a future refactor to better reflect its unified nature.

Also applies to: 40-40

packages/editor/src/core/helpers/editor-ref.ts (1)

74-94: Consider performance optimization for getSelectedText

The current implementation creates DOM elements for each selected node, which could impact performance for large selections. Consider caching or using a more efficient serialization approach.

For better performance with large selections, consider:

  1. Using a document fragment instead of individual div elements
  2. Implementing debouncing if this method is called frequently
  3. Caching the serializer instance
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a5f3bd1 and 58ecf9e.

📒 Files selected for processing (44)
  • apps/space/core/components/editor/index.ts (0 hunks)
  • apps/space/core/components/editor/lite-text-editor.tsx (3 hunks)
  • apps/space/core/components/editor/lite-text-read-only-editor.tsx (0 hunks)
  • apps/space/core/components/issues/peek-overview/comment/add-comment.tsx (1 hunks)
  • apps/space/core/components/issues/peek-overview/comment/comment-detail-card.tsx (3 hunks)
  • apps/web/core/components/comments/card/display.tsx (3 hunks)
  • apps/web/core/components/comments/card/edit-form.tsx (3 hunks)
  • apps/web/core/components/comments/card/root.tsx (2 hunks)
  • apps/web/core/components/comments/comment-create.tsx (1 hunks)
  • apps/web/core/components/editor/lite-text/editor.tsx (5 hunks)
  • apps/web/core/components/editor/lite-text/index.ts (0 hunks)
  • apps/web/core/components/editor/lite-text/read-only-editor.tsx (0 hunks)
  • apps/web/core/components/editor/rich-text/editor.tsx (3 hunks)
  • apps/web/core/components/editor/sticky-editor/editor.tsx (2 hunks)
  • apps/web/core/hooks/editor/use-editor-config.ts (3 hunks)
  • packages/editor/src/ce/extensions/core/index.ts (0 hunks)
  • packages/editor/src/ce/extensions/core/read-only-extensions.ts (0 hunks)
  • packages/editor/src/ce/extensions/rich-text/read-only-extensions.tsx (0 hunks)
  • packages/editor/src/core/components/editors/index.ts (0 hunks)
  • packages/editor/src/core/components/editors/lite-text/editor.tsx (1 hunks)
  • packages/editor/src/core/components/editors/lite-text/index.ts (0 hunks)
  • packages/editor/src/core/components/editors/lite-text/read-only-editor.tsx (0 hunks)
  • packages/editor/src/core/components/editors/read-only-editor-wrapper.tsx (0 hunks)
  • packages/editor/src/core/components/editors/rich-text/editor.tsx (1 hunks)
  • packages/editor/src/core/extensions/callout/extension.tsx (1 hunks)
  • packages/editor/src/core/extensions/callout/index.ts (0 hunks)
  • packages/editor/src/core/extensions/callout/read-only-extension.tsx (0 hunks)
  • packages/editor/src/core/extensions/custom-image/extension.tsx (1 hunks)
  • packages/editor/src/core/extensions/image/extension.tsx (2 hunks)
  • packages/editor/src/core/extensions/index.ts (0 hunks)
  • packages/editor/src/core/extensions/read-only-extensions.ts (0 hunks)
  • packages/editor/src/core/extensions/utility.ts (2 hunks)
  • packages/editor/src/core/helpers/editor-ref.ts (2 hunks)
  • packages/editor/src/core/hooks/use-editor.ts (2 hunks)
  • packages/editor/src/core/hooks/use-read-only-editor.ts (0 hunks)
  • packages/editor/src/core/plugins/file/root.ts (1 hunks)
  • packages/editor/src/core/props.ts (1 hunks)
  • packages/editor/src/core/props/index.ts (0 hunks)
  • packages/editor/src/core/props/read-only.tsx (0 hunks)
  • packages/editor/src/core/types/config.ts (1 hunks)
  • packages/editor/src/core/types/editor.ts (3 hunks)
  • packages/editor/src/core/types/hook.ts (1 hunks)
  • packages/editor/src/core/types/mention.ts (1 hunks)
  • packages/editor/src/index.ts (0 hunks)
💤 Files with no reviewable changes (19)
  • packages/editor/src/core/components/editors/lite-text/index.ts
  • packages/editor/src/core/extensions/index.ts
  • packages/editor/src/index.ts
  • packages/editor/src/core/components/editors/index.ts
  • apps/web/core/components/editor/lite-text/index.ts
  • apps/space/core/components/editor/index.ts
  • packages/editor/src/ce/extensions/core/index.ts
  • packages/editor/src/core/props/read-only.tsx
  • packages/editor/src/ce/extensions/core/read-only-extensions.ts
  • packages/editor/src/core/extensions/callout/read-only-extension.tsx
  • packages/editor/src/core/components/editors/lite-text/read-only-editor.tsx
  • packages/editor/src/core/extensions/callout/index.ts
  • packages/editor/src/core/props/index.ts
  • packages/editor/src/core/components/editors/read-only-editor-wrapper.tsx
  • apps/web/core/components/editor/lite-text/read-only-editor.tsx
  • packages/editor/src/core/hooks/use-read-only-editor.ts
  • apps/space/core/components/editor/lite-text-read-only-editor.tsx
  • packages/editor/src/ce/extensions/rich-text/read-only-extensions.tsx
  • packages/editor/src/core/extensions/read-only-extensions.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Build and lint web apps
🔇 Additional comments (37)
packages/editor/src/core/extensions/callout/extension.tsx (1)

3-3: No stale imports from @/extensions/callout remain

I searched all .ts/.tsx files for any imports of the old barrel path and found none. The updated import to @/extensions/callout/block is correctly applied everywhere.

packages/editor/src/core/props.ts (1)

5-7: No action needed: TArgs is a local, consistent alias
The TArgs type in packages/editor/src/core/props.ts is a module‐local alias (not exported) and follows the same pattern used across multiple files (e.g. helpers, extensions, hooks). There is no TCoreEditorProps in the codebase and no downstream imports to break. Please disregard the earlier suggestion to rename or re-export—this change aligns with existing conventions.

Likely an incorrect or invalid review comment.

packages/editor/src/core/components/editors/rich-text/editor.tsx (1)

8-8: LGTM! Import path updated correctly.

The import path change for RichTextEditorAdditionalExtensions aligns with the refactoring to consolidate editor extensions.

packages/editor/src/core/components/editors/lite-text/editor.tsx (1)

22-22: Good simplification of prop handling.

Removing the explicit editable prop and relying on spread props is a clean approach that maintains functionality while allowing more flexible prop passing. This aligns well with the unified editor approach.

apps/web/core/components/comments/comment-create.tsx (1)

116-116: Correct addition of editable prop.

Adding editable={true} to the LiteTextEditor is the right approach for comment creation, ensuring users can edit when creating new comments. This properly adapts to the unified editor API.

apps/space/core/components/issues/peek-overview/comment/add-comment.tsx (1)

78-78: Consistent implementation of unified editor pattern.

Adding editable={true} for the comment addition functionality is correct and maintains the expected user experience while adapting to the consolidated editor API.

packages/editor/src/core/types/hook.ts (1)

5-5: Good type consolidation aligns with refactoring goals.

Removing IReadOnlyEditorProps from the import and eliminating TReadOnlyEditorHookProps simplifies the type system by consolidating read-only and editable editor functionality into unified types. This change supports the broader effort to use a single editor component with explicit editable control.

packages/editor/src/core/extensions/custom-image/extension.tsx (1)

9-9: LGTM: Type consolidation aligns with refactoring goal.

The removal of TReadOnlyFileHandler import and narrowing the fileHandler prop type to only TFileHandler correctly implements the unified file handler approach. The existing conditional checks for optional properties (upload, validation) ensure backward compatibility.

Also applies to: 16-16

packages/editor/src/core/extensions/image/extension.tsx (1)

5-5: LGTM: Consistent type consolidation.

The changes follow the same pattern as other extensions, removing TReadOnlyFileHandler and unifying the file handler type. The conditional property checks maintain compatibility with different file handler configurations.

Also applies to: 15-15

packages/editor/src/core/plugins/file/root.ts (1)

4-4: LGTM: File handler type unification maintains flexibility.

The consolidation to TFileHandler is consistent with the refactoring goal. The conditional logic checking for the delete method ensures that different file handler implementations can still provide varying capabilities.

Also applies to: 11-11

apps/web/core/components/comments/card/edit-form.tsx (2)

6-6: LGTM: Editor API type unification.

The change from EditorReadOnlyRefApi to EditorRefApi correctly implements the unified editor reference API approach.

Also applies to: 17-17


78-78: LGTM: Explicit editability control.

The addition of the explicit editable prop makes the editor's behavior clear and aligns with the unified editor approach where editability is controlled via props rather than separate components.

apps/web/core/components/editor/rich-text/editor.tsx (2)

3-4: LGTM! Improved type imports and type safety.

The explicit type imports clarify these are TypeScript type-only imports, and the added default value for disabledExtensions prevents potential undefined issues.


71-75: LGTM! Cleaner mentionHandler implementation.

The simplification from an inline arrow function to direct component reference is more readable, and removing the explicit type annotation is fine since TypeScript can infer the parameter type.

apps/web/core/components/comments/card/display.tsx (3)

6-6: LGTM! Correct type consolidation.

The import change from EditorReadOnlyRefApi to EditorRefApi aligns with the unified editor API refactoring.


20-20: LGTM! Prop type updated correctly.

The readOnlyEditorRef prop type is correctly updated to use the unified EditorRefApi interface.


70-71: LGTM! Proper migration to unified editor.

The replacement of LiteTextReadOnlyEditor with LiteTextEditor plus editable={false} correctly maintains the read-only behavior while using the unified component.

apps/space/core/components/issues/peek-overview/comment/comment-detail-card.tsx (3)

11-11: LGTM! Import correctly updated.

The import change from LiteTextReadOnlyEditor to LiteTextEditor aligns with the unified editor component approach.


104-105: LGTM! Correct editable mode configuration.

The LiteTextEditor is properly configured with editable (which defaults to true in JSX) for the editing form, and the uploadFile handler is correctly provided.


142-143: LGTM! Proper read-only mode configuration.

The replacement of LiteTextReadOnlyEditor with LiteTextEditor plus editable={false} correctly maintains the read-only display behavior.

packages/editor/src/core/types/mention.ts (1)

21-25: LGTM! Proper type consolidation.

The TMentionHandler type correctly consolidates mention handling by merging the renderComponent property from the removed TReadOnlyMentionHandler, maintaining functionality while simplifying the type system.

apps/web/core/components/editor/sticky-editor/editor.tsx (2)

17-20: LGTM! Proper interface design.

Omitting the editable property from the inherited props ensures the sticky editor's editability is controlled internally rather than externally, which is appropriate for this component's purpose.


73-73: LGTM! Consistent editable behavior.

Explicitly setting editable={true} ensures the sticky editor is always editable, which aligns with its intended functionality as an input component.

packages/editor/src/core/extensions/utility.ts (1)

13-13: LGTM! Type consolidation aligns with the unified editor approach.

The removal of TReadOnlyFileHandler from imports and the simplification of the fileHandler prop type are consistent with the PR's objective to consolidate read-only and editable editor functionality.

Also applies to: 41-41

packages/editor/src/core/types/config.ts (1)

4-20: LGTM! Clean type consolidation.

The unified TFileHandler type successfully merges all properties from the previous split types while maintaining type safety and clarity. This simplification aligns well with the removal of separate read-only editor components.

apps/web/core/components/editor/lite-text/editor.tsx (2)

35-43: Excellent use of discriminated union for type safety!

The discriminated union type ensures that uploadFile is only required when the editor is editable, preventing runtime errors and improving developer experience.


103-103: Good defensive programming with the no-op upload handler.

Providing an async no-op function when editable is false prevents potential runtime errors in the file handler logic.

packages/editor/src/core/hooks/use-editor.ts (1)

120-120: Clean refactoring! Good separation of concerns.

Delegating the imperative handle logic to getEditorRefHelpers reduces code complexity in this hook and centralizes the editor API implementation. This improves maintainability without changing functionality.

apps/web/core/hooks/editor/use-editor-config.ts (1)

26-91: Excellent consolidation of file handler logic!

The unified getEditorFileHandlers successfully merges all functionality from the previous split handlers while maintaining the same behavior. The implementation correctly handles both legacy HTTP paths and new asset paths.

apps/space/core/components/editor/lite-text-editor.tsx (3)

3-3: Good use of type imports

Using type imports for type-only imports is a TypeScript best practice that improves tree-shaking and code clarity.


12-28: Excellent type safety improvement with discriminated union

The discriminated union type correctly enforces that uploadFile is only required when editable is true. This prevents potential runtime errors and makes the component's API contract clearer.


55-60: Empty-string no-op matches TFileHandler.upload signature

The TFileHandler.upload method is defined as (blockId: string, file: File) => Promise<string>. Returning an empty string via async () => "" still satisfies the required Promise<string> return type. No changes are needed here.

packages/editor/src/core/types/editor.ts (2)

84-113: Well-designed API consolidation

The unified EditorRefApi interface successfully consolidates read-only and editable functionality into a single, cohesive API. The new methods for blur, real-time updates, command execution, and cursor position enhance the editor's capabilities without breaking existing functionality.


122-122: Good design decision for explicit editability

Making editable a required property at the base interface level ensures explicit declaration of editor state and prevents ambiguity. This aligns well with the unified editor architecture.

packages/editor/src/core/helpers/editor-ref.ts (3)

3-16: Appropriate imports for enhanced functionality

The new imports properly support the expanded editor capabilities, including DOM serialization for text selection, menu command execution, and content manipulation helpers.


120-167: Excellent event subscription pattern

The event subscription methods follow a consistent pattern with proper cleanup functions, preventing memory leaks and adhering to React best practices. The null checks and unsubscribe returns ensure robust event handling.


58-58: Add null check for editor in blur method

The blur method should check if the editor exists before calling commands to prevent potential runtime errors.

-    blur: () => editor?.commands.blur(),
+    blur: () => {
+      if (!editor) return;
+      editor.commands.blur();
+    },

Likely an incorrect or invalid review comment.

@pushya22 pushya22 merged commit e0fa655 into preview Jul 29, 2025
5 of 7 checks passed
@pushya22 pushya22 deleted the refactor/lite-text-read-only branch July 29, 2025 12:39
@coderabbitai coderabbitai bot mentioned this pull request Aug 12, 2025
1 task
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* refactor: remove lite text read only editor

* chore: update types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants