Skip to content

Actions

Editor actions

Constructors

new Actions()

new Actions(editor): Actions

Parameters

editor: Editor

Returns

Actions

Source

packages/core/src/actions.ts:72

Properties

editor

editor: Editor

Source

packages/core/src/actions.ts:70

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

packages/core/src/actions.ts:96


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:788


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:723


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:853


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:663


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:818


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:693


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:758


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:896


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:619


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:575


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:330


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:343


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:439


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

packages/core/src/actions.ts:154


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:527


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

packages/core/src/actions.ts:185


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:487


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:366


redo()

redo(): void

Redo

Returns

void

Source

packages/core/src/actions.ts:86


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:311


removePage()

removePage(page): void

Remove a page

Parameters

page: Page

The page to remove

Returns

void

Source

packages/core/src/actions.ts:124


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

packages/core/src/actions.ts:138


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:641


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:597


undo()

undo(): void

Undo

Returns

void

Source

packages/core/src/actions.ts:79


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:551


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

packages/core/src/actions.ts:211