We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
See comment thread here doccano/doccano#1863
on Firefox labeling across lines breaks when there is another element in between:
As comment thread suggests it happens in the method: TextSelectionHandler.getRange()
Do you think this method works before I create a PR?
private getRange(): [number, number] { const selection = window.getSelection(); // get elements. const startElement = selection!.anchorNode!.parentNode; const endElement = selection!.focusNode!.parentNode; // Get TextLine objects. // This depends on BaseText.vue component. // See the component in detail. const startLine = ( startElement as unknown as { annotatorElement: TextLine } ).annotatorElement; const endLine = (endElement as unknown as { annotatorElement: TextLine }) .annotatorElement; let startOffset = 0; let endOffset = 0; if(startLine === undefined) { // alternative method const altStartElement = (startElement?.firstChild as SVGTextElement); const altStartLine = ( altStartElement as unknown as { annotatorElement: TextLine } ).annotatorElement; const altStartLineText = altStartElement.innerHTML; const selectionTexts = selection!.toString().split(/\r\n|\r|\n/); const altSelectionAnchorStart = altStartLineText.lastIndexOf(selectionTexts[0]); startOffset = altStartLine.startOffset + altSelectionAnchorStart; endOffset = endLine.startOffset + selection!.focusOffset; } else { // get offsets. startOffset = startLine.startOffset + selection!.anchorOffset; endOffset = endLine.startOffset + selection!.focusOffset; } selection?.removeAllRanges(); if (startOffset > endOffset) { return [endOffset, startOffset]; } else { return [startOffset, endOffset]; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
See comment thread here
doccano/doccano#1863
on Firefox
labeling across lines breaks when there is another element in between:
As comment thread suggests it happens in the method: TextSelectionHandler.getRange()
Do you think this method works before I create a PR?
The text was updated successfully, but these errors were encountered: