Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 6973d036

Přidáno uživatelem Lukáš Vlček před asi 2 roky(ů)

Selected tags highlighting

On click in the middle panel or on click on highlight buttons in the right panel

Zobrazit rozdíly:

webapp/utils/selectionUtils.ts
1 1
import { AnnotationInfo } from '../api';
2
import { DOCUMENT_TAG_ID_ATTRIBUTE_NAME } from '../constants';
2 3

  
3 4
export interface SelectionInfo {
4 5
    startElementId: number;
......
9 10

  
10 11
    selectedText: string;
11 12
}
12
const idAttributeName = 'aswi-tag-id';
13 13

  
14 14
export function GetSelectionInfo(annotation: AnnotationInfo): SelectionInfo | null {
15 15
    const selection = window.getSelection();
......
60 60
    let startElement = startTag as Element;
61 61
    let endElement = endTag as Element;
62 62

  
63
    let startId: number = Number(startElement.getAttribute(idAttributeName)) ?? -1;
64
    let endId: number = Number(endElement.getAttribute(idAttributeName)) ?? -1;
63
    let startId: number =
64
        Number(startElement.getAttribute(DOCUMENT_TAG_ID_ATTRIBUTE_NAME)) ?? -1;
65
    let endId: number =
66
        Number(endElement.getAttribute(DOCUMENT_TAG_ID_ATTRIBUTE_NAME)) ?? -1;
65 67

  
66 68
    let startPosition =
67 69
        annotation.tagStartPositions[startId] +

Také k dispozici: Unified diff