Skip to content

Conversation

1akhanBaheti
Copy link
Collaborator

@1akhanBaheti 1akhanBaheti commented Sep 3, 2025

Description

This PR accepts additional props for the document collaborative editor.

Type of Change

  • Code refactoring

Summary by CodeRabbit

  • New Features
    • Adds a configurable trailing-content extension that ensures a clean, editable line at the end of documents for smoother typing and selection.
    • Exposes the trailing-content extension for projects to adopt or customize.
    • Introduces optional extended configuration support for rich-text and collaborative editors; editors now accept and forward these extended props.

Copy link
Contributor

coderabbitai bot commented Sep 3, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a new TrailingNode TipTap/ProseMirror extension and re-exports it; expands editor prop types to accept extendedEditorProps / extendedDocumentEditorProps and adds a placeholder ICollaborativeDocumentEditorPropsExtended. Rich-text components now accept and forward extendedEditorProps; no other runtime logic changes besides TrailingNode.

Changes

Cohort / File(s) Summary
Editor prop plumbing
packages/editor/src/ce/extensions/rich-text-extensions.tsx, packages/editor/src/ce/types/editor-extended.ts, packages/editor/src/core/types/editor.ts, packages/editor/src/core/components/editors/rich-text/editor.tsx
Adds extendedEditorProps to TRichTextEditorAdditionalExtensionsProps and forwards it through RichTextEditor; introduces ICollaborativeDocumentEditorPropsExtended = unknown; adds optional extendedDocumentEditorProps?: ICollaborativeDocumentEditorPropsExtended to collaborative editor props.
Trailing node extension + export
packages/editor/src/core/extensions/trailing-node.ts, packages/editor/src/index.ts
Adds TrailingNode extension and TrailingNodeOptions implementing a ProseMirror plugin that tracks last-node type and appends a configurable trailing node at document end when allowed; re-exports TrailingNode from package index.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Editor
  participant RichTextExt as RichTextAdditionalExtensions
  participant TrailingNodeExt as TrailingNode Extension
  participant PM as ProseMirror Plugin

  User->>Editor: Initialize editor (may include extendedEditorProps)
  Editor->>RichTextExt: getExtensions(extendedEditorProps, disabled/flaggedExtensions, fileHandler)
  RichTextExt->>Editor: returns extensions (may include TrailingNode)
  Editor->>PM: apply(transaction)
  PM->>PM: update plugin state (isLastNodeAllowed)
  alt allowed and missing trailing node
    PM-->>Editor: appendTransaction -> insert trailing node at doc end
  else not allowed or already present
    PM-->>Editor: no changes
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

🌐frontend, 🛠️refactor

Suggested reviewers

  • VipinDevelops
  • Palanikannan1437

Pre-merge checks (1 passed, 2 warnings)

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The current description provides a brief overview and marks the change as code refactoring, but it omits the mandatory “Test Scenarios” and “References” sections from the repository template and lacks detail on the new trailing-node extension, rich-text adjustments, and type updates. Without specifying how the changes were tested or linking to the related issue, the description does not fully meet the required structure. Please complete the “Test Scenarios” section with the steps or automated tests used to verify the behavior, add a “References” section linking to WIKI-632 or other related issues, and expand the description to summarize all substantive changes, including the new trailing-node extension and rich-text prop updates.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title “[WIKI-632] chore: accept additional props for document collaborative editor” clearly identifies a real aspect of the changeset by highlighting that extended props are now accepted by the collaborative editor, and it is concise without irrelevant detail or noise. Although the PR also introduces a trailing-node extension and rich-text updates, the title remains specific and meaningful rather than vague or misleading.

Poem

I nibble code beneath the moonlit nodes,
I hop and plant a paragraph where the document bodes.
Props stretch wider like ears so keen,
A gentle node appears where the last has been.
Carrot tucked, I sign the patch — hop! 🥕🐇

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 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 a858c7d and ef7d430.

