Skip to content

Commit f963529

Browse files
committed
fix: insert copy 2 doc at correct position
1 parent 4c83c1f commit f963529

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/webapp/hooks/useCopyToDoc.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,13 @@ export const useCopyToDoc = () => {
8888
})
8989

9090
// Calculate position where content should be inserted
91+
// content should inster at the end of the contentWrapper node before heading node starts
9192
let insertPosition =
9293
headingPos !== null && headingNode
93-
? headingPos + Number(headingNode.content.size) // End of current heading's content
94+
? headingPos +
95+
Number(headingNode.content.size) -
96+
Number(secondHeadingNode.content.size) -
97+
2 // End of current heading's content
9498
: doc.content.size - 2 || 0 // End of document if heading not found
9599

96100
if (headingLevel === 1) {

0 commit comments

Comments
 (0)