()
| 113 | }, 500); |
| 114 | |
| 115 | renderFrameContents() { |
| 116 | if (!this._isMounted) { |
| 117 | return null; |
| 118 | } |
| 119 | |
| 120 | const doc = this.getDoc(); |
| 121 | |
| 122 | if (!doc) { |
| 123 | return null; |
| 124 | } |
| 125 | |
| 126 | const contentDidMount = this.props.contentDidMount; |
| 127 | const contentDidUpdate = this.props.contentDidUpdate; |
| 128 | |
| 129 | const win = doc.defaultView || doc.parentView; |
| 130 | const contents = ( |
| 131 | <Content |
| 132 | contentDidMount={contentDidMount} |
| 133 | contentDidUpdate={contentDidUpdate} |
| 134 | > |
| 135 | <FrameContextProvider value={{ document: doc, window: win }}> |
| 136 | <div className="frame-content">{this.props.children}</div> |
| 137 | </FrameContextProvider> |
| 138 | </Content> |
| 139 | ); |
| 140 | |
| 141 | if (this.props.dangerouslyUseDocWrite && doc.body.children.length < 1) { |
| 142 | doc.open('text/html', 'replace'); |
| 143 | doc.write(this.props.initialContent); |
| 144 | doc.close(); |
| 145 | } |
| 146 | |
| 147 | const mountTarget = this.getMountTarget(); |
| 148 | |
| 149 | if (!mountTarget) { |
| 150 | return null; |
| 151 | } |
| 152 | |
| 153 | return [ |
| 154 | ReactDOM.createPortal(this.props.head, this.getDoc().head), |
| 155 | ReactDOM.createPortal(contents, mountTarget) |
| 156 | ]; |
| 157 | } |
| 158 | |
| 159 | render() { |
| 160 | const props = { |
no test coverage detected