Allow searching on inline attribute keys
Summary: useful for bloks debugging Reviewed By: lblasa Differential Revision: D51349211 fbshipit-source-id: a11eca19bdecf989ceb6a95e9a3cb504020c7467
This commit is contained in:
committed by
Facebook GitHub Bot
parent
288e8e2d48
commit
bf67b19c4a
@@ -497,7 +497,9 @@ function InlineAttributes({attributes}: {attributes: Record<string, string>}) {
|
|||||||
<>
|
<>
|
||||||
{Object.entries(attributes ?? {}).map(([key, value]) => (
|
{Object.entries(attributes ?? {}).map(([key, value]) => (
|
||||||
<TreeAttributeContainer key={key}>
|
<TreeAttributeContainer key={key}>
|
||||||
<span style={{color: theme.warningColor}}>{key}</span>
|
<span style={{color: theme.warningColor}}>
|
||||||
|
{highlightManager.render(key)}
|
||||||
|
</span>
|
||||||
<span>={highlightManager.render(value)}</span>
|
<span>={highlightManager.render(value)}</span>
|
||||||
</TreeAttributeContainer>
|
</TreeAttributeContainer>
|
||||||
))}
|
))}
|
||||||
@@ -661,6 +663,9 @@ function searchPredicate(
|
|||||||
): (node: ClientNode) => string | true | undefined {
|
): (node: ClientNode) => string | true | undefined {
|
||||||
return (node: ClientNode): string | true | undefined =>
|
return (node: ClientNode): string | true | undefined =>
|
||||||
node.name.toLowerCase().includes(searchTerm) ||
|
node.name.toLowerCase().includes(searchTerm) ||
|
||||||
|
Object.keys(node.inlineAttributes).find((inlineAttr) =>
|
||||||
|
inlineAttr.toLocaleLowerCase().includes(searchTerm),
|
||||||
|
) ||
|
||||||
Object.values(node.inlineAttributes).find((inlineAttr) =>
|
Object.values(node.inlineAttributes).find((inlineAttr) =>
|
||||||
inlineAttr.toLocaleLowerCase().includes(searchTerm),
|
inlineAttr.toLocaleLowerCase().includes(searchTerm),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user