0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-31 17:22:45 +00:00

Snippets done

This commit is contained in:
Scott Tolksdorf
2016-05-10 22:29:00 -04:00
parent c9bfd08bb3
commit 6f6f5649d4
7 changed files with 171 additions and 209 deletions

View File

@@ -24,7 +24,10 @@ var Editor = React.createClass({
};
},
cursorPosition : null,
cursorPosition : {
line : 0,
ch : 0
},
componentDidMount: function() {
@@ -41,7 +44,6 @@ var Editor = React.createClass({
},
handleSnippetClick : function(injectText){
if(!this.cursorPosition) return;
var lines = this.props.value.split('\n');
lines[this.cursorPosition.line] = splice(lines[this.cursorPosition.line], this.cursorPosition.ch, injectText);