Start a transaction to manipulate the document
transformation | function | a function(tx) that performs actions on the transaction document tx |
doc.transaction(function(tx, args) {
tx.update(...)
...
tx.setSelection(newSelection)
})
Registers a hook for the update
phase.
During update
data should be derived necessary for rendering.
This is mainly used by extensions of the EditorSession to derive extra state information.
[resource] | string | the name of the resource |
handler | Function | the function handler |
context | Object | owner of the handler |
[options] | Object | options for the resource handler |
Registers a hook for the 'render' phase.
During render
, components should be rerendered.
[resource] | string | the name of the resource |
handler | Function | the function handler |
context | Object | owner of the handler |
[options] | Object | options for the resource handler |
This typically used by components that render node content.
class ImageComponent extends Component {
didMount() {
this.context.editorSession.onRender('document', this.rerender, this, {
path: [this.props.node.id, 'src']
})
}
dispose() {
this.context.editorSession.off(this)
}
render($$) {
...
}
}
Registers a hook for the 'post-render' phase.
ATM, this phase is used internally only, for recovering the DOM selection which typically gets destroyed due to rerendering
[resource] | string | the name of the resource |
handler | Function | the function handler |
context | Object | owner of the handler |
[options] | Object | options for the resource handler |
Registers a hook for the 'position' phase.
During position
, components such as Overlays, for instance, should be positioned.
At this stage, it is guaranteed that all content is rendered, and the DOM selection
is set.
[resource] | string | the name of the resource |
handler | Function | the function handler |
context | Object | owner of the handler |
[options] | Object | options for the resource handler |