diff --git a/src/hooks/useUtil.ts b/src/hooks/useUtil.ts index 86d15e71a..aec8d435b 100644 --- a/src/hooks/useUtil.ts +++ b/src/hooks/useUtil.ts @@ -34,10 +34,15 @@ export const useUtil = () => { } } -export function useFetchText() { +export function useFetchText(raw?: boolean) { const { proxyLink } = useLink() const fetchContent = async () => { - return fetchText(proxyLink(objStore.obj, true)) + let fileurl = proxyLink(objStore.obj, true) + if (raw) { + const separator = fileurl.includes("?") ? "&" : "?" + fileurl = `${fileurl}${separator}raw=true` + } + return fetchText(fileurl) } return createResource("", fetchContent) } diff --git a/src/pages/home/previews/text-editor.tsx b/src/pages/home/previews/text-editor.tsx index d200fdda7..ed2010994 100644 --- a/src/pages/home/previews/text-editor.tsx +++ b/src/pages/home/previews/text-editor.tsx @@ -70,7 +70,7 @@ function Editor(props: { data?: string | ArrayBuffer; contentType?: string }) { // TODO add encoding select const TextEditor = () => { - const [content] = useFetchText() + const [content] = useFetchText(true) return (