Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeparticle committed Oct 28, 2023
1 parent 4a9c795 commit dc9bd86
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ui/src/hooks/useCombinedKeyPress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function useCombinedKeyPress(
};
}, [handleKeyDown, handleKeyUp]);

function compareArrays(pressedArray: string[], mainArray: string[]) {
const compareArrays = (pressedArray: string[], mainArray: string[]) => {
if (pressedArray?.length !== mainArray?.length) return false;

for (const iterator of mainArray) {
Expand All @@ -59,7 +59,7 @@ function useCombinedKeyPress(
}

return true;
}
};
}

export default useCombinedKeyPress;
16 changes: 10 additions & 6 deletions ui/src/pages/Markdown/TableOfContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ const TableOfContent: React.FC = () => {
.join("\n");
};

const fetchData = (url: string) => {
setUrl(url);
const fetchData = (value: string) => {
setUrl(value);
if (!value) return;

fetch(url)
fetch(value)
.then((res) => res.text())
.then(
(result) => {
Expand All @@ -104,9 +105,12 @@ const TableOfContent: React.FC = () => {
label="Input URL"
placeholder="URL"
value={url}
onChange={(event) =>
fetchData(event.currentTarget.value)
}
onChange={(event) => {
console.log("ddd");
setMarkdown("");
setTableOfContents("");
fetchData(event.target.value);
}}
type="text"
/>

Expand Down

0 comments on commit dc9bd86

Please sign in to comment.