mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-03-27 21:31:49 +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;
|
let mentionsRoom = false;
|
||||||
editor.children.forEach((node: Descendant): void => {
|
editor.children.forEach((node: Descendant): void => {
|
||||||
if(node.type !== "paragraph") return;
|
if(node.type === undefined || node.type !== "paragraph") return;
|
||||||
(node as ParagraphElement).children?.forEach((child: InlineElement): void => {
|
const paragraph: ParagraphElement = node as ParagraphElement;
|
||||||
|
paragraph.children?.forEach((child: InlineElement): void => {
|
||||||
if (child.type === "mention") {
|
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
|
mentionsRoom = true
|
||||||
} else {
|
} else {
|
||||||
userIdMentions.add(child.id)
|
userIdMentions.add(mention.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue