Actions
Editor actions
Constructors
new Actions()
new Actions(
editor
):Actions
Parameters
• editor: Editor
Returns
Source
Properties
editor
editor:
Editor
Source
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
redo()
redo():
void
Redo
Returns
void
Source
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
removePage()
removePage(
page
):void
Remove a page
Parameters
• page: Page
The page to remove
Returns
void
Source
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
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
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
undo()
undo():
void
Undo
Returns
void
Source
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
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