Make modal use markdown

This commit is contained in:
SleeplessOne1917 2024-04-13 20:59:02 -04:00
parent c4306787f8
commit 4fc425b286
2 changed files with 15 additions and 4 deletions

View file

@ -3,6 +3,7 @@ import { modalMixin } from "../mixins/modal-mixin";
import { adultConsentLocalStorageKey } from "../../config"; import { adultConsentLocalStorageKey } from "../../config";
import { setIsoData } from "@utils/app"; import { setIsoData } from "@utils/app";
import { IsoDataOptionalSite } from "../../interfaces"; import { IsoDataOptionalSite } from "../../interfaces";
import { mdToHtml } from "../../markdown";
interface AdultConsentModalProps { interface AdultConsentModalProps {
contentWarning: string; contentWarning: string;
@ -29,11 +30,20 @@ class AdultConsentModalInner extends Component<AdultConsentModalProps, any> {
data-bs-backdrop="static" data-bs-backdrop="static"
ref={this.modalDivRef} ref={this.modalDivRef}
> >
<div className="modal-dialog modal-fullscreen-sm-down"> <div
className="modal-dialog modal-fullscreen-sm-down"
data-bs-backdrop="static"
>
<div className="modal-content"> <div className="modal-content">
<div className="modal-body text-center align-middle text-body"> <header className="modal-header">
{contentWarning} <h3 className="modal-title">Content Warning</h3>
</div> </header>
<div
className="modal-body text-center align-middle text-body"
dangerouslySetInnerHTML={mdToHtml(contentWarning, () =>
this.forceUpdate(),
)}
/>
<footer className="modal-footer"> <footer className="modal-footer">
<button <button
type="button" type="button"

View file

@ -86,6 +86,7 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
allowed_instances: this.props.allowedInstances?.map(i => i.domain), allowed_instances: this.props.allowedInstances?.map(i => i.domain),
blocked_instances: this.props.blockedInstances?.map(i => i.domain), blocked_instances: this.props.blockedInstances?.map(i => i.domain),
blocked_urls: this.props.siteRes.blocked_urls.map(u => u.url), blocked_urls: this.props.siteRes.blocked_urls.map(u => u.url),
content_warning: this.props.siteRes.site_view.site.content_warning,
}; };
} }