@@ -148,60 +174,67 @@ export const SearchBar = memo(function SearchBar() {
onBlur={() => setFocused(false)}
placeholder={locked ? "Traffic is locked" : placeholderFor(total)}
disabled={locked}
- defaultValue={text}
+ defaultValue={draft}
forceUpdateKey={String(version)}
- onChange={setText}
+ onChange={setDraft}
extensions={extensions}
- onKeyDown={(e) => {
- if (e.key === "Escape" && handleRef.current?.value() !== "") {
- e.stopPropagation();
- clear();
- }
- }}
leftSlot={
-
+ // oxlint-disable-next-line jsx-a11y/no-static-element-interactions -- keeps focus in the editor
+
e.preventDefault()}
+ className="flex items-center self-center ml-0.5"
+ >
+
+
}
rightSlot={
- text === "" ? (
-
- ⌘F
-
- ) : (
- // oxlint-disable-next-line jsx-a11y/no-static-element-interactions -- keeps focus in the editor
-
e.preventDefault()}
- className="flex items-center self-center ml-1 mr-0.5"
- >
-
,
- onSelect: () => setSavedDialog({ mode: "save", query: text.trim() }),
- },
- exportShown(),
- ]}
- >
+ // oxlint-disable-next-line jsx-a11y/no-static-element-interactions -- keeps focus in the editor
+
e.preventDefault()}
+ className="flex items-center self-center ml-1 mr-0.5"
+ >
+ {unapplied ? (
+ ↵
+ ) : hasText ? null : (
+ ⌘F
+ )}
+ {hasText && (
+ <>
+ ,
+ onSelect: () =>
+ setSavedDialog({
+ mode: "save",
+ query: (draft.trim() === "" ? applied : draft).trim(),
+ }),
+ },
+ exportShown(),
+ ]}
+ >
+
+
-
-
-
- )
+ >
+ )}
+
}
/>
@@ -209,6 +242,183 @@ export const SearchBar = memo(function SearchBar() {
);
});
+function Key({ children, className }: { children: string; className?: string }) {
+ return (
+