1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

fixed text appearance

This commit is contained in:
Fedor Katurov 2019-10-17 17:59:29 +07:00
parent 6476e60c81
commit 1249389691
2 changed files with 9 additions and 1 deletions

View file

@ -55,6 +55,7 @@
overflow: hidden;
box-sizing: border-box;
word-break: break-word;
}
.title {

View file

@ -1,6 +1,7 @@
import { IFile } from '~/redux/types';
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
import { ru } from 'date-fns/locale';
import Axios from 'axios';
export const getStyle = (oElm: any, strCssRule: string) => {
if (document.defaultView && document.defaultView.getComputedStyle) {
@ -90,9 +91,15 @@ export const formatCommentText = (author: string, text: string): string =>
text
? formatText(text).replace(
/^<p>/,
author ? `<p><b class="comment-author">${author}: </b></p>` : '<p>'
author ? `<p><b class="comment-author">${author}: </b>` : '<p>'
)
: '';
export const getPrettyDate = (date: string): string =>
formatDistanceToNow(new Date(date), { locale: ru, includeSeconds: true, addSuffix: true });
export const getYoutubeTitle = async (id: string) => {
Axios.get(`http://youtube.com/get_video_info?video_id=${id}`).then(console.log);
};
(<any>window).getYoutubeTitle = getYoutubeTitle;