-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[WIKI-632] chore: accept additional props for document collaborative editor #7718
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
[WIKI-632] chore: accept additional props for document collaborative editor #7718
Conversation
Note Other AI code review bot(s) detectedCodeRabbit 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. WalkthroughAdds a new TrailingNode TipTap/ProseMirror extension and re-exports it; expands editor prop types to accept Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks (1 passed, 2 warnings)❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
Poem
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.
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 detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (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). (2)
✨ Finishing Touches
🧪 Generate unit tests
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 |
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
There was a problem hiding this 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.
return; | ||
} | ||
|
||
// eslint-disable-next-line consistent-return |
There was a problem hiding this comment.
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.
return; | |
} | |
// eslint-disable-next-line consistent-return | |
return null; | |
} |
Copilot uses AI. Check for mistakes.
There was a problem hiding this 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 propsUse 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 genericThis 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 DXExporting 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.
📒 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
There was a problem hiding this 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 downstreamDestructure and pass a sanitized
restProps
toEditorWrapper
soextendedEditorProps
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, souseCallback
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.
📒 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 handlingEnsure
RichTextEditorAdditionalExtensions
acceptsextendedEditorProps?: T
and behaves correctly whenundefined
. If it requires an object, coerce here or inside the helper.
There was a problem hiding this 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.
📒 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 tosrc/ce/*
in this package’s tsconfig, soICollaborativeDocumentEditorPropsExtended
is imported locally frompackages/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.
…re/add-collaborative-extended-props
Description
This PR accepts additional props for the document collaborative editor.
Type of Change
Summary by CodeRabbit