First published in the Language finch documentation

This article, do not do classification, busy work, only do collection, later reclassification. Any component wrapped with withPropsAPI will have the propsAPI property in the component props, which is the API exposed by ggeditor.

import withPropsAPI from "gg-editor"
console.log(this.props.propsAPI)
Copy the code

Access to the canvas

this.props.propsAPI.currentPage
this.props.propsAPI.getGraph()
Copy the code

Get the current node

this.props.propsAPI.getSelected()[0]
Copy the code

Gets the data model for the current node

this.props.propsAPI.getSelected()[0].getModel()
Copy the code

Save canvas data

this.props.propsAPI.save()
Copy the code

Clear all options

this.props.propsAPI.currentPage.clearSelected()
Copy the code

Setting the selected state

const node = this.props.propsAPI.find('node Id')
this.props.propsAPI.currentPage.setSelected(node)
Copy the code