Closed miikebar closed 6 months ago
@miikebar is attempting to deploy a commit to the Elegance Team on Vercel.
A member of the Team first needs to authorize it.
lgtm. Still not sure about the jotai atoms still being synced, I know we can just add a context instead but for now it's fine. I've also seen that we have different formatting rules. (I'll add a prettier config so we are consistent)
This PR adds per-editor instances of tunnel to render slash command popover
Previously a global tunnel instance was used to render command popover. When using multiple instances of the Editor on the same page, this caused the "/" command to render all the popovers at once.
The proposed solution creates a new tunnel instance for each Editor instance, and passes it down to command components via context. The jotai store is also shared across instances, but it seems that it doesn't matter for now, as it stores the query and range which get reset every time a slash command menu is opened.
Before
https://github.com/steven-tey/novel/assets/9134970/68f886c2-aa06-4611-a753-1cefb77c0b18
After
https://github.com/steven-tey/novel/assets/9134970/68013cdc-25e3-464e-aa6a-25c86427b702
Closes #304