Initial commit 🍀
This commit is contained in:
commit
b3f42e62af
405 changed files with 31017 additions and 0 deletions
17
src/common/text/elements/mention.js
Normal file
17
src/common/text/elements/mention.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Mention
|
||||
*/
|
||||
|
||||
const regexp = /@[a-zA-Z0-9\-]+/;
|
||||
|
||||
module.exports = {
|
||||
test: x => new RegExp('^' + regexp.source).test(x),
|
||||
parse: text => {
|
||||
const mention = text.match(new RegExp('^' + regexp.source))[0];
|
||||
return {
|
||||
type: 'mention',
|
||||
content: mention,
|
||||
username: mention.substr(1)
|
||||
};
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue