mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
31 lines
671 B
TypeScript
31 lines
671 B
TypeScript
export const COMMENT_BLOCK_TYPES = {
|
|
TEXT: 'TEXT',
|
|
MARK: 'MARK',
|
|
EMBED: 'EMBED',
|
|
};
|
|
|
|
export const COMMENT_BLOCK_DETECTORS = [
|
|
{
|
|
type: COMMENT_BLOCK_TYPES.EMBED,
|
|
test: /(https?:\/\/(www\.)?(youtube\.com|youtu\.be)\/(watch)?(\?v=)?[\w\-&=]+)/gim,
|
|
},
|
|
{
|
|
type: COMMENT_BLOCK_TYPES.MARK,
|
|
test: /^[\n\s]{0,}?<\.{3}>[\n\s]{0,}$/gi,
|
|
},
|
|
{
|
|
type: COMMENT_BLOCK_TYPES.TEXT,
|
|
test: /^.*$/gi,
|
|
},
|
|
];
|
|
|
|
export type ICommentBlock = {
|
|
type: (typeof COMMENT_BLOCK_TYPES)[keyof typeof COMMENT_BLOCK_TYPES];
|
|
content: string;
|
|
};
|
|
|
|
export type ICommentBlockProps = {
|
|
block: ICommentBlock;
|
|
};
|
|
|
|
export const NEW_COMMENT_CLASSNAME = 'newComment';
|