Skip to content

feat: Allow dangerous html based on config variable #1459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface ComponentProps {
editable?: boolean;
maxLength?: number;
value?: string;
allowDangerousHtml?: boolean;
}

export type EditableTextProps = ComponentProps &
Expand Down Expand Up @@ -117,14 +118,16 @@ class EditableText extends React.Component<
};

render() {
const { isEditing, editable, maxLength } = this.props;
const { isEditing, editable, maxLength, allowDangerousHtml } = this.props;
const { value = '', isDisabled } = this.state;

if (!isEditing) {
return (
<div className="editable-text">
<div className="markdown-wrapper">
<ReactMarkdown allowDangerousHtml={false}>{value}</ReactMarkdown>
<ReactMarkdown allowDangerousHtml={!!allowDangerousHtml}>
{value}
</ReactMarkdown>
</div>
{editable && !value && (
<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,12 @@ export class TableDetail extends React.Component<

return descriptions.map((d) => (
<EditableSection key={`prog_desc:${d.source}`} title={d.source} readOnly>
<EditableText maxLength={999999} value={d.text} editable={false} />
<EditableText
maxLength={999999}
value={d.text}
editable={false}
allowDangerousHtml
/>
</EditableSection>
));
};
Expand Down