diff --git a/templates/demo/app/components/blockchain.js b/templates/demo/app/components/blockchain.js index 4dd177f0..3b5ec984 100644 --- a/templates/demo/app/components/blockchain.js +++ b/templates/demo/app/components/blockchain.js @@ -47,7 +47,7 @@ class Blockchain extends React.Component { if (EmbarkJS.isNewWeb3()) { SimpleStorage.methods.get().call() - .then(_value => this.setState({ valueGet: _value })) + .then(_value => this.setState({ valueGet: _value })); this._addToLog("SimpleStorage.methods.get(console.log)"); } else { SimpleStorage.get() diff --git a/templates/demo/app/components/storage.js b/templates/demo/app/components/storage.js index a3295a38..1d153294 100644 --- a/templates/demo/app/components/storage.js +++ b/templates/demo/app/components/storage.js @@ -28,6 +28,14 @@ class Storage extends React.Component { this.setState(this.state); } + checkEnter(e, func) { + if (e.key !== 'Enter') { + return; + } + e.preventDefault(); + func.apply(this, [e]); + } + handleFileUpload(e) { this.setState({fileToUpload: [e.target]}); } @@ -159,7 +167,7 @@ class Storage extends React.Component { : '' }

Save text to storage

-
+ this.checkEnter(e, this.setText)}>

Load text from storage given an hash

- + this.checkEnter(e, this.loadHash)}>

Get file or image from storage

- + this.checkEnter(e, this.loadFile)}>

Register to IPNS

- + this.checkEnter(e, this.ipnsRegister)}>

Resolve name

- + this.checkEnter(e, this.ipnsResolve)}>