Fix noms browser fetch and splore layout (#1989)

This commit is contained in:
Ben Kalman
2016-07-07 18:19:18 -07:00
committed by GitHub
parent ee5c0f3a72
commit 68e16f338e
3 changed files with 11 additions and 9 deletions

View File

@@ -48,7 +48,10 @@ export function fetchText(url: string, options: FetchOptions = {}): Promise<Text
if (self.fetch) {
return self.fetch(url, options)
// resp.headers is a Headers which is a multi map, which is similar enough for now.
.then(resp => ({headers: resp.headers, buf: resp.text()}));
.then(resp => {
const {headers} = resp;
return resp.text().then(text => ({headers, buf: text}));
});
}
return fetch(url, 'text', options);
@@ -58,7 +61,10 @@ export function fetchUint8Array(url: string, options: FetchOptions = {}): Promis
if (self.fetch) {
return self.fetch(url, options)
// resp.headers is a Headers which is a multi map, which is similar enough for now.
.then(resp => ({headers: resp.headers, buf: new Uint8Array(resp.arrayBuffer())}));
.then(resp => {
const {headers} = resp;
return resp.arrayBuffer().then(buf => ({headers, buf: new Uint8Array(buf)}));
});
}
return fetch(url, 'arraybuffer', options);

View File

@@ -97,7 +97,7 @@ function handleChunkLoad(hash: Hash, val: any, fromHash: ?string) {
name: string) {
data.nodes[id] = {name: name};
sequence.items.forEach(tuple => {
const kid = process(hash, formatKeyString(tuple.child), id);
const kid = process(hash, formatKeyString(tuple.ref), id);
if (kid) {
data.nodes[kid].isOpen = true;

View File

@@ -69,12 +69,8 @@ export default class Node extends React.Component<void, Props, State> {
<g className='node' onClick={this.props.onClick} style={{transform:translate}}>
{this.getShape()}
<foreignObject x={-this.props.spaceX + 10} y='-.35em'
width={this.props.spaceX - 20} height='0.7em'
requiredExtensions='http://www.w3.org/1999/xhtml'>
<p xmlns='http://www.w3.org/1999/xhtml' title={this.props.title || this.props.text}
style={paraStyle}>
{text}
</p>
width={this.props.spaceX - 20} height='0.7em'>
<p title={this.props.title || this.props.text} style={paraStyle}>{text}</p>
</foreignObject>
</g>
);