-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
114 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,31 @@ | ||
import { useMemo } from "react"; | ||
|
||
import CopyButton from "@/components/copy-button"; | ||
import { cn } from "@/lib/utils"; | ||
|
||
const RawContent: React.FC<{ | ||
content?: string; | ||
iframe?: boolean; | ||
dangerouslyShowContent?: boolean; | ||
className?: string; | ||
}> = ({ content, iframe, dangerouslyShowContent, className }) => { | ||
const cleanedContent = useMemo(() => { | ||
return dangerouslyShowContent | ||
? content | ||
: content | ||
?.replaceAll(/http/gi, "hxxp") | ||
.replaceAll(/src="\/\//gi, 'src="hxxp://'); | ||
}, [content, dangerouslyShowContent]); | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
"dark:border-800 dark:bg-950 relative flex h-full w-full flex-1 overflow-hidden rounded border bg-muted shadow-md ring-white", | ||
className, | ||
)} | ||
> | ||
<div className="flex h-full max-h-[400px] min-h-[1.5rem] flex-1 text-xs dark:bg-black/50"> | ||
{iframe && ( | ||
<iframe | ||
sandbox="" | ||
srcDoc={cleanedContent} | ||
className="h-[400px] w-full flex-1 dark:bg-white" | ||
/> | ||
)} | ||
{!iframe && ( | ||
<div | ||
style={{ | ||
fontFamily: | ||
'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace', | ||
}} | ||
className="flex h-full max-h-[400px] w-full flex-1 overflow-y-scroll whitespace-pre-wrap break-all p-3" | ||
> | ||
{cleanedContent} | ||
</div> | ||
)} | ||
<div className="absolute bottom-2 right-2"> | ||
<CopyButton text={content} /> | ||
</div> | ||
}> = ({ content, className }) => ( | ||
<div | ||
className={cn( | ||
"dark:border-800 dark:bg-950 relative flex h-full w-full flex-1 overflow-hidden rounded border bg-muted shadow-md ring-white", | ||
className, | ||
)} | ||
> | ||
<div className="flex h-full max-h-[400px] min-h-[1.5rem] flex-1 text-xs dark:bg-black/50"> | ||
<div | ||
style={{ | ||
fontFamily: | ||
'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace', | ||
}} | ||
className="flex h-full max-h-[400px] w-full flex-1 overflow-y-scroll whitespace-pre-wrap break-all p-3" | ||
> | ||
{content} | ||
</div> | ||
<div className="absolute bottom-2 right-2"> | ||
<CopyButton text={content} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
</div> | ||
); | ||
|
||
export default RawContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.