Skip to content

Commit 2361b42

Browse files
committed
Added documentation
1 parent cf78297 commit 2361b42

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,33 @@ For use in containers bound to annotations e.g. as children of `<AnnotationAccor
145145
* `connectShapeToLayout( Container )`: returns a wrapped container component that can be bound to a shape such that its children are bound to that shape's figure entry under the `layout.shapes` key, e.g. the `<Fold>`s in `<ShapeAccordion />` above.
146146
* `connectImagesToLayout( Container )`: returns a wrapped container component that can be bound to an image such that its children are bound to that image's figure entry under the `layout.image` key, e.g. the `<Fold>`s in `<ImageAccordion />` above.
147147

148+
### Action History
149+
150+
You can show/hide undo/redo buttons via `showUndoRedo` prop of `<PlotlyEditor />`.
151+
152+
You can trigger undo/redo actions programmatically by passing a ref to `PlotlyEditor` or `EditorControls` and calling `undo` or `redo` methods on the ref. E.g.:
153+
154+
```javascript
155+
const rceRef = useRef(null);
156+
...
157+
<EditModeController
158+
ref={rceRef}
159+
...
160+
/>
161+
...
162+
rceRef.current.undo()
163+
```
164+
165+
Use `onAddToUndo` and `onAddToRedo` hooks to trigger events when an action is added to undo or redo history in the `<PlotlyEditor />` component.
166+
167+
```javascript
168+
<PlotlyEditor
169+
...
170+
onAddToUndo={() => { console.log('action added to undo') }}
171+
onAddToRedo={() => { console.log('action added to redo') }}
172+
/>
173+
```
174+
148175
## Mapbox Access Tokens
149176

150177
To use Satellite Maps in the Editor, [Mapbox access tokens](https://www.mapbox.com/help/how-access-tokens-work/) are required.

0 commit comments

Comments
 (0)