mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
fixed comment text splitting
This commit is contained in:
parent
0666237586
commit
d786606924
2 changed files with 7 additions and 10 deletions
5
.env
5
.env
|
@ -1,5 +0,0 @@
|
||||||
#API_HOST = http://localhost:7777/
|
|
||||||
#REMOTE_CURRENT = http://localhost:7777/static/
|
|
||||||
REACT_APP_API_HOST = https://pig.staging.vault48.org/
|
|
||||||
REACT_APP_REMOTE_CURRENT = https://pig.staging.vault48.org/static/
|
|
||||||
EXPOSE = 4000
|
|
|
@ -94,8 +94,8 @@ export const getURL = (file: Partial<IFile>, size?: typeof PRESETS[keyof typeof
|
||||||
};
|
};
|
||||||
|
|
||||||
export const formatText = pipe(
|
export const formatText = pipe(
|
||||||
formatTextSanitizeYoutube,
|
|
||||||
formatTextSanitizeTags,
|
formatTextSanitizeTags,
|
||||||
|
formatTextSanitizeYoutube,
|
||||||
formatTextClickableUsernames,
|
formatTextClickableUsernames,
|
||||||
formatTextComments,
|
formatTextComments,
|
||||||
formatTextTodos,
|
formatTextTodos,
|
||||||
|
@ -112,10 +112,12 @@ export const findBlockType = (line: string): ValueOf<typeof COMMENT_BLOCK_TYPES>
|
||||||
};
|
};
|
||||||
|
|
||||||
export const splitCommentByBlocks = (text: string): ICommentBlock[] =>
|
export const splitCommentByBlocks = (text: string): ICommentBlock[] =>
|
||||||
text.split('\n').map(line => ({
|
text
|
||||||
type: findBlockType(line),
|
.split(/(https?:\/\/(?:www\.)(?:youtube\.com|youtu\.be)\/(?:watch)(?:\?v=)[\w\-\&\=]+)/)
|
||||||
content: line,
|
.map(line => ({
|
||||||
}));
|
type: findBlockType(line),
|
||||||
|
content: line,
|
||||||
|
}));
|
||||||
|
|
||||||
export const formatCommentText = (author: string, text: string): ICommentBlock[] =>
|
export const formatCommentText = (author: string, text: string): ICommentBlock[] =>
|
||||||
text ? splitCommentByBlocks(formatText(text)) : null;
|
text ? splitCommentByBlocks(formatText(text)) : null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue