[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.
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
extendedDocumentEditorPropsproperty to the collaborative document editor interface - Includes
extendedEditorPropsin 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.
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; | |
| } |
There was a problem hiding this comment.
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.
unknowntype 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.
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
restPropstoEditorWrappersoextendedEditorPropsdoesn’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, souseCallbackdoesn’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
RichTextEditorAdditionalExtensionsacceptsextendedEditorProps?: Tand behaves correctly whenundefined. If it requires an object, coerce here or inside the helper.
There was a problem hiding this comment.
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-editoralias is mapped tosrc/ce/*in this package’s tsconfig, soICollaborativeDocumentEditorPropsExtendedis imported locally frompackages/editor/src/ce/types/editor-extended.tsand not from another package. Ignore the cross-package coupling concern.Likely an incorrect or invalid review comment.
…re/add-collaborative-extended-props
* chore: added access for workspace admin to edit project settings * chore: workspace admin to update members details * chore: workspace admin to label, state, workflow settings * Revert "chore: added access for workspace admin to edit project settings" This reverts commit 803b56514887339d884eaef170de8a9e4ecfda8c. * chore: updated worspace admin access for projects * Revert "chore: workspace admin to update members details" This reverts commit ac465d618d7a89ef696db3484e515957b6b5e264. * Revert "chore: workspace admin to label, state, workflow settings" This reverts commit f01a89604e71792096cbae8e029cac160ea209fb. * chore: workspace admin access in permission classes and decorator * chore: check for teamspace members * chore: refactor permission logic * [WIKI-632] chore: accept additional props for document collaborative editor (#7718) * chore: add collaborative document editor extended props * fix: additional rich text extension props * fix: formatting * chore: add types to the trailing node extension --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> * [WEB-4854] chore: project admin accesss to workspace admins (#7749) * chore: project admin accesss to workspace admins * chore: frontend changes * chore: remove console.log * chore: refactor permission decorator * chore: role enum * chore: rearrange role_choices * Potential fix for code scanning alert no. 636: URL redirection from remote source (#7760) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * [WEB-4441]fix: members account type dropdown position #7759 * [WEB-4857] fix: applied filters root update #7750 * [WEB-4858]chore: updated content for error page (#7766) * chore: updated content for error page * chore: updated btn url * fix: merge conflicts * fix: merge conflicts * fix: use enum for roles --------- Co-authored-by: vamsikrishnamathala <matalav55@gmail.com> Co-authored-by: Lakhan Baheti <94619783+1akhanBaheti@users.noreply.github.com> Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Vamsi Krishna <46787868+vamsikrishnamathala@users.noreply.github.com>
…editor (makeplane#7718) * chore: add collaborative document editor extended props * fix: additional rich text extension props * fix: formatting * chore: add types to the trailing node extension --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
Description
This PR accepts additional props for the document collaborative editor.
Type of Change
Summary by CodeRabbit