mirror of
https://github.com/urbit/shrub.git
synced 2024-12-26 05:23:35 +03:00
publish: snippets allow image previews
This commit is contained in:
parent
059b52ea23
commit
49fbdc9236
@ -113,6 +113,6 @@ export function getComments(node: GraphNode): GraphNode {
|
|||||||
|
|
||||||
export function getSnippet(body: string) {
|
export function getSnippet(body: string) {
|
||||||
const start = body.slice(0, body.indexOf('\n', 2));
|
const start = body.slice(0, body.indexOf('\n', 2));
|
||||||
return start === body ? start : `${start}...`;
|
return (start === body || start.startsWith("![")) ? start : `${start}...`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import moment from "moment";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import ReactMarkdown from "react-markdown";
|
import ReactMarkdown from "react-markdown";
|
||||||
import { Col, Box, Text } from "@tlon/indigo-react";
|
import { Col, Box, Text, Image } from "@tlon/indigo-react";
|
||||||
|
|
||||||
import { cite } from "~/logic/lib/util";
|
import { cite } from "~/logic/lib/util";
|
||||||
import { Contact } from "~/types/contact-update";
|
import { Contact } from "~/types/contact-update";
|
||||||
@ -67,7 +67,10 @@ export function NotePreview(props: NotePreviewProps) {
|
|||||||
<Text fontSize='14px'>
|
<Text fontSize='14px'>
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
unwrapDisallowed
|
unwrapDisallowed
|
||||||
allowedTypes={["text", "root", "break", "paragraph"]}
|
allowedTypes={["text", "root", "break", "paragraph", "image"]}
|
||||||
|
renderers={{
|
||||||
|
image: (props) => <Image src={props.src} maxHeight='300px' style={{ objectFit: 'cover' }}/>
|
||||||
|
}}
|
||||||
source={snippet}
|
source={snippet}
|
||||||
/>
|
/>
|
||||||
</Text>
|
</Text>
|
||||||
|
Loading…
Reference in New Issue
Block a user