[WIKI-644] fix: remove unnecessary props from the editor package#7726
[WIKI-644] fix: remove unnecessary props from the editor package#7726sriramveeraghanta merged 1 commit intopreviewfrom
Conversation
WalkthroughThis PR removes the embedHandler-based configuration across the editor stack and introduces extendedEditorProps instead. It updates component props, hooks, types, and extensions accordingly, and deletes issue-embed logic and related imports. All call sites are rewired to pass extendedEditorProps through to editor initialization and extension builders. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor App as apps/web DocumentEditor
participant Wrap as EditorWrapper
participant Hook as useEditor / useCollaborativeEditor
participant Ext as CoreEditorExtensions
participant Tiptap as Tiptap Editor
App->>Wrap: render({ extendedEditorProps, ... })
Wrap->>Hook: init({ extendedEditorProps, ... })
Hook->>Ext: buildExtensions({ extendedEditorProps, ... })
note over Ext: No embedHandler<br/>No dynamic WorkItemEmbed injection
Ext-->>Hook: extensions[]
Hook->>Tiptap: createEditor({ extensions, extendedEditorProps, ... })
Tiptap-->>App: editor instance
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/editor/src/core/extensions/extensions.ts (1)
55-66: Guard disabledExtensions to avoid runtime crash on .includesdisabledExtensions may be undefined from upstream props; calling .includes will throw. Default it to an empty array when destructuring.
Apply this diff:
const { - disabledExtensions, + disabledExtensions = [], enableHistory, fileHandler, flaggedExtensions, isTouchDevice = false, mentionHandler, placeholder, tabIndex, editable, extendedEditorProps, } = args;
🧹 Nitpick comments (4)
apps/web/core/components/pages/editor/editor-body.tsx (1)
63-64: Type source alignment for extendedEditorPropsYou’re passing extendedEditorProps typed from plane-web into @plane/editor. To prevent drift, consider importing the type directly from @plane/editor (or add a compile-time compatibility check) so app and package stay in lockstep.
You can add a non-emitting check somewhere in web (e.g., a types-only file):
// Ensures app's TExtendedEditorExtensionsConfig matches editor's expectation import type { IEditorProps } from "@plane/editor"; import type { TExtendedEditorExtensionsConfig } from "@/plane-web/hooks/pages"; type __Compat = TExtendedEditorExtensionsConfig extends NonNullable<IEditorProps["extendedEditorProps"]> ? true : never;Also applies to: 80-81, 247-248
packages/editor/src/core/hooks/use-editor.ts (1)
43-81: Confirm extendedEditorProps mutability expectations (editor re-init deps)The editor is only recreated when editable changes. If extendedEditorProps can change at runtime and is expected to affect extensions/behavior, add it (or a stable key derived from it) to the dependency array; otherwise, document that it must be immutable during the editor’s lifetime.
packages/editor/src/core/hooks/use-collaborative-editor.ts (1)
82-110: Propagation OK; verify runtime updates to extendedEditorPropsextendedEditorProps is passed through to useEditor and DocumentEditorAdditionalExtensions, but the underlying editor won’t re-init unless editable changes. If extendedEditorProps needs to be dynamically applied, consider adding a stable dependency (or reconfiguration path) to trigger re-init; otherwise specify it as immutable.
packages/editor/src/core/components/editors/document/editor.tsx (1)
40-63: useMemo without dependencies freezes extension configextensions is memoized with an empty dependency array, so changes to disabledExtensions, flaggedExtensions, editable, fileHandler, user, or extendedEditorProps won’t recompute. If that’s intentional, ignore; otherwise, add explicit deps.
Apply this diff:
- }, []); + }, [disabledExtensions, editable, extendedEditorProps, flaggedExtensions, fileHandler, user]);
📜 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 (12)
apps/web/core/components/editor/document/editor.tsx(3 hunks)apps/web/core/components/pages/editor/editor-body.tsx(2 hunks)packages/editor/src/ce/extensions/core/extensions.ts(1 hunks)packages/editor/src/ce/extensions/document-extensions.tsx(1 hunks)packages/editor/src/core/components/editors/document/collaborative-editor.tsx(3 hunks)packages/editor/src/core/components/editors/document/editor.tsx(4 hunks)packages/editor/src/core/components/editors/editor-wrapper.tsx(2 hunks)packages/editor/src/core/extensions/extensions.ts(4 hunks)packages/editor/src/core/hooks/use-collaborative-editor.ts(3 hunks)packages/editor/src/core/hooks/use-editor.ts(2 hunks)packages/editor/src/core/types/editor.ts(0 hunks)packages/editor/src/core/types/hook.ts(2 hunks)
💤 Files with no reviewable changes (1)
- packages/editor/src/core/types/editor.ts
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-05-14T13:16:23.323Z
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/web/core/components/pages/editor/editor-body.tsx
📚 Learning: 2025-09-02T08:14:49.260Z
Learnt from: sriramveeraghanta
PR: makeplane/plane#7697
File: apps/web/app/(all)/[workspaceSlug]/(projects)/header.tsx:12-13
Timestamp: 2025-09-02T08:14:49.260Z
Learning: The star-us-link.tsx file in apps/web/app/(all)/[workspaceSlug]/(projects)/ already has "use client" directive at the top, making it a proper Client Component for hook usage.
Applied to files:
apps/web/core/components/pages/editor/editor-body.tsx
🧬 Code graph analysis (2)
packages/editor/src/core/types/hook.ts (1)
packages/editor/src/core/types/editor.ts (1)
ICollaborativeDocumentEditorProps(171-179)
apps/web/core/components/editor/document/editor.tsx (2)
packages/editor/src/core/types/editor.ts (1)
IDocumentEditorProps(181-185)packages/editor/src/ce/types/editor-extended.ts (1)
IEditorPropsExtended(3-3)
⏰ 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 (10)
packages/editor/src/core/components/editors/editor-wrapper.tsx (1)
28-28: Confirm merge precedence in useEditor
embedHandler is no longer referenced in packages/editor; extendedEditorProps is passed through to useEditor and the Editor component. Verify in packages/editor/src/core/hooks/use-editor.ts that extendedEditorProps is spread after editorProps so any overlapping keys in extendedEditorProps override those in editorProps.packages/editor/src/ce/extensions/core/extensions.ts (1)
5-8: Good swap to extendedEditorProps in core extension propsThe Pick now exposes extendedEditorProps alongside disabled/flagged/fileHandler, matching the refactor direction.
packages/editor/src/ce/extensions/document-extensions.tsx (1)
7-10: Document extensions props now include extendedEditorPropsAlignment with the new API surface looks good. No behavior changes in the registry; future extensions can consume extendedEditorProps if needed.
packages/editor/src/core/extensions/extensions.ts (1)
32-32: Prop migration to extendedEditorProps looks consistentImport/type surface, arg pick, destructuring, and plumbing into CoreEditorAdditionalExtensions all align with the new API.
Also applies to: 48-49, 65-66, 120-121
packages/editor/src/core/hooks/use-collaborative-editor.ts (1)
24-24: Rename alignment LGTMThe switch from embedHandler to extendedEditorProps is consistent across destructuring and call sites.
Also applies to: 85-85, 103-103
packages/editor/src/core/components/editors/document/editor.tsx (1)
10-10: Prop migration to extendedEditorProps is cleanImports, props, additional extensions, and useEditor wiring are consistently updated.
Also applies to: 29-29, 49-51, 69-70
packages/editor/src/core/components/editors/document/collaborative-editor.tsx (1)
24-24: Embed removal + extendedEditorProps wiring looks goodRemoved embed-specific wiring and consistently threaded extendedEditorProps, including into side-effects.
Also applies to: 55-56, 86-86
apps/web/core/components/editor/document/editor.tsx (3)
21-25: Good: internal props omitted and wrapper-supplied extendedEditorProps addedOmitting file/mention handlers, user, and extendedEditorProps from the base props prevents external override and keeps the wrapper authoritative. This matches how you spread
...restlater.
43-44: Destructure order avoids accidental override via ...restPulling
extendedEditorPropsout before...rest(and omitting it in the base type) prevents consumers from slipping it through inrest.
84-85: Prop is correctly wired through to DocumentEditorWithRefThe pass-through of
extendedEditorPropsis consistent with the new API.
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the editor package by removing the embedHandler prop and replacing it with extendedEditorProps to simplify the editor API and remove unnecessary dependencies on issue embed functionality.
- Removes
embedHandlerprop from all editor types and components - Replaces
embedHandlerwithextendedEditorPropsthroughout the codebase - Eliminates issue embed extension dependencies from document editors
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/editor/src/core/types/hook.ts | Updated type definitions to remove embedHandler and add extendedEditorProps |
| packages/editor/src/core/types/editor.ts | Removed embedHandler from IEditorProps and related interfaces |
| packages/editor/src/core/hooks/use-editor.ts | Updated hook to use extendedEditorProps instead of embedHandler |
| packages/editor/src/core/hooks/use-collaborative-editor.ts | Replaced embedHandler with extendedEditorProps in collaborative editor hook |
| packages/editor/src/core/extensions/extensions.ts | Updated CoreEditorExtensions to use extendedEditorProps parameter |
| packages/editor/src/core/components/editors/editor-wrapper.tsx | Removed embedHandler prop and added extendedEditorProps |
| packages/editor/src/core/components/editors/document/editor.tsx | Removed WorkItemEmbedExtension usage and embedHandler prop |
| packages/editor/src/core/components/editors/document/collaborative-editor.tsx | Simplified by removing embed extension logic and embedHandler |
| packages/editor/src/ce/extensions/document-extensions.tsx | Updated type definition to use extendedEditorProps instead of embedConfig |
| packages/editor/src/ce/extensions/core/extensions.ts | Updated type to use extendedEditorProps instead of embedHandler |
| apps/web/core/components/pages/editor/editor-body.tsx | Removed issue embed hook usage and embedHandler prop |
| apps/web/core/components/editor/document/editor.tsx | Updated to use extendedEditorProps and removed issue embed functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
packages/editor/src/core/components/editors/document/collaborative-editor.tsx
Show resolved
Hide resolved
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
Description
This PR removes unnecessary props from the editor package.
Type of Change
Summary by CodeRabbit