Skip to content

Commit 30243f5

Browse files
committed
fix #3206 -- chat preview md → html processing partially broken
- the input markdown was treated as if if were html and sanitized, which doesn't work well
1 parent c2df278 commit 30243f5

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/packages/frontend/chat/chatroom.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import { Button, Divider, Input, Select, Tooltip } from "antd";
77
import { debounce } from "lodash";
88
import { useDebounce } from "use-debounce";
9-
109
import {
1110
ButtonGroup,
1211
Col,
@@ -35,7 +34,6 @@ import SelectComputeServerForFile from "@cocalc/frontend/compute/select-server-f
3534
import StaticMarkdown from "@cocalc/frontend/editors/slate/static-markdown";
3635
import { FrameContext } from "@cocalc/frontend/frame-editors/frame-tree/frame-context";
3736
import { SaveButton } from "@cocalc/frontend/frame-editors/frame-tree/save-button";
38-
import { sanitize_html_safe } from "@cocalc/frontend/misc";
3937
import { hoursToTimeIntervalHuman } from "@cocalc/util/misc";
4038
import { FormattedMessage } from "react-intl";
4139
import { ChatActions } from "./actions";
@@ -138,7 +136,6 @@ export const ChatRoom: React.FC<Props> = ({ project_id, path, is_visible }) => {
138136
function render_preview_message(): JSX.Element | undefined {
139137
if (!is_preview) return;
140138
if (input.length === 0 || preview.length === 0) return;
141-
const value = sanitize_html_safe(preview);
142139

143140
return (
144141
<Row style={{ position: "absolute", bottom: "0px", width: "100%" }}>
@@ -158,7 +155,7 @@ export const ChatRoom: React.FC<Props> = ({ project_id, path, is_visible }) => {
158155
>
159156
<Icon name="times" />
160157
</div>
161-
<StaticMarkdown value={value} />
158+
<StaticMarkdown value={preview} />
162159
<div className="small lighten" style={{ marginTop: "15px" }}>
163160
Preview (press Shift+Enter to send)
164161
</div>

0 commit comments

Comments
 (0)