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
## Problem
`useInspectorInfo`, a widely used helper in the inspector, cannot read
element styles set by Tailwind
## Fix
The fix is made up from multiple pieces:
- I extended `StylePlugin` with a new function,
`readStyleFromElementProps`, which reads a given style info key from the
`JSXAttributes` passed to it. I updated both `InlineStylePlugin` and
`TailwindStylePlugin` to support this function, and updated all affected
tests. This change was originally prototyped on the
[Megaspike](#6574)
- I updated `useGetMultiselectedProps` to use
`StylePlugin.readStyleFromElementProps` when a style prop is read.
- I updated `CSSStylePropertyNotParsable` and `ParsedCSSStyleProperty`
to preserve the original value read from `projectContents`, in addition
to the parsed representation. This way, `CSSStyleProperties` can be used
by code that expect to work with this lower-level representation (such
as the internals of `useInspectorInfo`)
- I updated the `SET_PROP` and `UNSET_PROP` actions to use the
`setProperty` and `deleteProperty` commands under the hood. This way,
any editor code using these actions will be able to use the style
plugins to write element style. This change was originally prototyped on
the [Megaspike](#6574)
### Out of scope
This change only touches `useGetMultiselectedProps` from the internals
of `useInspectorInfo`. `useGetSpiedProps` is left unchanged, since the
values element style props set through Tailwind don't show up in
`allElementProps` (which is the data source for spied props)
## Manual Tests:
I hereby swear that:
- [x] I opened a hydrogen project and it loaded
- [x] I could navigate to various routes in Play mode
0 commit comments