Skip to content

[WIKI-484] chore: update editor packages #7265

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

Open
wants to merge 1 commit into
base: preview
Choose a base branch
from

Conversation

aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Jun 24, 2025

Description

This PR updates all the Tiptap package versions to latest and remove all unused error directives.

Other improvements-

  1. Slash commands now work in a table cell.

Type of Change

  • Improvement (change that would cause existing functionality to not work as expected)

Summary by CodeRabbit

  • New Features
    • Slash command suggestions are now available inside tables.
  • Bug Fixes
    • Improved type safety for custom node views in the editor, reducing potential runtime errors.
    • Enhanced drag handle plugin to better handle null elements and scrolling.
  • Chores
    • Updated dependencies for improved stability and compatibility.
    • Removed unnecessary comments and unused dependencies for cleaner code.
  • Refactor
    • Clarified and exported component prop types for better maintainability.

Copy link

makeplane bot commented Jun 24, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

coderabbitai bot commented Jun 24, 2025

Walkthrough

This update refactors type annotations and prop handling for several custom node views in the editor, removes unnecessary TypeScript error suppression comments, updates TipTap and related package versions, and adjusts package resolutions. It also modifies the slash command activation logic and improves type safety and code clarity in various extensions and plugins.

Changes

Files/Groups Change Summary
live/package.json, packages/editor/package.json Updated @tiptap dependencies to ^2.22.3, removed unused dependencies, and added a prosemirror-view resolution.
packages/editor/src/core/extensions/callout/block.tsx, .../mentions/mention-node-view.tsx Renamed and exported prop types, updated component signatures for explicit typing.
packages/editor/src/core/extensions/callout/extension.tsx, .../custom-image/extension.tsx, ... Modified addNodeView to use inline functions with explicit prop typing for node views.
packages/editor/src/core/extensions/extensions.ts, .../read-only-extensions.ts, .../editor-commands.ts, .../yjs-utils.ts Removed // @ts-expect-error comments; no logic changes.
packages/editor/src/core/extensions/slash-commands/root.tsx Removed restriction preventing slash commands in tables.
packages/editor/src/core/plugins/drag-handle.ts Added null check and updated types for getScrollParent; rearranged handler declarations.

Sequence Diagram(s)

sequenceDiagram
    participant Editor
    participant NodeViewRenderer
    participant CustomNodeView

    Editor->>NodeViewRenderer: addNodeView(props)
    NodeViewRenderer->>CustomNodeView: Render with props (node explicitly typed)
    CustomNodeView-->>NodeViewRenderer: Rendered output
    NodeViewRenderer-->>Editor: Node view attached
Loading

Suggested labels

🛠️refactor, ready to merge

Suggested reviewers

  • Palanikannan1437

Poem

A hop, a skip, a tidy sweep,
Types are clear, no errors creep.
Node views prance with props in tow,
Slash commands now in tables grow!
Packages fresh, the code is bright—
This bunny’s work feels just right.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

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

Documentation and Community

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

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 (6)
packages/editor/src/core/extensions/mentions/extension.tsx (1)

23-25: Type safety improvement with potential performance consideration.

The inline function approach correctly addresses type safety by explicitly casting the node prop to MentionNodeViewProps["node"]. However, consider the performance impact of creating a new function component on every render.

For better performance, consider extracting this to a separate component:

+const MentionNodeViewWrapper = (props: any) => (
+  <MentionNodeView {...props} node={props.node as MentionNodeViewProps["node"]} />
+);

addNodeView() {
-  return ReactNodeViewRenderer((props) => (
-    <MentionNodeView {...props} node={props.node as MentionNodeViewProps["node"]} />
-  ));
+  return ReactNodeViewRenderer(MentionNodeViewWrapper);
},
packages/editor/src/core/extensions/image/extension.tsx (1)

50-52: Consistent implementation with performance consideration.

This follows the same pattern as other extensions, which is good for consistency. The explicit type casting for the node prop improves type safety. However, the same performance consideration about inline function creation applies here as well.

packages/editor/src/core/extensions/callout/extension.tsx (1)

66-68: Consistent type-safe implementation.

This follows the same pattern as other extensions, ensuring consistency across the codebase. The explicit node prop casting improves type safety. The same performance consideration about inline function creation applies here.

packages/editor/src/core/extensions/callout/read-only-extension.tsx (1)

12-14: Consistent implementation across extensions.

This follows the same type-safe pattern as other extensions, which is excellent for codebase consistency. The explicit node prop casting addresses type compatibility issues. The same performance consideration about inline function creation applies here as well.

packages/editor/src/core/extensions/mentions/mention-node-view.tsx (2)

7-11: Prefer interface … extends over property-override intersection for clarity

Declaring MentionNodeViewProps as an intersection that re-defines the already-present node key works, but using an interface … extends NodeViewProps is clearer and avoids the double declaration of node:

-export type MentionNodeViewProps = NodeViewProps & {
-  node: NodeViewProps["node"] & {
-    attrs: TMentionComponentAttributes;
-  };
-};
+export interface MentionNodeViewProps extends NodeViewProps {
+  node: NodeViewProps["node"] & {
+    attrs: TMentionComponentAttributes;
+  };
+}

This conveys “all NodeViewProps plus a refined node” more explicitly and avoids the mental overhead of understanding property intersection semantics.


13-18: Minor: React.FC adds implicit children; consider plain arrow function

React.FC introduces an implicit children prop that this node view will never use. A plain arrow function typed with MentionNodeViewProps avoids the extra prop and tightens types slightly:

