Spaces:
Sleeping
Sleeping
Download hooks/useEditor.ts from marktech7/deepsite-v2: direct link, hf CLI and curl.
- Browser
- Download file 833 Bytes
-
https://huggingface.co/spaces/marktech7/deepsite-v2/resolve/main/hooks/useEditor.ts
- Command line
-
hf download hf://spaces/marktech7/deepsite-v2/hooks/useEditor.ts
-
curl -L -o useEditor.ts https://huggingface.co/spaces/marktech7/deepsite-v2/resolve/main/hooks/useEditor.ts
833 Bytes
| import { HtmlHistory } from "@/types"; | |
| import { useState } from "react"; | |
| export const useEditor = (defaultHtml: string) => { | |
| /** | |
| * State to manage the HTML content of the editor. | |
| * This will be the main content that users edit. | |
| */ | |
| const [html, setHtml] = useState(defaultHtml); | |
| /** | |
| * State to manage the history of HTML edits. | |
| * This will store previous versions of the HTML content along with metadata. (not saved to DB) | |
| */ | |
| const [htmlHistory, setHtmlHistory] = useState<HtmlHistory[]>([]); | |
| /** | |
| * State to manage the prompts used for generating HTML content. | |
| * This can be used to track what prompts were used in the editor. | |
| */ | |
| const [prompts, setPrompts] = useState<string[]>([]); | |
| return { | |
| html, | |
| setHtml, | |
| htmlHistory, | |
| setHtmlHistory, | |
| prompts, | |
| setPrompts, | |
| }; | |
| }; | |