@mocanvas/editor · function

duplicatePage

declare function duplicatePage(editor: Editor, id?: PageId, createId?: PageId): PageId | undefined

Copy a page — its shapes, the bindings among them, and its name — and return the new page's id.

The copy is NOT switched to: duplicating a page is usually a step in a longer piece of work ("give me a variant to try things on"), and taking the user away from where they were is the wrong default. setCurrentPage is one call.

Session state is deliberately not copied. Selection and hover belong to a person looking at a page, not to the page.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.