Revize 61acc160
Přidáno uživatelem Dominik Poch před asi 2 roky(ů)
webapp/components/annotation/DocumentAnnotationView.tsx | ||
---|---|---|
2 | 2 |
* Creates an annotation view of a document. |
3 | 3 |
* @returns The annotation view. |
4 | 4 |
*/ |
5 |
import { useContext } from 'react'; |
|
5 |
import { ChangeEvent, useContext } from 'react';
|
|
6 | 6 |
import { AnnotationContext } from '../../contexts/AnnotationContext'; |
7 |
import { Button } from 'antd'; |
|
7 |
import { Button, Input, Space } from 'antd';
|
|
8 | 8 |
|
9 | 9 |
export function DocumentAnnotationView() { |
10 |
const { annotation } = useContext(AnnotationContext); |
|
10 |
const { annotation, changeDocumentNote } = useContext(AnnotationContext);
|
|
11 | 11 |
|
12 | 12 |
if (!annotation) { |
13 | 13 |
return <p>Probíhá načítání anotace ...</p>; |
14 | 14 |
} |
15 | 15 |
|
16 |
const onChangeNote = (e: ChangeEvent<HTMLTextAreaElement>) => { |
|
17 |
changeDocumentNote(e.currentTarget.value); |
|
18 |
}; |
|
19 |
|
|
16 | 20 |
return ( |
17 | 21 |
<div> |
22 |
<div className="mb-3"> |
|
23 |
<h5>Poznámka</h5> |
|
24 |
<Input.TextArea |
|
25 |
defaultValue={annotation.note ?? ''} |
|
26 |
onBlur={onChangeNote} |
|
27 |
/> |
|
28 |
</div> |
|
29 |
<h5>Obsah</h5> |
|
18 | 30 |
<div |
19 | 31 |
dangerouslySetInnerHTML={{ __html: annotation.documentToRender ?? '' }} |
20 | 32 |
/> |
Také k dispozici: Unified diff
Added note of a document