mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-01-31 09:49:10 +01:00
Improve typing
This commit is contained in:
parent
fee4065486
commit
a51538dd81
1 changed files with 6 additions and 4 deletions
|
@ -301,13 +301,15 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
|
|||
}
|
||||
let mentionsRoom = false;
|
||||
editor.children.forEach((node: Descendant): void => {
|
||||
if(node.type !== "paragraph") return;
|
||||
(node as ParagraphElement).children?.forEach((child: InlineElement): void => {
|
||||
if(node.type === undefined || node.type !== "paragraph") return;
|
||||
const paragraph: ParagraphElement = node as ParagraphElement;
|
||||
paragraph.children?.forEach((child: InlineElement): void => {
|
||||
if (child.type === "mention") {
|
||||
if(child.name === "@room" && !child.id.startsWith("@")) {
|
||||
const mention: MentionElement = child as MentionElement;
|
||||
if (mention.name === "@room" && !mention.id.startsWith("@")) {
|
||||
mentionsRoom = true
|
||||
} else {
|
||||
userIdMentions.add(child.id)
|
||||
userIdMentions.add(mention.id)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue