diff options
| author | bobzel <zzzman@gmail.com> | 2020-09-13 11:05:07 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2020-09-13 11:05:07 -0400 |
| commit | 4f5a3e202d8e78b5a721c910435446210952b393 (patch) | |
| tree | fad7ca0d5fe88b69d89af3c53a1dd40f37b12353 /src/client/views/nodes | |
| parent | e25b4985c8716e39cb586e5ce313a093048ceab6 (diff) | |
fixed issues when webBox is wider than window width (try a very. narrow window). things would scroll horizontally and not restore.
Diffstat (limited to 'src/client/views/nodes')
| -rw-r--r-- | src/client/views/nodes/WebBox.tsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx index 55cad3931..41622dbc9 100644 --- a/src/client/views/nodes/WebBox.tsx +++ b/src/client/views/nodes/WebBox.tsx @@ -107,10 +107,13 @@ export class WebBox extends ViewBoxAnnotatableComponent<FieldViewProps, WebDocum this._setPreviewCursor?.(e.screenX, e.screenY, false); } iframeScrolled = (e: any) => { - const scrollTop = e.target?.children?.[0].scrollTop; - const scrollLeft = e.target?.children?.[0].scrollLeft; - this.layoutDoc._scrollTop = this._outerRef.current!.scrollTop = scrollTop; - this.layoutDoc._scrollLeft = this._outerRef.current!.scrollLeft = scrollLeft; + if (e.target?.children) { + e.target.children[0].scrollLeft = 0; + const scrollTop = e.target.children[0].scrollTop; + const scrollLeft = e.target.children[0].scrollLeft; + this.layoutDoc._scrollTop = this._outerRef.current!.scrollTop = scrollTop; + this.layoutDoc._scrollLeft = this._outerRef.current!.scrollLeft = scrollLeft; + } } async componentDidMount() { const urlField = Cast(this.dataDoc[this.props.fieldKey], WebField); |