📒 Files selected for processing (1)
  • packages/editor/src/core/extensions/trailing-node.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/editor/src/core/extensions/trailing-node.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). (2)
  • GitHub Check: Build and lint web apps
  • 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 chore/add-collaborative-extended-props

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@1akhanBaheti 1akhanBaheti changed the title chore: add collaborative document editor extended props [WIKI-632] chore: accept additional props for document collaborative editor Sep 4, 2025
Copy link

makeplane bot commented Sep 4, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@1akhanBaheti 1akhanBaheti marked this pull request as ready for review September 4, 2025 08:39
@Copilot Copilot AI review requested due to automatic review settings September 4, 2025 08:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the document collaborative editor to accept additional props, enabling more extensible configuration and customization options.

  • Adds export for TrailingNode extension to make it available for external use
  • Introduces a new extendedDocumentEditorProps property to the collaborative document editor interface
  • Includes extendedEditorProps in the rich text editor additional extensions props type

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/editor/src/index.ts Exports TrailingNode extension for external consumption
packages/editor/src/core/types/editor.ts Adds optional extended props parameter to collaborative editor interface
packages/editor/src/core/extensions/trailing-node.ts New extension that ensures trailing nodes in the editor
packages/editor/src/ce/types/editor-extended.ts Defines new type for collaborative document editor extended props
packages/editor/src/ce/extensions/rich-text-extensions.tsx Includes extended editor props in additional extensions configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +39 to +42
return;
}

// eslint-disable-next-line consistent-return
Copy link
Preview

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

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

The eslint-disable comment suggests inconsistent return patterns. Consider refactoring to have consistent return behavior throughout the function.

Suggested change
return;
}
// eslint-disable-next-line consistent-return
return null;
}

Copilot uses AI. Check for mistakes.

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

🧹 Nitpick comments (3)
packages/editor/src/ce/types/editor-extended.ts (1)

5-6: Prefer interface for augmentation-friendly extended props

Use an interface (vs. unknown type alias) so downstreams can module-augment the collaborative editor props without forking types.

-export type ICollaborativeDocumentEditorPropsExtended = unknown;
+export interface ICollaborativeDocumentEditorPropsExtended {}
packages/editor/src/core/types/editor.ts (1)

181-182: Expose extended collaborative props — consider future-proofing with a generic

This is fine. If you want stronger typing per integration, consider a generic wrapper so callers can carry their own shape through:

// Example (non-breaking if introduced alongside the existing type)
export type ICollaborativeDocumentEditorProps<
  E extends ICollaborativeDocumentEditorPropsExtended = ICollaborativeDocumentEditorPropsExtended
> = Omit<IEditorProps, "initialValue" | "onEnterKeyPress" | "value"> & {
  /* ...existing fields... */
  extendedDocumentEditorProps?: E;
};
packages/editor/src/index.ts (1)

22-23: Re-export options type for better DX

Exporting the options type alongside the extension helps consumers type their configs.

 // additional exports
-export { TrailingNode } from "./core/extensions/trailing-node";
+export { TrailingNode } from "./core/extensions/trailing-node";
+export type { TrailingNodeOptions } from "./core/extensions/trailing-node";
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9965fc7 and 0de2375.

📒 Files selected for processing (5)
  • packages/editor/src/ce/extensions/rich-text-extensions.tsx (1 hunks)
  • packages/editor/src/ce/types/editor-extended.ts (1 hunks)
  • packages/editor/src/core/extensions/trailing-node.ts (1 hunks)
  • packages/editor/src/core/types/editor.ts (2 hunks)
  • packages/editor/src/index.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/editor/src/core/types/editor.ts (1)
packages/editor/src/ce/types/editor-extended.ts (1)
  • ICollaborativeDocumentEditorPropsExtended (5-5)
packages/editor/src/core/extensions/trailing-node.ts (1)
packages/editor/src/index.ts (1)
  • TrailingNode (23-23)
⏰ 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 (1)
packages/editor/src/core/types/editor.ts (1)

9-9: Import looks good

@1akhanBaheti 1akhanBaheti marked this pull request as draft September 4, 2025 10:19
@1akhanBaheti 1akhanBaheti marked this pull request as ready for review September 4, 2025 11:56
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)
packages/editor/src/core/components/editors/rich-text/editor.tsx (2)

18-22: Add rest props to avoid leaking unknown props downstream

