Skip to content

Actions

Editor actions

Constructors

new Actions()

new Actions(editor): Actions

Parameters

editor: Editor

Returns

Actions

Source

actions.ts:70

Properties

editor

editor: Editor

Source

actions.ts:68

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

Page

The added page

Source

actions.ts:94


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

actions.ts:770


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

actions.ts:705


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

actions.ts:835


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

actions.ts:645


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

actions.ts:800


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

actions.ts:675


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

actions.ts:740


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

actions.ts:878


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

actions.ts:601


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

actions.ts:557


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

actions.ts:317


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

actions.ts:330


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

actions.ts:421


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

Page

The duplicated page

Source

actions.ts:150


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

actions.ts:509


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

Shape

Source

actions.ts:180


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

actions.ts:469


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

actions.ts:353


redo()

redo(): void

Redo

Returns

void

Source

actions.ts:84


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

actions.ts:298


removePage()

removePage(page): void

Remove a page

Parameters

page: Page

The page to remove

Returns

void

Source

actions.ts:120


reorderPage()

reorderPage(page, position): Page

Reorder a page

Parameters

page: Page

The page to reorder

position: number

The new position of the page

Returns

Page

The reordered page

Source

actions.ts:134


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

actions.ts:623


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

actions.ts:579


undo()

undo(): void

Undo

Returns

void

Source

actions.ts:77


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

actions.ts:533


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

Source

actions.ts:206