Skip to content
Snippets Groups Projects
Unverified Commit f2edc12a authored by Michael J. Giarlo's avatar Michael J. Giarlo Committed by GitHub
Browse files

Merge pull request #59 from ProjectMirador/12-anno-create

Preserve the annotation creation options after saving an annotation
parents ed2fb4e9 0b8b02cb
Branches
No related tags found
2 merge requests!3Integrate upstream tests into gitlab ci,!2Update plugin code from upstream
...@@ -83,6 +83,7 @@ class AnnotationCreation extends Component { ...@@ -83,6 +83,7 @@ class AnnotationCreation extends Component {
popoverAnchorEl: null, popoverAnchorEl: null,
popoverLineWeightAnchorEl: null, popoverLineWeightAnchorEl: null,
svg: null, svg: null,
textEditorStateBustingKey: 0,
xywh: null, xywh: null,
...annoState, ...annoState,
}; };
...@@ -155,10 +156,10 @@ class AnnotationCreation extends Component { ...@@ -155,10 +156,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);
...@@ -181,10 +182,13 @@ class AnnotationCreation extends Component { ...@@ -181,10 +182,13 @@ class AnnotationCreation extends Component {
}); });
} }
}); });
this.setState({ this.setState({
activeTool: null, annoBody: '',
svg: null,
textEditorStateBustingKey: textEditorStateBustingKey + 1,
xywh: null,
}); });
closeCompanionWindow();
} }
/** */ /** */
...@@ -222,6 +226,7 @@ class AnnotationCreation extends Component { ...@@ -222,6 +226,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
...@@ -355,6 +360,7 @@ class AnnotationCreation extends Component { ...@@ -355,6 +360,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 to comment