fix: shape parent id on duplicate page (#920)
This commit is contained in:
parent
ae4a1b6fbe
commit
49fc0a261e
1 changed files with 5 additions and 3 deletions
|
@ -3,13 +3,15 @@ import type { TldrawApp } from '~state/TldrawApp'
|
|||
import type { TldrawCommand } from '~types'
|
||||
|
||||
export function duplicatePage(app: TldrawApp, pageId: string): TldrawCommand {
|
||||
const newId = Utils.uniqueId()
|
||||
const {
|
||||
currentPageId,
|
||||
page,
|
||||
pageState: { camera },
|
||||
} = app
|
||||
|
||||
const page = app.document.pages[pageId]
|
||||
|
||||
const newId = Utils.uniqueId()
|
||||
|
||||
const nextPage = {
|
||||
...page,
|
||||
id: newId,
|
||||
|
@ -20,7 +22,7 @@ export function duplicatePage(app: TldrawApp, pageId: string): TldrawCommand {
|
|||
id,
|
||||
{
|
||||
...shape,
|
||||
parentId: shape.parentId === pageId ? newId : shape.parentId,
|
||||
parentId: shape.parentId === page.id ? newId : shape.parentId,
|
||||
},
|
||||
]
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue