Skip to content
Snippets Groups Projects
Commit 0b8b02cb authored by Chris Beer's avatar Chris Beer
Browse files

Preserve the annotation creation options after saving an annotation; part of #12

parent 5e5b3619
No related branches found
No related tags found
No related merge requests found
...@@ -77,6 +77,7 @@ class AnnotationCreation extends Component { ...@@ -77,6 +77,7 @@ class AnnotationCreation extends Component {
strokeColor: '#00BFFF', strokeColor: '#00BFFF',
strokeWidth: 1, strokeWidth: 1,
svg: null, svg: null,
textEditorStateBustingKey: 0,
xywh: null, xywh: null,
...annoState, ...annoState,
}; };
...@@ -149,10 +150,10 @@ class AnnotationCreation extends Component { ...@@ -149,10 +150,10 @@ class AnnotationCreation extends Component {
submitForm(e) { submitForm(e) {
e.preventDefault(); e.preventDefault();
const { const {
annotation, canvases, closeCompanionWindow, receiveAnnotation, config, annotation, canvases, receiveAnnotation, config,
} = this.props; } = this.props;
const { const {
annoBody, tags, xywh, svg, annoBody, tags, xywh, svg, textEditorStateBustingKey,
} = this.state; } = this.state;
canvases.forEach((canvas) => { canvases.forEach((canvas) => {
const storageAdapter = config.annotation.adapter(canvas.id); const storageAdapter = config.annotation.adapter(canvas.id);
...@@ -175,10 +176,13 @@ class AnnotationCreation extends Component { ...@@ -175,10 +176,13 @@ class AnnotationCreation extends Component {
}); });
} }
}); });
this.setState({ this.setState({
activeTool: null, annoBody: '',
svg: null,
textEditorStateBustingKey: textEditorStateBustingKey + 1,
xywh: null,
}); });
closeCompanionWindow();
} }
/** */ /** */
...@@ -216,6 +220,7 @@ class AnnotationCreation extends Component { ...@@ -216,6 +220,7 @@ class AnnotationCreation extends Component {
const { const {
activeTool, colorPopoverOpen, currentColorType, fillColor, popoverAnchorEl, strokeColor, activeTool, colorPopoverOpen, currentColorType, fillColor, popoverAnchorEl, strokeColor,
popoverLineWeightAnchorEl, lineWeightPopoverOpen, strokeWidth, closedMode, annoBody, svg, popoverLineWeightAnchorEl, lineWeightPopoverOpen, strokeWidth, closedMode, annoBody, svg,
textEditorStateBustingKey,
} = this.state; } = this.state;
return ( return (
<CompanionWindow <CompanionWindow
...@@ -349,6 +354,7 @@ class AnnotationCreation extends Component { ...@@ -349,6 +354,7 @@ class AnnotationCreation extends Component {
</Grid> </Grid>
<Grid item xs={12}> <Grid item xs={12}>
<TextEditor <TextEditor
key={textEditorStateBustingKey}
annoHtml={annoBody} annoHtml={annoBody}
updateAnnotationBody={this.updateBody} updateAnnotationBody={this.updateBody}
/> />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment