Skip to content
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

Remove tippy.js and replace with Floating UI #5398

Merged
merged 14 commits into from
Jul 31, 2024
Merged

Conversation

bdbch
Copy link
Member

@bdbch bdbch commented Jul 26, 2024

Changes Overview

This PR completely removes tippy.js from all Tiptap packages and replaces the implementation with Floating UI.

Tippy was already outdated and often caused rendering issues for example with React or conditional rendering. The new implement Floating UI implementation now can be conditionally rendered, customized and adjusted.

Implementation Approach

Instead of letting Tippy handle the element creation and mounting, we now do this on our own and use Floating UI to compute the position of the floating element using virtual elements.

The positions are calculated from the cursor or selection position.

Instead of tippyOptions we now pass down an option object which can be used to control the Floating UI middlewares like shift, flip or offset.

Testing Done

I updated all tests that were previously using tippy and made sure all run successfully.

Verification Steps

  1. Try out this change manually on our demos locally
  2. Check the test runs

Additional Notes

Breaking change incoming. 😬

Checklist

Related Issues

@bdbch bdbch requested a review from svenadlung as a code owner July 26, 2024 21:43
Copy link

changeset-bot bot commented Jul 26, 2024

🦋 Changeset detected

Latest commit: bd8956f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 54 packages
Name Type
@tiptap/extension-floating-menu Major
@tiptap/extension-bubble-menu Major
@tiptap/extension-mention Major
@tiptap/suggestion Major
@tiptap/react Major
@tiptap/vue-2 Major
@tiptap/vue-3 Major
@tiptap/core Major
@tiptap/extension-blockquote Major
@tiptap/extension-bold Major
@tiptap/extension-bullet-list Major
@tiptap/extension-character-count Major
@tiptap/extension-code-block-lowlight Major
@tiptap/extension-code-block Major
@tiptap/extension-code Major
@tiptap/extension-collaboration-cursor Major
@tiptap/extension-collaboration Major
@tiptap/extension-color Major
@tiptap/extension-document Major
@tiptap/extension-dropcursor Major
@tiptap/extension-focus Major
@tiptap/extension-font-family Major
@tiptap/extension-gapcursor Major
@tiptap/extension-hard-break Major
@tiptap/extension-heading Major
@tiptap/extension-highlight Major
@tiptap/extension-history Major
@tiptap/extension-horizontal-rule Major
@tiptap/extension-image Major
@tiptap/extension-italic Major
@tiptap/extension-link Major
@tiptap/extension-list-item Major
@tiptap/extension-list-keymap Major
@tiptap/extension-ordered-list Major
@tiptap/extension-paragraph Major
@tiptap/extension-placeholder Major
@tiptap/extension-strike Major
@tiptap/extension-subscript Major
@tiptap/extension-superscript Major
@tiptap/extension-table-cell Major
@tiptap/extension-table-header Major
@tiptap/extension-table-row Major
@tiptap/extension-table Major
@tiptap/extension-task-item Major
@tiptap/extension-task-list Major
@tiptap/extension-text-align Major
@tiptap/extension-text-style Major
@tiptap/extension-text Major
@tiptap/extension-typography Major
@tiptap/extension-underline Major
@tiptap/extension-youtube Major
@tiptap/html Major
@tiptap/pm Major
@tiptap/starter-kit Major

Not sure what this means? Click here to learn what changesets are.

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

Copy link

netlify bot commented Jul 26, 2024

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit bd8956f
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/66a9949266ca2c000827d082
😎 Deploy Preview https://deploy-preview-5398--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bdbch bdbch changed the title Remove tippy.js and replace by Floating UI Remove tippy.js and replace with Floating UI Jul 26, 2024
Copy link
Contributor

@nperez0111 nperez0111 left a comment

Choose a reason for hiding this comment

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

This looks great!

@bdbch bdbch force-pushed the feature/floating-ui branch from 138de0c to bd8956f Compare July 31, 2024 01:34
@bdbch bdbch merged commit c44db1a into develop Jul 31, 2024
14 checks passed
@bdbch bdbch deleted the feature/floating-ui branch July 31, 2024 01:44
bdbch added a commit that referenced this pull request Jul 31, 2024
* start experimenting with floating-ui

* add options to floating-ui bubble menu plugin & fix smaller issues

* add vue support for new floating-ui

* start experimenting with floating-ui

* adjust floating-menu plugin for floating-ui & update react component

* add vue support for floating-menu with floating-ui

* update tests for new floating-ui integration

* added changeset file

* move floating-ui dependency to peerDeps

* add install notice to changelog

* remove unnecessary code for destroying and removing component element in Vue suggestion.js

* remove unnecessary code for destroying and removing component element in React suggestion.js

* sync package-lock

* widen range for peerDeps again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants