Interface that should be implemented for editors

### Hierarchy

- IPiecesAPI

## Index

### Properties

- deleteImage
- getImageList
- getNodeRect
- getPieceData
- isNodeVisible
- resolveConflict
- resolvers
- savePieceData
- subscribe
- uploadImage

## Properties

### Optional deleteImage

deleteImage: undefined | ((id: string) => Promise<any>)

Delete image by id. If not specified delete operation will be disabled

### Optional getImageList

getImageList: undefined | ((piece: { dataset?: undefined | {}; id: string }) => Promise<Array<GalleryItem>>)

Get image gallery. If not specified gallery will be disabled

### getNodeRect

getNodeRect: (piece: IPieceItem) => { hover?: Rect; node: Rect }

Resolves piece rectangle to display hover rectangle

#### Type declaration

- - (piece: IPieceItem): { hover?: Rect; node: Rect }

  - #### Parameters

    - ##### piece: IPieceItem

    #### Returns { hover?: Rect; node: Rect }

    - ##### Optional hover?: Rect

    - ##### node: Rect

### getPieceData

getPieceData: PieceDataResolver

Resolve piece data from server or other source

### isNodeVisible

isNodeVisible: (piece: IPieceItem) => boolean

Checks if node is visible on current page

#### Type declaration

- - (piece: IPieceItem): boolean

  - #### Parameters

    - ##### piece: IPieceItem

    #### Returns boolean

### Optional resolveConflict

resolveConflict: PieceConflictResolver

Resolve conflicts between current in-state piece data and data coming from external source Should resolve as data that needs to be applied

param

  current state of piece

param

  external state of piece

### resolvers

resolvers: Partial<Record<PieceType, PieceDataResolver>>

Specifies piece data resolvers per piece type

### savePieceData

savePieceData: (piece: IPieceItem) => Promise<IPieceItem>

Persist piece data on server or other target

#### Type declaration

- - (piece: IPieceItem): Promise<IPieceItem>

  - #### Parameters

    - ##### piece: IPieceItem

    #### Returns Promise<IPieceItem>

### Optional subscribe

subscribe: PieceSubscription

Subscribe to piece updates coming from external source, i.e. websockets

param

  subscription function Should return an unsubscribe function

### Optional uploadImage

uploadImage: undefined | ((file: File | FileList) => Promise<GalleryItem | GalleryItem[]>)

Upload images. If not specified, upload will be disabled

Generated using TypeDoc