-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs) show mentions in NcRichText output example
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
- Loading branch information
Showing
2 changed files
with
144 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
export const userData = { | ||
Test01: { | ||
icon: 'icon-user', | ||
id: 'Test01', | ||
title: 'Test01', | ||
source: 'users', | ||
primary: true, | ||
}, | ||
Test02: { | ||
icon: 'icon-user', | ||
id: 'Test02', | ||
title: 'Test02', | ||
source: 'users', | ||
status: { | ||
clearAt: null, | ||
icon: '🎡', | ||
message: 'Visiting London', | ||
status: 'away', | ||
}, | ||
subline: 'Visiting London', | ||
}, | ||
'Test@User': { | ||
icon: 'icon-user', | ||
id: 'Test@User', | ||
title: 'Test 03', | ||
source: 'users', | ||
status: { | ||
clearAt: null, | ||
icon: '🎡', | ||
message: 'Having space in my name', | ||
status: 'online', | ||
}, | ||
subline: 'Visiting London', | ||
}, | ||
'Test Offline': { | ||
icon: 'icon-user', | ||
id: 'Test Offline', | ||
title: 'Test Offline', | ||
source: 'users', | ||
status: { | ||
clearAt: null, | ||
icon: null, | ||
message: null, | ||
status: 'offline', | ||
}, | ||
subline: null, | ||
}, | ||
'Test DND': { | ||
icon: 'icon-user', | ||
id: 'Test DND', | ||
title: 'Test DND', | ||
source: 'users', | ||
status: { | ||
clearAt: null, | ||
icon: null, | ||
message: 'Out sick', | ||
status: 'dnd', | ||
}, | ||
subline: 'Out sick', | ||
}, | ||
} | ||
|
||
/** | ||
* @param {string} string NcRichContenteditable output | ||
* @return {string} NcRichText input | ||
*/ | ||
export function parseUserMentions(string) { | ||
return string | ||
.replace('@Test01', '{user-1}') | ||
.replace('@Test02', '{user-2}') | ||
.replace('@Test@User', '{user-3}') | ||
.replace('@"Test Offline"', '{user-4}') | ||
.replace('@"Test DND"', '{user-5}') | ||
} | ||
|
||
export const userMentions = { | ||
'user-1': { | ||
component: 'NcUserBubble', | ||
props: { | ||
displayName: 'Test01', | ||
user: 'Test01', | ||
primary: true, | ||
}, | ||
}, | ||
'user-2': { | ||
component: 'NcUserBubble', | ||
props: { | ||
displayName: 'Test02', | ||
user: 'Test02', | ||
}, | ||
}, | ||
'user-3': { | ||
component: 'NcUserBubble', | ||
props: { | ||
displayName: 'Test 03', | ||
user: 'Test@User', | ||
}, | ||
}, | ||
'user-4': { | ||
component: 'NcUserBubble', | ||
props: { | ||
displayName: 'Test Offline', | ||
user: 'Test Offline', | ||
}, | ||
}, | ||
'user-5': { | ||
component: 'NcUserBubble', | ||
props: { | ||
displayName: 'Test DND', | ||
user: 'Test DND', | ||
}, | ||
}, | ||
} |