mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 04:52:06 +03:00
links: mention support
This commit is contained in:
parent
94f787d120
commit
7dce8a6d6b
@ -4,9 +4,10 @@ import { cite } from '~/logic/lib/util';
|
||||
import moment from 'moment';
|
||||
import { Box, Text, Row } from '@tlon/indigo-react';
|
||||
import RichText from '~/views/components/RichText';
|
||||
import { MentionText } from "~/views/components/MentionText";
|
||||
|
||||
export const CommentItem = (props) => {
|
||||
const content = props.post.contents[0].text;
|
||||
const content = props.post.contents;
|
||||
const timeSent =
|
||||
moment.unix(props.post['time-sent'] / 1000).format('hh:mm a');
|
||||
|
||||
@ -33,10 +34,12 @@ export const CommentItem = (props) => {
|
||||
</Row>
|
||||
</Row>
|
||||
<Row>
|
||||
<Text display="block" py={3} fontSize={1}>
|
||||
<RichText remoteContentPolicy={props.remoteContentPolicy}>
|
||||
{content}
|
||||
</RichText>
|
||||
<Text py={3} fontSize={1}>
|
||||
<MentionText
|
||||
remoteContentPolicy={props.remoteContentPolicy}
|
||||
contacts={props.contacts}
|
||||
content={content}
|
||||
/>
|
||||
</Text>
|
||||
</Row>
|
||||
</Box>
|
||||
|
@ -2,6 +2,7 @@ import React, { Component } from 'react';
|
||||
import { Spinner } from '~/views/components/Spinner';
|
||||
import { createPost } from '~/logic/api/graph';
|
||||
import { deSig } from "~/logic/lib/util";
|
||||
import { scanForMentions } from "~/logic/lib/graph";
|
||||
|
||||
|
||||
export class CommentSubmit extends Component {
|
||||
@ -17,9 +18,8 @@ export class CommentSubmit extends Component {
|
||||
|
||||
onClickPost() {
|
||||
const parentIndex = this.props.parentIndex || '';
|
||||
let post = createPost([
|
||||
{ text: this.state.comment },
|
||||
], parentIndex);
|
||||
const content = scanForMentions(this.state.comment);
|
||||
let post = createPost(content, parentIndex);
|
||||
|
||||
this.setState({ disabled: true }, () => {
|
||||
this.props.api.graph.addPost(
|
||||
|
@ -23,6 +23,7 @@ export const Comments = (props) => {
|
||||
return (
|
||||
<CommentItem
|
||||
key={comment.post.index}
|
||||
contacts={contacts}
|
||||
post={comment.post}
|
||||
nickname={nickname}
|
||||
hasNickname={Boolean(nickname)}
|
||||
|
Loading…
Reference in New Issue
Block a user