Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions stopes/ui/seamlisten/react_app/src/components/FileExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ function useFileNavigate() {
}

const Files = (): JSX.Element => {
const [displayHelper, setDisplayHelper] = useState(false);
const [displayHelper, setDisplayHelper] = useState(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the linter remove this trailing spaces? Did you install and run pre-commit ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll get right on it

const navigate = useFileNavigate();
let { filename, pageNumber, numberLines, files, audioBlob, error } =
useLoaderData() as LoaderReturn;
const [newFilename, setNewFilename] = useState(
filename || config.default_path
);

// if we have a location, we are in a transition between two urls
const navigation = useNavigation();
const locationParams = parseLocation(navigation.location);
Expand Down Expand Up @@ -168,6 +168,17 @@ const Files = (): JSX.Element => {
[setFilename]
);

// Add new function to handle paste events
const fileInputHandlePaste = useCallback(
(evt) => {
const pastedData = evt.clipboardData.getData('text');
setNewFilename(pastedData);
navigate(pastedData, pageNumber, numberLines);
},
[navigate, pageNumber, numberLines]
);


return (
<div style={{ marginTop: "10px" }}>
<Form as={BRow}>
Expand All @@ -183,6 +194,7 @@ const Files = (): JSX.Element => {
onChange={setFilenameEventHandler}
value={newFilename}
onKeyDown={fileInputHandleChange}
onPaste={fileInputHandlePaste}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

size="sm"
/>
<Form.Text className="text-muted" />
Expand Down