Projekt

Obecné

Profil

Stáhnout (1 KB) Statistiky
| Větev: | Tag: | Revize:
1
/**
2
 * Creates an annotation view of a document.
3
 * @returns The annotation view.
4
 */
5
import { ChangeEvent, useContext } from 'react';
6
import { AnnotationContext } from '../../contexts/AnnotationContext';
7
import { Button, Input, Space } from 'antd';
8

    
9
export function DocumentAnnotationView() {
10
    const { annotation, changeDocumentNote } = useContext(AnnotationContext);
11

    
12
    if (!annotation) {
13
        return <p>Probíhá načítání anotace ...</p>;
14
    }
15

    
16
    const onChangeNote = (e: ChangeEvent<HTMLTextAreaElement>) => {
17
        changeDocumentNote(e.currentTarget.value);
18
    };
19

    
20
    return (
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>
30
            <div
31
                dangerouslySetInnerHTML={{ __html: annotation.documentToRender ?? '' }}
32
            />
33
        </div>
34
    );
35
}
(4-4/7)