diff options
author | bobzel <zzzman@gmail.com> | 2021-03-02 19:52:59 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-03-02 19:52:59 -0500 |
commit | 1b481cd441cc8bb200906b246b43e4bc5dc53b4e (patch) | |
tree | 10fe0b4cbbfa7a0c25cf84090aef0f12bbf0be4c /src/client/views/nodes/EquationBox.tsx | |
parent | faf9dc5ca6a7380f3b040dc2ddbe07c29689e014 (diff) |
added a fitwidth toggle for lightbox. fixed _showCaption/setting _fields to undefined. updated documentView to use not having fitWidth set as a trigger for whether to treat a doc without nativeWidth/Height as if its width/height is that.
Diffstat (limited to 'src/client/views/nodes/EquationBox.tsx')
-rw-r--r-- | src/client/views/nodes/EquationBox.tsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/client/views/nodes/EquationBox.tsx b/src/client/views/nodes/EquationBox.tsx index 7f9fc342a..5bc73d5d9 100644 --- a/src/client/views/nodes/EquationBox.tsx +++ b/src/client/views/nodes/EquationBox.tsx @@ -56,10 +56,13 @@ export class EquationBox extends ViewBoxBaseComponent<FieldViewProps, EquationDo } onChange = (str: string) => { this.dataDoc.text = str; - const _height = Number(getComputedStyle(this._ref.current!.element.current).height.replace("px", "")); - const _width = Number(getComputedStyle(this._ref.current!.element.current).width.replace("px", "")); - this.layoutDoc._width = Math.max(35, _width); - this.layoutDoc._height = Math.max(25, _height); + const style = this._ref.current && getComputedStyle(this._ref.current.element.current); + if (style) { + const _height = Number(style.height.replace("px", "")); + const _width = Number(style.width.replace("px", "")); + this.layoutDoc._width = Math.max(35, _width); + this.layoutDoc._height = Math.max(25, _height); + } } render() { TraceMobx(); |