Destructure and pass a sanitized restProps to EditorWrapper so extendedEditorProps doesn’t get forwarded unintentionally.

-    flaggedExtensions,
-    extendedEditorProps,
+    flaggedExtensions,
+    extendedEditorProps,
+    ...restProps,
   } = props;

Outside this range, use:

<EditorWrapper {...restProps} extensions={getExtensions()} />

23-41: Use useMemo instead of useCallback + immediate invocation

getExtensions() is called right away, so useCallback doesn’t help. Memoize the array directly to avoid recomputation churn.

-  const getExtensions = useCallback(() => {
-    const extensions = [
+  const extensions = useMemo(() => ([
       ...externalExtensions,
       SideMenuExtension({
         aiEnabled: false,
         dragDropEnabled: !!dragDropEnabled,
       }),
       ...RichTextEditorAdditionalExtensions({
         disabledExtensions,
         fileHandler,
         flaggedExtensions,
         extendedEditorProps,
       }),
-    ];
-
-    return extensions;
-  }, [dragDropEnabled, disabledExtensions, externalExtensions, fileHandler, flaggedExtensions, extendedEditorProps]);
+  ]), [dragDropEnabled, disabledExtensions, externalExtensions, fileHandler, flaggedExtensions, extendedEditorProps]);

Outside this range:

// import
import { forwardRef, useMemo } from "react";

// usage
<EditorWrapper {...restProps} extensions={extensions} />
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0de2375 and 9a2ece5.

📒 Files selected for processing (1)
  • packages/editor/src/core/components/editors/rich-text/editor.tsx (2 hunks)
⏰ 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 (1)
packages/editor/src/core/components/editors/rich-text/editor.tsx (1)

30-36: Plumbing looks good; confirm type and undefined handling

Ensure RichTextEditorAdditionalExtensions accepts extendedEditorProps?: T and behaves correctly when undefined. If it requires an object, coerce here or inside the helper.

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/editor/src/core/types/editor.ts (1)

176-186: Consider a generic to carry the extended props’ shape (keeps backward-compat).

-export type ICollaborativeDocumentEditorProps = Omit<IEditorProps, "initialValue" | "onEnterKeyPress" | "value"> & {
+export type ICollaborativeDocumentEditorProps<
+  TExtended = ICollaborativeDocumentEditorPropsExtended
+> = Omit<IEditorProps, "initialValue" | "onEnterKeyPress" | "value"> & {
   aiHandler?: TAIHandler;
   documentLoaderClassName?: string;
   dragDropEnabled?: boolean;
   editable: boolean;
   embedHandler: TEmbedConfig;
   realtimeConfig: TRealtimeConfig;
   serverHandler?: TServerHandler;
   user: TUserDetails;
-  extendedDocumentEditorProps?: ICollaborativeDocumentEditorPropsExtended;
+  extendedDocumentEditorProps?: TExtended;
 };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9a2ece5 and 2994e51.

📒 Files selected for processing (3)
  • packages/editor/src/core/extensions/trailing-node.ts (1 hunks)
  • packages/editor/src/core/types/editor.ts (2 hunks)
  • packages/editor/src/index.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/editor/src/core/extensions/trailing-node.ts
  • packages/editor/src/index.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/editor/src/core/types/editor.ts (1)
packages/editor/src/ce/types/editor-extended.ts (1)
  • ICollaborativeDocumentEditorPropsExtended (5-5)
⏰ 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: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/editor/src/core/types/editor.ts (1)

9-13: Import path valid per tsconfig
The @/plane-editor alias is mapped to src/ce/* in this package’s tsconfig, so ICollaborativeDocumentEditorPropsExtended is imported locally from packages/editor/src/ce/types/editor-extended.ts and not from another package. Ignore the cross-package coupling concern.

Likely an incorrect or invalid review comment.

aaryan610
aaryan610 previously approved these changes Sep 10, 2025
@sriramveeraghanta sriramveeraghanta merged commit 11cd8d1 into preview Sep 11, 2025
6 of 7 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore/add-collaborative-extended-props branch September 11, 2025 08:45
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.

3 participants