Skip to content

[WIKI-644] fix: remove unnecessary props from the editor package#7726

Merged
sriramveeraghanta merged 1 commit intopreviewfrom
fix/editor-embed-handler
Sep 5, 2025
Merged

[WIKI-644] fix: remove unnecessary props from the editor package#7726
sriramveeraghanta merged 1 commit intopreviewfrom
fix/editor-embed-handler

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Sep 4, 2025

Description

This PR removes unnecessary props from the editor package.

Type of Change

  • Code refactoring

Summary by CodeRabbit

  • New Features
    • Added extended editor settings for richer customization of the document editor experience.
  • Refactor
    • Removed issue embedding support across document editors, simplifying the editor and extension setup.
    • Streamlined editor configuration in collaborative and standard editors to use the new extended settings.
    • Cleaned up related editor options and wiring for a more consistent API.
  • Chores
    • Updated internal types and props to align with the new configuration approach.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 4, 2025

Walkthrough

This 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

Cohort / File(s) Summary of changes
Web Document Editor component
apps/web/core/components/editor/document/editor.tsx
Public API: remove embedHandler; add extendedEditorProps?: Partial<IEditorPropsExtended>. Import IEditorPropsExtended. Drop issue-embed hook/logic. Pass extendedEditorProps to DocumentEditorWithRef.
Web Editor Page body
apps/web/core/components/pages/editor/editor-body.tsx
Remove issue embed integration: delete useIssueEmbed import/usage and embedHandler wiring. Comment tweaks only otherwise.
Core editor components (document + wrapper)
packages/editor/src/core/components/editors/document/editor.tsx, packages/editor/src/core/components/editors/document/collaborative-editor.tsx, packages/editor/src/core/components/editors/editor-wrapper.tsx
Replace embedHandler with extendedEditorProps in props and wiring. Remove dynamic WorkItemEmbedExtension assembly and related imports. Pass through extendedEditorProps to hooks/extension builders; simplify extensions handling.
Core hooks
packages/editor/src/core/hooks/use-editor.ts, packages/editor/src/core/hooks/use-collaborative-editor.ts
Update hook prop types to add extendedEditorProps and remove embedHandler. Thread extendedEditorProps into CoreEditorExtensions and DocumentEditorAdditionalExtensions; stop passing embedHandler.
Core extensions
packages/editor/src/core/extensions/extensions.ts
Argument surface: replace embedHandler with extendedEditorProps. Forward extendedEditorProps into CoreEditorAdditionalExtensions. Remove TEmbedConfig import.
Community edition (CE) extensions
packages/editor/src/ce/extensions/core/extensions.ts, packages/editor/src/ce/extensions/document-extensions.tsx
Types: replace Pick<... "embedHandler"> with "extendedEditorProps". Remove TEmbedConfig/embedConfig from document extensions props; keep other fields.
Core types
packages/editor/src/core/types/editor.ts, packages/editor/src/core/types/hook.ts
Remove embedHandler from IEditorProps, ICollaborativeDocumentEditorProps, IDocumentEditorProps. Add extendedEditorProps to core hook props mapping; update collaborative hook pick to exclude embedHandler.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

🛠️refactor

Suggested reviewers

  • VipinDevelops
  • Palanikannan1437
  • sriramveeraghanta

Poem

I nudge my nose at props that bloat,
Hop hop—old embeds, off you float!
A sleeker path, with extended grace,
New carrots packed in every place.
Through fields of types I swiftly stride,
Cleaned-up trails, a joyful ride. 🥕🐇

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/editor-embed-handler

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.
    • 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.
  • 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 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/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@aaryan610 aaryan610 changed the title fix: editor embed handler prop fix: remove unnecessary props from the editor package Sep 4, 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: 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 .includes

disabledExtensions 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 extendedEditorProps

You’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 extendedEditorProps

extendedEditorProps 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 config

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

📥 Commits

Reviewing files that changed from the base of the PR and between b68d2ca and b88e794.

📒 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 props

The 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 extendedEditorProps

Alignment 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 consistent

Import/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 LGTM

The 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 clean

Imports, 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 good

Removed 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 added

Omitting file/mention handlers, user, and extendedEditorProps from the base props prevents external override and keeps the wrapper authoritative. This matches how you spread ...rest later.


43-44: Destructure order avoids accidental override via ...rest

Pulling extendedEditorProps out before ...rest (and omitting it in the base type) prevents consumers from slipping it through in rest.


84-85: Prop is correctly wired through to DocumentEditorWithRef

The pass-through of extendedEditorProps is consistent with the new API.

Copy link
Contributor

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 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 embedHandler prop from all editor types and components
  • Replaces embedHandler with extendedEditorProps throughout 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.

@aaryan610 aaryan610 changed the title fix: remove unnecessary props from the editor package [WIKI-644] fix: remove unnecessary props from the editor package Sep 4, 2025
@makeplane
Copy link

makeplane bot commented Sep 4, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@sriramveeraghanta sriramveeraghanta merged commit a1500c2 into preview Sep 5, 2025
7 of 8 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix/editor-embed-handler branch September 5, 2025 08:20
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.

5 participants