diff options
-rw-r--r-- | src/Utils.ts | 6 | ||||
-rw-r--r-- | src/client/views/nodes/PDFBox.tsx | 2 | ||||
-rw-r--r-- | src/client/views/nodes/VideoBox.tsx | 7 | ||||
-rw-r--r-- | src/client/views/nodes/WebBox.tsx | 2 |
4 files changed, 9 insertions, 8 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index dab3548b3..ef9c51b8b 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -601,7 +601,7 @@ export function lightOrDark(color: any) { export function getWordAtPoint(elem: any, x: number, y: number): string | undefined { if (elem.nodeType === elem.TEXT_NODE) { - var range = elem.ownerDocument.createRange(); + const range = elem.ownerDocument.createRange(); range.selectNodeContents(elem); var currentPos = 0; const endPos = range.endOffset; @@ -611,7 +611,7 @@ export function getWordAtPoint(elem: any, x: number, y: number): string | undefi const rangeRect = range.getBoundingClientRect(); if (rangeRect.left <= x && rangeRect.right >= x && rangeRect.top <= y && rangeRect.bottom >= y) { - range.expand("word"); + range.expand?.("word"); // doesn't exist in firefox const ret = range.toString(); range.detach(); return (ret); @@ -619,7 +619,7 @@ export function getWordAtPoint(elem: any, x: number, y: number): string | undefi currentPos += 1; } } else { - for (let childNode of elem.childNodes) { + for (const childNode of elem.childNodes) { const range = childNode.ownerDocument.createRange(); range.selectNodeContents(childNode); const rangeRect = range.getBoundingClientRect(); diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index e4aa639ff..0dbe0c917 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -231,7 +231,7 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps, PdfDocum } else { this.layoutDoc.nativeWidth = NumCast(this.layoutDoc[this.fieldKey + "-nativeWidth"]); } - this.layoutDoc._width = NumCast(this.layoutDoc._nativeWidth) * (NumCast(this.layoutDoc[this.fieldKey + "-nativeWidth"]) / NumCast(this.layoutDoc[this.fieldKey + "-nativeHeight"])) + this.layoutDoc._width = NumCast(this.layoutDoc._nativeWidth) * (NumCast(this.layoutDoc[this.fieldKey + "-nativeWidth"]) / NumCast(this.layoutDoc[this.fieldKey + "-nativeHeight"])); } settingsPanel() { const pageBtns = <> diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index f733de86a..575fbcf2e 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -1,6 +1,6 @@ import React = require("react"); import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { action, computed, IReactionDisposer, observable, reaction, runInAction, untracked } from "mobx"; +import { action, computed, IReactionDisposer, observable, reaction, runInAction, untracked, ObservableMap } from "mobx"; import { observer } from "mobx-react"; import * as rp from 'request-promise'; import { Dictionary } from "typescript-collections"; @@ -51,7 +51,7 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD private _playRegionDuration = 0; @observable static _showControls: boolean; @observable _marqueeing: number[] | undefined; - @observable _savedAnnotations: Dictionary<number, HTMLDivElement[]> = new Dictionary<number, HTMLDivElement[]>(); + @observable _savedAnnotations = new ObservableMap<number, HTMLDivElement[]>(); @observable _screenCapture = false; @observable _clicking = false; @observable _forceCreateYouTubeIFrame = false; @@ -206,7 +206,7 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD this.props.setContentView?.(this); // this tells the DocumentView that this AudioBox is the "content" of the document. this allows the DocumentView to indirectly call getAnchor() on the AudioBox when making a link. this._disposers.selection = reaction(() => this.props.isSelected(), selected => !selected && setTimeout(() => { - this._savedAnnotations.values().forEach(v => v.forEach(a => a.remove())); + Array.from(this._savedAnnotations.values()).forEach(v => v.forEach(a => a.remove())); this._savedAnnotations.clear(); })); this._disposers.triggerVideo = reaction( @@ -575,6 +575,7 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD scrollTop={0} rootDoc={this.rootDoc} down={this._marqueeing} + docView={this.props.docViewPath().lastElement()} scaling={this.marqueeFitScaling} containerOffset={this.marqueeOffset} addDocument={this.addDocWithTimecode} diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx index bc20c3b47..578794e6e 100644 --- a/src/client/views/nodes/WebBox.tsx +++ b/src/client/views/nodes/WebBox.tsx @@ -436,7 +436,7 @@ export class WebBox extends ViewBoxAnnotatableComponent<FieldViewProps, WebDocum } else { this.layoutDoc.nativeWidth = NumCast(this.layoutDoc[this.fieldKey + "-nativeWidth"]); } - this.layoutDoc._width = NumCast(this.layoutDoc._nativeWidth) * (NumCast(this.layoutDoc[this.fieldKey + "-nativeWidth"]) / NumCast(this.layoutDoc[this.fieldKey + "-nativeHeight"])) + this.layoutDoc._width = NumCast(this.layoutDoc._nativeWidth) * (NumCast(this.layoutDoc[this.fieldKey + "-nativeWidth"]) / NumCast(this.layoutDoc[this.fieldKey + "-nativeHeight"])); } sidebarKey = () => this.fieldKey + "-sidebar"; sidebarFiltersHeight = () => 50; |