-export const MentionNodeView: React.FC<MentionNodeViewProps> = (props) => {
+export const MentionNodeView = (props: MentionNodeViewProps) => {

Not critical, but helpful for stricter type surfaces across node views.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40c0922 and 81e2906.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (16)
  • live/package.json (1 hunks)
  • package.json (1 hunks)
  • packages/editor/package.json (1 hunks)
  • packages/editor/src/core/extensions/callout/block.tsx (1 hunks)
  • packages/editor/src/core/extensions/callout/extension.tsx (2 hunks)
  • packages/editor/src/core/extensions/callout/read-only-extension.tsx (2 hunks)
  • packages/editor/src/core/extensions/custom-image/extension.tsx (2 hunks)
  • packages/editor/src/core/extensions/extensions.ts (0 hunks)
  • packages/editor/src/core/extensions/image/extension.tsx (2 hunks)
  • packages/editor/src/core/extensions/mentions/extension.tsx (2 hunks)
  • packages/editor/src/core/extensions/mentions/mention-node-view.tsx (1 hunks)
  • packages/editor/src/core/extensions/read-only-extensions.ts (0 hunks)
  • packages/editor/src/core/extensions/slash-commands/root.tsx (0 hunks)
  • packages/editor/src/core/helpers/editor-commands.ts (0 hunks)
  • packages/editor/src/core/helpers/yjs-utils.ts (0 hunks)
  • packages/editor/src/core/plugins/drag-handle.ts (3 hunks)
💤 Files with no reviewable changes (5)
  • packages/editor/src/core/extensions/read-only-extensions.ts
  • packages/editor/src/core/helpers/yjs-utils.ts
  • packages/editor/src/core/extensions/slash-commands/root.tsx
  • packages/editor/src/core/extensions/extensions.ts
  • packages/editor/src/core/helpers/editor-commands.ts
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (14)
packages/editor/src/core/plugins/drag-handle.ts (3)

68-70: Improved null safety for scroll parent handling.

The addition of the null check and updated type signature enhances robustness by preventing potential runtime errors when a null node is passed to the function.


142-142: Enhanced type safety with explicit type annotation.

Adding the explicit type annotation improves code clarity and TypeScript's ability to catch potential type-related issues.


179-204: Better code organization by moving event handlers.

Moving the event handler declarations after the dragHandleElement declaration improves code readability and ensures proper variable access order.

package.json (1)

37-37: Verify prosemirror-view version compatibility and security.

The addition of the prosemirror-view resolution to version 1.40.0 should be verified for compatibility with the updated TipTap packages and checked for any known security vulnerabilities.

#!/bin/bash
# Description: Check prosemirror-view version 1.40.0 for security advisories and compatibility

# Check for security advisories
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NPM, package: "prosemirror-view") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

# Check latest version
curl -s https://registry.npmjs.org/prosemirror-view/latest | jq '.version'
live/package.json (1)

26-27: Good upgrade to latest TipTap packages with flexible versioning.

The update from fixed versions to caret ranges (^2.22.3) allows automatic minor and patch updates while maintaining compatibility. This ensures the live editor benefits from bug fixes and improvements in TipTap.

packages/editor/package.json (1)

42-59: ```bash
#!/bin/bash

Verify that v2.22.x versions are published on npm for core and react packages

echo "📦 @tiptap/core versions (v2.22.x):"
curl -s https://registry.npmjs.org/@tiptap/core
| jq -r '.versions | keys[]'
| grep '^2.22'
| sort -V

echo -e "\n📦 @tiptap/react versions (v2.22.x):"
curl -s https://registry.npmjs.org/@tiptap/react
| jq -r '.versions | keys[]'
| grep '^2.22'
| sort -V


</details>
<details>
<summary>packages/editor/src/core/extensions/custom-image/extension.tsx (2)</summary>

`11-11`: **Enhanced type safety with imported prop types.**

The addition of `CustomImageNodeViewProps` to the import improves type safety and supports the explicit type casting in the node view renderer.

---

`118-120`: **Improved type safety with explicit node prop casting.**

The change from direct `ReactNodeViewRenderer(CustomImageNodeView)` to an inline function with explicit type casting ensures proper type safety. This approach is particularly beneficial after the TipTap version upgrade where type inference may have changed.

</details>
<details>
<summary>packages/editor/src/core/extensions/mentions/extension.tsx (1)</summary>

`7-7`: **Good addition of explicit prop types.**

The import of `MentionNodeViewProps` improves type safety and makes the component interface more explicit.

</details>
<details>
<summary>packages/editor/src/core/extensions/image/extension.tsx (1)</summary>

`7-7`: **Consistent type safety improvement.**

The addition of `CustomImageNodeViewProps` import maintains consistency with the type safety pattern applied across all node view extensions.

</details>
<details>
<summary>packages/editor/src/core/extensions/callout/block.tsx (2)</summary>

`13-18`: **Excellent type definition improvement.**

Renaming from the generic `Props` to `CustomCalloutNodeViewProps` and exporting it provides better clarity and enables reuse in other files. This properly supports the type safety improvements in the extension files.

---

`20-20`: **Good explicit component typing.**

The explicit `React.FC<CustomCalloutNodeViewProps>` typing improves code clarity and ensures proper TypeScript checking.

</details>
<details>
<summary>packages/editor/src/core/extensions/callout/extension.tsx (1)</summary>

`3-3`: **Consistent type import pattern.**

The import of `CustomCalloutNodeViewProps` maintains the consistent pattern applied across all node view extensions.

</details>
<details>
<summary>packages/editor/src/core/extensions/callout/read-only-extension.tsx (1)</summary>

`3-3`: **Consistent type safety pattern.**

The import of `CustomCalloutNodeViewProps` maintains consistency with the type safety improvements applied across all node view extensions.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

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.

2 participants