Skip to content

Conversation

@nperez0111
Copy link
Contributor

Changes Overview

This allows for editor.registerPlugin to take either a single plugin (original behavior) or an array of plugins as it's argument.

Implementation Approach

Testing Done

Verification Steps

Additional Notes

Checklist

  • I have created a changeset for this PR if necessary.
  • My changes do not break the library.
  • I have added tests where applicable.
  • I have followed the project guidelines.
  • I have fixed any lint issues.

Related Issues

Copilot AI review requested due to automatic review settings October 10, 2025 14:36
@changeset-bot
Copy link

changeset-bot bot commented Oct 10, 2025

⚠️ No Changeset found

Latest commit: a9ff9b5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented Oct 10, 2025

Deploy Preview for tiptap-embed failed. Why did it fail? →

Name Link
🔨 Latest commit a9ff9b5
🔍 Latest deploy log https://app.netlify.com/projects/tiptap-embed/deploys/68e91a09d15e4e00080fd1b4

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 enhances the registerPlugin method to accept either a single plugin or an array of plugins, improving the API's flexibility for batch plugin registration.

  • Modified the registerPlugin method signature to accept generic type T extends Plugin | Plugin[]
  • Updated the method parameters and implementation to handle both single plugins and plugin arrays
  • Added array spreading logic to flatten plugin arrays when merging with existing plugins

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +358 to +360
public registerPlugin<T extends Plugin | Plugin[]>(
plugin: T,
handlePlugins?: (newPlugin: T, plugins: Plugin[]) => Plugin[],
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The handlePlugins callback parameter type may be confusing when T is Plugin[]. Consider using a more explicit type like (newPlugin: Plugin | Plugin[], plugins: Plugin[]) => Plugin[] to clarify that the callback receives the same input type as the method parameter.

Suggested change
public registerPlugin<T extends Plugin | Plugin[]>(
plugin: T,
handlePlugins?: (newPlugin: T, plugins: Plugin[]) => Plugin[],
public registerPlugin(
plugin: Plugin | Plugin[],
handlePlugins?: (newPlugin: Plugin | Plugin[], plugins: Plugin[]) => Plugin[],

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant