Better tribute.

This commit is contained in:
Dessalines 2019-08-30 12:34:38 -07:00
parent 6c84c3b971
commit ce9c0b4aa7
3 changed files with 5 additions and 8 deletions

File diff suppressed because one or more lines are too long

View file

@ -6,7 +6,7 @@ import { WebSocketService, UserService } from '../services';
import * as autosize from 'autosize'; import * as autosize from 'autosize';
import { i18n } from '../i18next'; import { i18n } from '../i18next';
import { T } from 'inferno-i18next'; import { T } from 'inferno-i18next';
declare var Tribute: any; import Tribute from 'tributejs/src/Tribute.js';
interface CommentFormProps { interface CommentFormProps {
postId?: number; postId?: number;
@ -50,7 +50,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
return `[/u/${item.original.key}](/u/${item.original.key})`; return `[/u/${item.original.key}](/u/${item.original.key})`;
}, },
values: (text: string, cb: any) => { values: (text: string, cb: any) => {
this.userSearch(text, users => cb(users)); this.userSearch(text, (users: any) => cb(users));
}, },
autocompleteMode: true, autocompleteMode: true,
}, },
@ -62,7 +62,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
return `[/c/${item.original.key}](/c/${item.original.key})`; return `[/c/${item.original.key}](/c/${item.original.key})`;
}, },
values: (text: string, cb: any) => { values: (text: string, cb: any) => {
this.communitySearch(text, communities => cb(communities)); this.communitySearch(text, (communities: any) => cb(communities));
}, },
autocompleteMode: true, autocompleteMode: true,
} }
@ -149,7 +149,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
type_: SearchType[SearchType.Users], type_: SearchType[SearchType.Users],
sort: SortType[SortType.TopAll], sort: SortType[SortType.TopAll],
page: 1, page: 1,
limit: fetchLimit, limit: 6,
}; };
WebSocketService.Instance.search(form); WebSocketService.Instance.search(form);
@ -180,7 +180,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
type_: SearchType[SearchType.Communities], type_: SearchType[SearchType.Communities],
sort: SortType[SortType.TopAll], sort: SortType[SortType.TopAll],
page: 1, page: 1,
limit: fetchLimit, limit: 6,
}; };
WebSocketService.Instance.search(form); WebSocketService.Instance.search(form);

1
ui/src/index.html vendored
View file

@ -9,7 +9,6 @@
<link rel="shortcut icon" type="image/svg+xml" href="/static/assets/favicon.svg" /> <link rel="shortcut icon" type="image/svg+xml" href="/static/assets/favicon.svg" />
<link rel="apple-touch-icon" href="/static/assets/apple-touch-icon.png" /> <link rel="apple-touch-icon" href="/static/assets/apple-touch-icon.png" />
<script async src="/static/assets/libs/sortable/sortable.min.js"></script> <script async src="/static/assets/libs/sortable/sortable.min.js"></script>
<script async src="/static/assets/libs/tribute.min.js"></script>
<script src="/static/assets/libs/markdown-it-emoji/markdown-it-emoji.min.js" type="text/javascript"></script> <script src="/static/assets/libs/markdown-it-emoji/markdown-it-emoji.min.js" type="text/javascript"></script>
</head> </head>