fix views a bit

This commit is contained in:
Peter Cottle 2015-04-16 19:28:08 +10:00
parent 9a266a3cc4
commit 62b342e665
2 changed files with 11 additions and 6 deletions

View file

@ -48,9 +48,13 @@ var CommandHistoryView = React.createClass({
render: function() {
var allCommands = [];
this.props.commandCollection.each(function(command) {
this.props.commandCollection.each(function(command, index) {
allCommands.push(
<CommandView command={command} key={command.cid} />
<CommandView
id={'command_' + index}
command={command}
key={command.cid}
/>
);
}, this);
return (
@ -61,7 +65,7 @@ var CommandHistoryView = React.createClass({
},
scrollDown: function() {
var cD = this.getDOMNode();
var cD = document.getElementById('commandDisplay');
var t = document.getElementById('terminal');
// firefox hack
@ -69,7 +73,7 @@ var CommandHistoryView = React.createClass({
(window.innerHeight < cD.clientHeight);
// ugh sometimes i wish i had toggle class
var hasScroll = t.className.match(/shouldScroll/g);
var hasScroll = t.className.match(/scrolling/g);
if (shouldScroll && !hasScroll) {
t.className += ' scrolling';
} else if (!shouldScroll && hasScroll) {

View file

@ -13,7 +13,8 @@ var CommandView = React.createClass({
propTypes: {
// the backbone command model
command: React.PropTypes.object.isRequired
command: React.PropTypes.object.isRequired,
id: React.PropTypes.string,
},
componentDidMount: function() {
@ -67,7 +68,7 @@ var CommandView = React.createClass({
]);
return (
<div className="reactCommandView">
<div id={this.props.id} className="reactCommandView">
<p className={commandClass}>
<span className="prompt">{'$'}</span>
{' ' + this.state.rawStr}