Skip to content

Conversation

VipinDevelops
Copy link
Member

@VipinDevelops VipinDevelops commented Jul 31, 2025

Description

This PR fix the issue of not adding a trailing node on click of the editor end.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • New Features

    • Added support for displaying optional badges in slash command menu items.
    • Introduced a new hook for managing disabled and flagged editor extensions across different editor types.
    • Added an optional description property to page metadata for improved content details.
  • Refactor

    • Updated editors to use an internal hook for determining flagged extensions, removing the need to pass this information via props.
    • Simplified logic for inserting new paragraphs at the end of editor documents.
  • Enhancements

    • Integrated the description property into page state management and serialization.

Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

A new hook for managing editor extension states is introduced and integrated into both lite and rich text editors, replacing previous prop-based flagged extension handling. The editor container logic for inserting paragraphs is simplified. Additionally, slash command menu items now support an optional badge, with corresponding type updates. The TPage type is updated to include an optional description property. The BasePage class is extended to include a new observable description property.

Changes

Cohort / File(s) Change Summary
Editor Flagging Hook Introduction
apps/space/ce/hooks/use-editor-flagging.ts
Introduces useEditorFlagging hook to provide disabled and flagged extensions for different editor types. Exports related type alias.
Editor Components Integration
apps/space/core/components/editor/lite-text-editor.tsx, apps/space/core/components/editor/rich-text-editor.tsx
Removes external flaggedExtensions prop, now uses the new hook to obtain flagged extensions internally based on anchor/workspace. Combines hook-based disabled extensions with additional disabled extensions from props.
Editor Container Logic Update
packages/editor/src/core/components/editors/editor-container.tsx
Simplifies logic for determining and inserting a new paragraph at the end of the document by directly accessing the last child node.
Slash Command Badge Support
packages/editor/src/core/extensions/slash-commands/command-menu-item.tsx, packages/editor/src/core/types/slash-commands-suggestion.ts
Adds support for an optional badge property on slash command items, updates type definition and rendering logic to display badge.
Page Type Enhancement
packages/types/src/page/core.ts
Refactors TPage type intersection order and adds optional description property of type `object
BasePage Store Update
apps/web/core/store/pages/base-page.ts
Adds observable description property to BasePage class, initializes it from page data, and includes it in the serialized JSON representation.

Sequence Diagram(s)

sequenceDiagram
    participant EditorComponent
    participant useEditorFlagging
    participant EditorExtensionState

    EditorComponent->>useEditorFlagging: Call with anchor/workspaceSlug
    useEditorFlagging-->>EditorComponent: Returns { document, liteText, richText } extension states
    EditorComponent->>EditorExtensionState: Passes flagged/disabled extensions to editor instance
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Suggested labels

ready to merge

Suggested reviewers

  • Palanikannan1437

Poem

A hop, a skip, a hook anew,
Editors now know what to do!
Badges shine on slash command lines,
Paragraphs align where logic refines.
With flagged extensions tucked in tight,
This rabbit’s code feels just right! 🐇✨

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 88be994 and 224e335.

📒 Files selected for processing (1)
  • apps/web/core/store/pages/base-page.ts (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/web/core/store/pages/base-page.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). (3)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript)
✨ 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-space_feature_flag

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.
  • 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.

Support

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

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.

Copy link

makeplane bot commented Jul 31, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@VipinDevelops VipinDevelops marked this pull request as ready for review July 31, 2025 16:47
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: 0

🧹 Nitpick comments (2)
apps/space/ce/hooks/use-editor-flagging.ts (2)

22-22: Consider removing or documenting the unused parameter.

The workspaceSlug parameter is currently unused in the hook implementation. Either remove it if not needed, or add a comment explaining its future intended use.

-export const useEditorFlagging = (workspaceSlug: string): TEditorFlaggingHookReturnType => ({
+export const useEditorFlagging = (_workspaceSlug: string): TEditorFlaggingHookReturnType => ({

Or add a comment:

+/**
+ * @param workspaceSlug - Reserved for future workspace-specific extension configuration
+ */
 export const useEditorFlagging = (workspaceSlug: string): TEditorFlaggingHookReturnType => ({

23-35: Consider reducing code duplication for disabled extensions.

The same disabled extensions are repeated across all editor types. Consider extracting to a constant for better maintainability.

+const COMMON_DISABLED_EXTENSIONS: TExtensions[] = ["ai", "collaboration-cursor"];
+
 export const useEditorFlagging = (workspaceSlug: string): TEditorFlaggingHookReturnType => ({
   document: {
-    disabled: ["ai", "collaboration-cursor"],
+    disabled: COMMON_DISABLED_EXTENSIONS,
     flagged: [],
   },
   liteText: {
-    disabled: ["ai", "collaboration-cursor"],
+    disabled: COMMON_DISABLED_EXTENSIONS,
     flagged: [],
   },
   richText: {
-    disabled: ["ai", "collaboration-cursor"],
+    disabled: COMMON_DISABLED_EXTENSIONS,
     flagged: [],
   },
 });
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cc49a2c and 861e87a.

📒 Files selected for processing (6)
  • apps/space/ce/hooks/use-editor-flagging.ts (1 hunks)
  • apps/space/core/components/editor/lite-text-editor.tsx (2 hunks)
  • apps/space/core/components/editor/rich-text-editor.tsx (3 hunks)
  • packages/editor/src/core/components/editors/editor-container.tsx (1 hunks)
  • packages/editor/src/core/extensions/slash-commands/command-menu-item.tsx (1 hunks)
  • packages/editor/src/core/types/slash-commands-suggestion.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: in the plane project codebase, the path alias `@/plane-web` resolves to the `ce` directory, making i...
Learnt from: vamsikrishnamathala
PR: makeplane/plane#7061
File: web/core/components/workspace-notifications/root.tsx:18-18
Timestamp: 2025-05-14T13:16:23.323Z
Learning: In the Plane project codebase, the path alias `@/plane-web` resolves to the `ce` directory, making imports like `@/plane-web/hooks/use-notification-preview` correctly resolve to files in `web/ce/hooks/`.

Applied to files:

  • apps/space/core/components/editor/rich-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). (1)
  • GitHub Check: Build and lint web apps
🔇 Additional comments (12)
packages/editor/src/core/types/slash-commands-suggestion.ts (2)

3-3: LGTM: Proper use of type-only import.

Converting to a type-only import is appropriate since TEditorCommands is only used for type annotation on line 13.


21-21: LGTM: Well-designed optional property addition.

The optional badge property allows for enhanced UI elements in slash command items while maintaining backward compatibility. The React.ReactNode type is appropriate for flexible content rendering.

packages/editor/src/core/extensions/slash-commands/command-menu-item.tsx (2)

35-35: LGTM: Clean implementation of badge rendering.

The badge is rendered appropriately after the title. Since the badge property is optional, React will handle undefined values gracefully by not rendering anything when no badge is provided.


1-39: Note: Inconsistency between PR objectives and provided changes.

The PR objectives mention fixing a trailing node issue when clicking at the end of the editor, but the provided files only show changes related to adding badge support to slash command menu items. The AI summary also mentions editor extension states and container logic changes that aren't visible in these files.

Could you verify that all relevant files for the trailing node fix are included in this review? The current changes appear to be unrelated to the stated bug fix objective.

Likely an incorrect or invalid review comment.

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

3-3: Import path looks correct.

The import path ce/hooks/use-editor-flagging correctly resolves based on the project's path alias structure.


30-32: Proper integration of the new hook.

The component correctly removes the external flaggedExtensions prop dependency and uses the centralized useEditorFlagging hook. The anchor parameter is appropriately passed to the hook.


50-50: Correct usage of hook-provided flagged extensions.

The richText.flagged property from the hook is correctly passed to the editor component, maintaining the same functionality while centralizing extension management.

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

11-11: Import path correctly resolves to the ce directory.

Based on the project's path alias configuration, @/plane-web/hooks/use-editor-flagging correctly resolves to the ce/hooks/ directory.


48-48: Proper hook integration matches RichTextEditor pattern.

The component correctly uses the centralized useEditorFlagging hook with the anchor parameter, following the same pattern as the RichTextEditor component.


55-55: Correct usage of liteText flagged extensions.

The liteText.flagged property is correctly passed to the editor, maintaining consistency with the centralized extension management approach.

packages/editor/src/core/components/editors/editor-container.tsx (2)

51-53: Simplified last node retrieval improves readability.

The direct access to doc.lastChild is cleaner and more efficient than the previous position-based approach.


57-63: Logic improvement aligns with PR objective to fix trailing node issue.

The updated condition correctly checks if the last node is a paragraph before deciding to insert a new one. This prevents unnecessary paragraph insertion when the last node is already a paragraph, which should fix the trailing node behavior when clicking at the end of the editor.

@aaryan610 aaryan610 changed the title [WIKI-485] fix : trail node [WIKI-485] fix: trail node Aug 1, 2025
@VipinDevelops VipinDevelops changed the title [WIKI-485] fix: trail node [WIKI-576] fix: trail node Aug 1, 2025
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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3ae1011 and 0a8da5c.

📒 Files selected for processing (1)
  • apps/space/ce/hooks/use-editor-flagging.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/space/ce/hooks/use-editor-flagging.ts (1)
packages/editor/src/core/types/extensions.ts (1)
  • TExtensions (1-1)
⏰ 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). (3)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
  • GitHub Check: Build and lint web apps
🔇 Additional comments (2)
apps/space/ce/hooks/use-editor-flagging.ts (2)

1-2: LGTM!

The import statement correctly imports the TExtensions type from the editor package, which is properly used throughout the file.


4-17: Well-structured type definition.

The type definition provides a clear and consistent structure for managing extension states across different editor types. The naming convention and organization are appropriate.

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: 0

🧹 Nitpick comments (1)
packages/types/src/page/core.ts (1)

11-11: Consider using a more specific type for better type safety.

The new description property uses the generic object type. While this provides flexibility, consider using a more specific type (e.g., Record<string, any> or a dedicated interface) for better type safety and developer experience.

However, if this needs to match the flexibility of editor content structures, the current object type may be appropriate.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 490ef0c and 88be994.

📒 Files selected for processing (1)
  • packages/types/src/page/core.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/types/src/page/core.ts (1)
packages/types/src/page/extended.ts (1)
  • TPageExtended (1-1)
⏰ 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: CodeQL
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
  • GitHub Check: Build and lint web apps
🔇 Additional comments (2)
packages/types/src/page/core.ts (2)

5-5: LGTM!

The TPage type definition structure is clean and well-organized.


24-24: LGTM!

The intersection with TPageExtended at the end of the type definition follows TypeScript best practices and provides good extensibility while maintaining type safety for the core properties.

@pushya22 pushya22 merged commit fa150c2 into preview Aug 4, 2025
5 of 7 checks passed
@pushya22 pushya22 deleted the refactor-space_feature_flag branch August 4, 2025 10:42
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* fix : trail node

* remove flagged

* refactor : add disable flagging

* refactor:update disabled extension

* refactor: additional disabled

* refactor: update enum

* chore: add description key to page response type

* chore: update base page instance

---------

Co-authored-by: Aaryan Khandelwal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants