mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-15 01:05:42 +02:00
[noImplicitAny: true] src/text
This commit is contained in:
@@ -3,7 +3,14 @@
|
||||
*/
|
||||
import parseAcct from '../../../acct/parse';
|
||||
|
||||
module.exports = text => {
|
||||
export type TextElementMention = {
|
||||
type: "mention"
|
||||
content: string
|
||||
username: string
|
||||
host: string
|
||||
};
|
||||
|
||||
export default function(text: string) {
|
||||
const match = text.match(/^@[a-z0-9_]+(?:@[a-z0-9\.\-]+[a-z0-9])?/i);
|
||||
if (!match) return null;
|
||||
const mention = match[0];
|
||||
@@ -13,5 +20,5 @@ module.exports = text => {
|
||||
content: mention,
|
||||
username,
|
||||
host
|
||||
};
|
||||
};
|
||||
} as TextElementMention;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user