Skip to content

Commit 87b4856

Browse files
committed
fix: ts
1 parent 6dcfe46 commit 87b4856

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

packages/webapp/components/chat/components/chatContainer/MessageCardDesktop.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@ const ActionsButtons = ({ className, message }: { className?: string; message: a
161161
]
162162
}
163163

164-
console.log({
165-
headingNode
166-
})
167-
168164
// Create transaction to insert new heading
169165
editor
170166
.chain()
@@ -183,13 +179,13 @@ const ActionsButtons = ({ className, message }: { className?: string; message: a
183179
// editor.commands.scrollIntoView()
184180
editor
185181
.chain()
186-
.focus(+endPos + messageContent.length + 4) // +4 move on contentWrapper node
182+
.focus(+(headingPos || 0) + messageContent.length + 4) // +4 move on contentWrapper node
187183
.scrollIntoView()
188184
.run()
189185
}, 100)
190186
} else if (headingPos === null) {
191187
// if heading not found, set pos end of document
192-
if (headingPos === null) headingPos = doc.content.size
188+
headingPos = doc.content.size || 0
193189

194190
const jsonNode = {
195191
type: ENUMS.NODES.HEADING_TYPE,
@@ -207,11 +203,6 @@ const ActionsButtons = ({ className, message }: { className?: string; message: a
207203
]
208204
}
209205

210-
console.log({
211-
doc,
212-
headingPos
213-
})
214-
215206
// Create transaction to insert new heading
216207
editor
217208
.chain()
@@ -230,7 +221,7 @@ const ActionsButtons = ({ className, message }: { className?: string; message: a
230221
// editor.commands.scrollIntoView()
231222
editor
232223
.chain()
233-
.focus(+headingPos + messageContent.length + 4) // +4 move on contentWrapper node
224+
.focus(+(headingPos || 0) + messageContent.length + 4) // +4 move on contentWrapper node
234225
.scrollIntoView()
235226
.run()
236227
}, 100)

0 commit comments

Comments
 (0)