Revize b51488cd
Přidáno uživatelem Jaroslav Hrubý před téměř 3 roky(ů)
webapp/contexts/AnnotationContext.tsx | ||
---|---|---|
3 | 3 |
AnnotationInfo, |
4 | 4 |
ETagSentiment, |
5 | 5 |
ETagType, |
6 |
SubTagInfo, |
|
7 |
TagInfo, |
|
6 |
MarkAnnotationDoneRequest, |
|
8 | 7 |
TagInstanceInfo, |
9 | 8 |
} from '../api'; |
10 | 9 |
import { Tag } from '../components/types/tag'; |
11 |
import { annotationController, userController } from '../controllers';
|
|
10 |
import { annotationController } from '../controllers'; |
|
12 | 11 |
import { GetSelectionInfo } from '../utils/selectionUtils'; |
13 |
import { ShowConfirmDelete, ShowToast } from '../utils/alerts'; |
|
12 |
import { ShowConfirm, ShowConfirmDelete, ShowToast } from '../utils/alerts'; |
|
13 |
import { useRouter } from 'next/router'; |
|
14 | 14 |
|
15 | 15 |
/** |
16 | 16 |
* Interface of an annotation context provider. |
... | ... | |
44 | 44 |
*/ |
45 | 45 |
deleteOccurrence: (occurrence: TagInstanceInfo) => void; |
46 | 46 |
|
47 |
/** |
|
48 |
* Finishes annotation of document (marked as DONE). |
|
49 |
*/ |
|
50 |
finishAnnotation: () => void; |
|
51 |
|
|
47 | 52 |
/** |
48 | 53 |
* Changes a position of an occurrence of an annotation. |
49 | 54 |
* @param occurrence Occurrence whose position should be changed. |
... | ... | |
121 | 126 |
return; |
122 | 127 |
}, |
123 | 128 |
|
129 |
/** |
|
130 |
* Finishes annotation of document (marked as DONE). |
|
131 |
*/ |
|
132 |
finishAnnotation: () => { |
|
133 |
return; |
|
134 |
}, |
|
135 |
|
|
124 | 136 |
/** |
125 | 137 |
* Default implementation of changePosition method. |
126 | 138 |
* @param occurrence Occurrence whose position should be changed. |
... | ... | |
188 | 200 |
|
189 | 201 |
const [submitting, setSubmitting] = useState(false); |
190 | 202 |
|
203 |
const router = useRouter(); |
|
204 |
|
|
191 | 205 |
async function markSelectedText( |
192 | 206 |
tagId: string, |
193 | 207 |
subtagId: string | null, |
... | ... | |
254 | 268 |
}, 'značku'); |
255 | 269 |
}; |
256 | 270 |
|
271 |
/** |
|
272 |
* Finishes annotation of document (marked as DONE). |
|
273 |
*/ |
|
274 |
const finishAnnotation = () => { |
|
275 |
const req: MarkAnnotationDoneRequest = { done: true }; |
|
276 |
ShowConfirm( |
|
277 |
() => |
|
278 |
annotationController |
|
279 |
.annotationAnnotationIdDonePut(props.annotationId, req) |
|
280 |
.then(() => { |
|
281 |
router.push('/documents/annotator'); |
|
282 |
ShowToast('Anotování bylo úspěšně dokončeno'); |
|
283 |
}), |
|
284 |
'dokončit anotování' |
|
285 |
); |
|
286 |
}; |
|
287 |
|
|
257 | 288 |
/** |
258 | 289 |
* Changes a position of an occurrence of an annotation. |
259 | 290 |
* @param occurrence Occurrence whose position should be changed. |
... | ... | |
364 | 395 |
setTags, |
365 | 396 |
addOccurrence, |
366 | 397 |
deleteOccurrence, |
398 |
finishAnnotation, |
|
367 | 399 |
changeLength, |
368 | 400 |
changePosition, |
369 | 401 |
changeNote, |
Také k dispozici: Unified diff
Annotation finishing implemented