From f9db6aa1059c6034adb41bc25f932ec5749e6aea Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 15 Mar 2021 14:59:43 -0400 Subject: almost everything working with webBox -- just need to tweak scrollHeight --- src/client/views/nodes/WebBox.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx index 0f10d7cae..a0baf699e 100644 --- a/src/client/views/nodes/WebBox.tsx +++ b/src/client/views/nodes/WebBox.tsx @@ -37,6 +37,7 @@ import { FormattedTextBox } from "./formattedText/FormattedTextBox"; import { LinkDocPreview } from "./LinkDocPreview"; import "./WebBox.scss"; import React = require("react"); +import { LightboxView } from "../LightboxView"; const htmlToText = require("html-to-text"); type WebDocument = makeInterface<[typeof documentSchema]>; @@ -63,8 +64,7 @@ export class WebBox extends ViewBoxAnnotatableComponent = new Dictionary(); - get scrollHeight() { return this.webpage?.scrollHeight || 1000; } - get webpage() { return this._iframe?.contentDocument?.children[0]; } + @computed get scrollHeight() { return 100000; }//this._iframe?.scrollHeight || 1000; } @computed get inlineTextAnnotations() { return this.allAnnotations.filter(a => a.textInlineAnnotations); } constructor(props: any) { @@ -191,13 +191,14 @@ export class WebBox extends ViewBoxAnnotatableComponent !this.active() && this._iframe && (this._iframe.scrollTop = NumCast(this.layoutDoc._scrollTop), false)); } } @@ -205,7 +206,8 @@ export class WebBox extends ViewBoxAnnotatableComponent { this._scrollTimer = undefined; - if (!LinkDocPreview.LinkInfo && this._outerRef.current) { + if (!LinkDocPreview.LinkInfo && this._outerRef.current && + (!LightboxView.LightboxDoc || LightboxView.IsLightboxDocView(this.props.docViewPath()))) { this.layoutDoc._scrollTop = this._outerRef.current.scrollTop; } }, timeout); @@ -214,7 +216,7 @@ export class WebBox extends ViewBoxAnnotatableComponent this.resetIgnoreScroll(); scrollFocus = (doc: Doc, smooth: boolean) => { let focusSpeed: Opt; - if (doc !== this.rootDoc && this.webpage) { + if (doc !== this.rootDoc && this._outerRef.current) { const scrollTo = doc.type === DocumentType.TEXTANCHOR ? NumCast(doc.y) : Utils.scrollIntoView(NumCast(doc.y), doc[HeightSym](), NumCast(this.layoutDoc._scrollTop), this.props.PanelHeight() / (this.props.scaling?.() || 1)); if (scrollTo !== undefined) { this._initialScroll !== undefined && (this._initialScroll = scrollTo); -- cgit v1.2.3-70-g09d2