diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2019-02-26 19:21:09 -0500 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2019-02-26 19:21:09 -0500 |
commit | 56e27c653f73d0846b93f56e355619e142b76500 (patch) | |
tree | 346657722059f09219421a0f88183014a9d7daba /src/client/views/nodes/WebBox.tsx | |
parent | efe5d9515c88f6e0963ae1c04545b7bbbd8beb55 (diff) | |
parent | 04ee2ad6e7ca887c3cfc7277c4b382f936c0fa6d (diff) |
fixed bugs and merged with master
Diffstat (limited to 'src/client/views/nodes/WebBox.tsx')
-rw-r--r-- | src/client/views/nodes/WebBox.tsx | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx index 4f774bae2..0a198f059 100644 --- a/src/client/views/nodes/WebBox.tsx +++ b/src/client/views/nodes/WebBox.tsx @@ -1,15 +1,12 @@ - -import Lightbox from 'react-image-lightbox'; -import { SelectionManager } from "../../util/SelectionManager"; import "./WebBox.scss"; import React = require("react") import { WebField } from '../../../fields/WebField'; import { FieldViewProps, FieldView } from './FieldView'; -import { CollectionFreeFormDocumentView } from './CollectionFreeFormDocumentView'; import { FieldWaiting } from '../../../fields/Field'; import { observer } from "mobx-react" -import { observable, action, spy } from 'mobx'; +import { observable, action, spy, computed } from 'mobx'; import { KeyStore } from '../../../fields/KeyStore'; +import { HtmlField } from "../../../fields/HtmlField"; @observer export class WebBox extends React.Component<FieldViewProps> { @@ -59,15 +56,27 @@ export class WebBox extends React.Component<FieldViewProps> { e.stopPropagation(); } + @computed + get html(): string { + return this.props.doc.GetData(KeyStore.Data, HtmlField, "" as string); + } + + render() { let field = this.props.doc.Get(this.props.fieldKey); let path = field == FieldWaiting ? "https://image.flaticon.com/icons/svg/66/66163.svg" : field instanceof WebField ? field.Data.href : "https://crossorigin.me/" + "https://cs.brown.edu"; - let nativeWidth = this.props.doc.GetNumber(KeyStore.NativeWidth, 1); + + let content = this.html ? + <span dangerouslySetInnerHTML={{ __html: this.html }}></span> : + <div style={{ width: "100%", height: "100%", position: "absolute" }}> + <iframe src={path} style={{ position: "absolute", width: "100%", height: "100%" }}></iframe> + {this.props.isSelected() ? (null) : <div style={{ width: "100%", height: "100%", position: "absolute" }} />} + </div>; return ( <div className="webBox-cont" onPointerDown={this.onPointerDown} ref={this._ref} > - <iframe src={path} width={nativeWidth}></iframe> + {content} </div>) } }
\ No newline at end of file |