You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# [Example project with a flex
gap](https://utopia.fish/p/71b4ada2-boatneck-lamp/?branch_name=feature-style-plugins)
## Problem
The canvas controls can't edit elements that are styled with Tailwind
## Fix
Add a plugin system, where each plugin provides a data source that
strategies can read from (so as of this PR, either Tailwind or the
inline style), and a function that takes props from the inline style,
and moves them to the right place the style element. For example, the
plugin that implements Tailwind styling takes the inline style props,
converts them to the right tailwind classes, and adds them to the
`className` prop.
The flex gap strategy and the flex gap control is updated to use the
data provided by the plugin system to read the necessary data.
### Out of scope
There's one known limitation of this system as implemented in this PR:
props that are removed by a strategy don't get removed by the
normalization step in plugins. This is only a problem for the Tailwind
plugin (since the inline style plugin leaves the inline style prop as
the strategies left them, so the fix for this will come on a follow-up
PR after this one (the actual fix is already implemented here for anyone
interested
b2fc141)
### Details
- Types for the plugin system, and two concrete plugin implementations
are added in the `canvas/plugins` folder
- The data provided by the plugins is added to `InteractionCanvasState`
as the `styleInfoReader` function
- The normalization step provided by the plugins is hooked into the
strategy lifecycle in `interactionFinished`
- The flex gap strategy/controls are updated to use `styleInfoReader`
- `UpdateClassList` is fixed so that it can write the `className` prop
even if it doesn't exist on element at the start of the command
---------
Co-authored-by: Federico Ruggi <1081051+ruggi@users.noreply.github.com>
0 commit comments