Select/Menu with TipTap WYSIWYG Editor - Updating Trigger value based on state #5920
Unanswered
deltasierra96
asked this question in
Q&A
Replies: 1 comment 1 reply
-
The API for that editor state is a bit difficult to reconcile with selection in collections. One thing I noticed is that multiple nodes could come back as active, but Select only supports single selection. If you're using a component that supports multiple selection like just ListBox, you could do something like let items = [...];
let selectedKeys = items.filter((item) => editor.isActive(item.name, item.attributes)).map((item) => item.key);
...
<ListBox
items={items}
selectedKeys={selectedKeys}
... The easiest thing would be to use ToggleButton's for this type of UI. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. I'm trying to implement a Shopify style WYSIWYG style editor using TipTap in combination with RAC.
In the following example, if a user clicks on a certain type of formatted text, be it bold, italic, underline, etc. the state of the button is styled via a boolean by using
editor.isActive('whatever')
Is it possible to update the value in the menu/select trigger to reflect what the user is currently focused on in the editor using the returned boolean?
This is my current implementation
Beta Was this translation helpful? Give feedback.
All reactions