feat: embedded emoji
This commit is contained in:
parent
c40609c8ac
commit
319ae5a0ba
10 changed files with 93 additions and 14 deletions
|
|
@ -9,6 +9,7 @@ export type TEmbeddedNodeType =
|
|||
| 'hashtag'
|
||||
| 'websocket-url'
|
||||
| 'url'
|
||||
| 'emoji'
|
||||
|
||||
export type TEmbeddedNode =
|
||||
| {
|
||||
|
|
@ -64,6 +65,11 @@ export const EmbeddedNormalUrlParser: TContentParser = {
|
|||
regex: /https?:\/\/[\w\p{L}\p{N}\p{M}&.-/?=#\-@%+_:!~*]+/gu
|
||||
}
|
||||
|
||||
export const EmbeddedEmojiParser: TContentParser = {
|
||||
type: 'emoji',
|
||||
regex: /:[a-zA-Z0-9_]+:/g
|
||||
}
|
||||
|
||||
export function parseContent(content: string, parsers: TContentParser[]) {
|
||||
let nodes: TEmbeddedNode[] = [{ type: 'text', data: content.trim() }]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue