Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
0c0a978886
commit
38cbb87a62
21 changed files with 948 additions and 507 deletions
src/util
|
@ -90,7 +90,6 @@ export function getScrollInfo(target) {
|
|||
scroll.top = Math.round(target.scrollTop);
|
||||
scroll.height = Math.round(target.scrollHeight);
|
||||
scroll.viewHeight = Math.round(target.offsetHeight);
|
||||
scroll.bottom = Math.round(scroll.top + scroll.viewHeight);
|
||||
scroll.isScrollable = scroll.height > scroll.viewHeight;
|
||||
return scroll;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,28 @@ function getPowerLabel(powerLevel) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function parseReply(rawBody) {
|
||||
if (rawBody?.indexOf('>') !== 0) return null;
|
||||
let body = rawBody.slice(rawBody.indexOf('<') + 1);
|
||||
const user = body.slice(0, body.indexOf('>'));
|
||||
|
||||
body = body.slice(body.indexOf('>') + 2);
|
||||
const replyBody = body.slice(0, body.indexOf('\n\n'));
|
||||
body = body.slice(body.indexOf('\n\n') + 2);
|
||||
|
||||
if (user === '') return null;
|
||||
|
||||
const isUserId = user.match(/^@.+:.+/);
|
||||
|
||||
return {
|
||||
userId: isUserId ? user : null,
|
||||
displayName: isUserId ? null : user,
|
||||
replyBody,
|
||||
body,
|
||||
};
|
||||
}
|
||||
|
||||
export {
|
||||
getBaseUrl, getUsername, getUsernameOfRoomMember,
|
||||
isRoomAliasAvailable, getPowerLabel,
|
||||
isRoomAliasAvailable, getPowerLabel, parseReply,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue