Actions
Editor actions
Constructors
new Actions()
new Actions(
editor):Actions
Parameters
• editor: Editor
Returns
Source
packages/core/src/actions.ts:73
Properties
editor
editor:
Editor
Source
packages/core/src/actions.ts:71
Methods
addPage()
addPage(
pageProps?,position?):Page
Add a page
Parameters
• pageProps?: Partial<Page>
The properties of the page to add
• position?: number
The position to add the page at. If not provided, the page will be added at the end
Returns
The added page
Source
packages/core/src/actions.ts:97
alignBottom()
alignBottom(
shapes?):Shape[]
Align selected shapes to bottom
Parameters
• shapes?: Shape[]
The shapes to align. If not provided, the selected shapes will be aligned
Returns
Shape[]
The shapes that were aligned
Source
packages/core/src/actions.ts:800
alignCenter()
alignCenter(
shapes?):Shape[]
Align selected shapes to horizontally center
Parameters
• shapes?: Shape[]
The shapes to align. If not provided, the selected shapes will be aligned
Returns
Shape[]
The shapes that were aligned
Source
packages/core/src/actions.ts:735
alignHorizontalSpaceAround()
alignHorizontalSpaceAround(
shapes?):Shape[]
Align selected shapes horizontally with space around
Parameters
• shapes?: Shape[]
The shapes to align. If not provided, the selected shapes will be aligned
Returns
Shape[]
The shapes that were aligned
Source
packages/core/src/actions.ts:865
alignLeft()
alignLeft(
shapes?):Shape[]
Align selected shapes to left
Parameters
• shapes?: Shape[]
The shapes to align. If not provided, the selected shapes will be aligned
Returns
Shape[]
The shapes that were aligned
Source
packages/core/src/actions.ts:675
alignMiddle()
alignMiddle(
shapes?):Shape[]
Align selected shapes to vertically middle
Parameters
• shapes?: Shape[]
The shapes to align. If not provided, the selected shapes will be aligned
Returns
Shape[]
The shapes that were aligned
Source
packages/core/src/actions.ts:830
alignRight()
alignRight(
shapes?):Shape[]
Align selected shapes to right
Parameters
• shapes?: Shape[]
The shapes to align. If not provided, the selected shapes will be aligned
Returns
Shape[]
The shapes that were aligned
Source
packages/core/src/actions.ts:705
alignTop()
alignTop(
shapes?):Shape[]
Align selected shapes to top
Parameters
• shapes?: Shape[]
The shapes to align. If not provided, the selected shapes will be aligned
Returns
Shape[]
The shapes that were aligned
Source
packages/core/src/actions.ts:770
alignVerticalSpaceAround()
alignVerticalSpaceAround(
shapes?):Shape[]
Align selected shapes vertically with space around
Parameters
• shapes?: Shape[]
The shapes to align. If not provided, the selected shapes will be aligned
Returns
Shape[]
The shapes that were aligned
Source
packages/core/src/actions.ts:908
bringForward()
bringForward(
shapes?):Shape[]
Bring selected shapes forward
Parameters
• shapes?: Shape[]
The shapes to bring forward. If not provided, the selected shapes will be brought forward
Returns
Shape[]
The shapes that were brought forward
Source
packages/core/src/actions.ts:631
bringToFront()
bringToFront(
shapes?):Shape[]
Bring selected shapes to front
Parameters
• shapes?: Shape[]
The shapes to bring to front. If not provided, the selected shapes will be brought to front
Returns
Shape[]
The shapes that were brought to front
Source
packages/core/src/actions.ts:587
copy()
copy(
shapes?):Promise<Shape[]>
Copy selected shapes
Parameters
• shapes?: Shape[]
The shapes to copy. If not provided, the selected shapes will be copied
Returns
Promise<Shape[]>
The copied shapes
Source
packages/core/src/actions.ts:342
cut()
cut(
shapes?):Promise<Shape[]>
Cut selected shapes
Parameters
• shapes?: Shape[]
The shapes to cut. If not provided, the selected shapes will be cut
Returns
Promise<Shape[]>
Source
packages/core/src/actions.ts:355
duplicate()
duplicate(
shapes?,dx?,dy?,parent?):Shape[]
Duplicate shapes
Parameters
• shapes?: Shape[]
The shapes to duplicate. If not provided, the selected shapes will be duplicated
• dx?: number= 30
The horizontal distance to move the duplicated shapes
• dy?: number= 30
The vertical distance to move the duplicated shapes
• parent?: Shape
The parent shape to insert the duplicated shapes into. If not provided, the duplicated shapes will be inserted into the current page
Returns
Shape[]
Source
packages/core/src/actions.ts:451
duplicatePage()
duplicatePage(
page,pageProps?,position?):Page
Duplicate a page
Parameters
• page: Page
The page to duplicate
• pageProps?: Partial<Page>
The properties of the duplicated page
• position?: number
The position to add the duplicated page at. If not provided, the page will be added at the next of the original page
Returns
The duplicated page
Source
packages/core/src/actions.ts:155
group()
group(
shapes?,parent?):null|Group
Group given shapes.
Parameters
• shapes?: Shape[]
The shapes to group. If not provided, the selected shapes will be grouped
• parent?: Shape
The parent shape to insert the group into. If not provided, the group will be inserted into the current page
Returns
null | Group
The created group
Source
packages/core/src/actions.ts:539
insert()
insert(
shape,parent?):Shape
Insert a shape into the current page or another shape
Parameters
• shape: Shape
The shape to insert
• parent?: Shape
The parent shape to insert the shape into. If not provided, the shape will be inserted into the current page
Returns
Source
packages/core/src/actions.ts:186
move()
move(
dx,dy,shapes?):Shape[]
Move selected shapes
Parameters
• dx: number
The horizontal distance to move the shapes
• dy: number
The vertical distance to move the shapes
• shapes?: Shape[]
The shapes to move. If not provided, the selected shapes will be moved
Returns
Shape[]
The moved shapes
Source
packages/core/src/actions.ts:499
paste()
paste(
page?):Promise<Shape[]>
Paste
Parameters
• page?: Page
The page to paste the shapes into. If not provided, the shapes will be pasted into the current page
Returns
Promise<Shape[]>
The pasted shapes
Source
packages/core/src/actions.ts:378
redo()
redo():
void
Redo
Returns
void
Source
packages/core/src/actions.ts:87
remove()
remove(
shapes?):void
Remove selected shapes
Parameters
• shapes?: Shape[]
The shapes to remove. If not provided, the selected shapes will be removed
Returns
void
Source
packages/core/src/actions.ts:323
removePage()
removePage(
page):void
Remove a page
Parameters
• page: Page
The page to remove
Returns
void
Source
packages/core/src/actions.ts:125
reorderPage()
reorderPage(
page,position):Page
Reorder a page
Parameters
• page: Page
The page to reorder
• position: number
The new position of the page
Returns
The reordered page
Source
packages/core/src/actions.ts:139
sendBackward()
sendBackward(
shapes?):Shape[]
Send selected shapes backward
Parameters
• shapes?: Shape[]
The shapes to send backward. If not provided, the selected shapes will be sent backward
Returns
Shape[]
The shapes that were sent backward
Source
packages/core/src/actions.ts:653
sendToBack()
sendToBack(
shapes?):Shape[]
Send selected shapes to back
Parameters
• shapes?: Shape[]
The shapes to send to back. If not provided, the selected shapes will be sent to back
Returns
Shape[]
The shapes that were sent to back
Source
packages/core/src/actions.ts:609
undo()
undo():
void
Undo
Returns
void
Source
packages/core/src/actions.ts:80
ungroup()
ungroup(
shapes?):void
Ungroup given groups.
Parameters
• shapes?: Shape[]
The shapes to ungroup. If not provided, the selected shapes will be ungrouped
Returns
void
Source
packages/core/src/actions.ts:563
update()
update(
values,objs?):undefined|Obj[]
Update obj properties
Parameters
• values: Partial<Shape & Doc & Page & Box & Path & Line & Rectangle & Ellipse & Text & Image & Icon & Connector & Freehand & Highlighter & Group & Frame & Mirror & Embed>
The properties to update
• objs?: Obj[]
The shapes to update. If not provided, the selected shapes will be updated
Returns
undefined | Obj[]
The updated shapes