-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:sagemathinc/cocalc
- Loading branch information
Showing
38 changed files
with
718 additions
and
515 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,45 @@ | ||
import { CSS } from "@cocalc/frontend/app-framework"; | ||
import { useBottomScroller } from "@cocalc/frontend/app-framework/use-bottom-scroller"; | ||
import { Paragraph } from "@cocalc/frontend/components"; | ||
import { COLORS } from "@cocalc/util/theme"; | ||
import StaticMarkdown from "@cocalc/frontend/editors/slate/static-markdown"; | ||
import { Paragraph } from "@cocalc/frontend/components"; | ||
|
||
const STYLE = { | ||
border: "1px solid lightgrey", | ||
borderRadius: "5px", | ||
margin: "5px 0", | ||
padding: "10px", | ||
overflowY: "auto", | ||
maxHeight: "150px", | ||
fontSize: "85%", | ||
fontFamily: "monospace", | ||
whiteSpace: "pre-wrap", | ||
color: COLORS.GRAY_M, | ||
} as const; | ||
|
||
interface Props { | ||
input: JSX.Element | string; | ||
style?: CSS; | ||
scrollBottom?: boolean; | ||
} | ||
|
||
export function RawPrompt({ input, style, scrollBottom = false }: Props) { | ||
export function RawPrompt({ | ||
input, | ||
style: style0, | ||
scrollBottom = false, | ||
}: Props) { | ||
const ref = useBottomScroller(scrollBottom, input); | ||
|
||
return ( | ||
<Paragraph | ||
ref={ref} | ||
style={{ | ||
border: "1px solid lightgrey", | ||
borderRadius: "5px", | ||
margin: "5px 0", | ||
padding: "10px", | ||
overflowY: "auto", | ||
maxHeight: "150px", | ||
fontSize: "85%", | ||
fontFamily: "monospace", | ||
whiteSpace: "pre-wrap", | ||
color: COLORS.GRAY_M, | ||
...style, | ||
}} | ||
> | ||
{input} | ||
</Paragraph> | ||
); | ||
const style = { ...STYLE, ...style0 }; | ||
if (typeof input == "string") { | ||
// this looks so much nicer; I realize it doesn't implement scrollBottom. | ||
// But just dropping the input as plain text like below just seems | ||
// utterly broken! | ||
return <StaticMarkdown style={style} value={input} />; | ||
} else { | ||
return ( | ||
<Paragraph ref={ref} style={style}> | ||
{input} | ||
</Paragraph> | ||
); | ||
} | ||
} |
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
Oops, something went wrong.