|
| 1 | +"use strict"; |
| 2 | +var__extends=(this&&this.__extends)||function(d,b){ |
| 3 | +for(varpinb)if(b.hasOwnProperty(p))d[p]=b[p]; |
| 4 | +function__(){this.constructor=d;} |
| 5 | +d.prototype=b===null ?Object.create(b) :(__.prototype=b.prototype,new__()); |
| 6 | +}; |
| 7 | +varReact=require('react'); |
| 8 | +varstyles={ |
| 9 | +editor:{ |
| 10 | +textAlign:'left', |
| 11 | +border:'2px solid red', |
| 12 | +margin:'5px', |
| 13 | +borderRadius:'3px', |
| 14 | +}, |
| 15 | +}; |
| 16 | +varTextEditor=(function(_super){ |
| 17 | +__extends(TextEditor,_super); |
| 18 | +functionTextEditor(){ |
| 19 | +_super.apply(this,arguments); |
| 20 | +} |
| 21 | +TextEditor.prototype.componentDidMount=function(){ |
| 22 | +vared=atom.workspace.buildTextEditor(); |
| 23 | +ed.setGrammar(atom.grammars.grammarForScopeName('source.js')); |
| 24 | +console.log(ed); |
| 25 | +ed.setText('var a = 42;'); |
| 26 | +document.querySelector("#"+this.props.name).appendChild(ed.getElement()); |
| 27 | +}; |
| 28 | +TextEditor.prototype.render=function(){ |
| 29 | +returnReact.createElement("div",{id:this.props.name,style:styles.editor}); |
| 30 | +}; |
| 31 | +returnTextEditor; |
| 32 | +}(React.Component)); |
| 33 | +Object.defineProperty(exports,"__esModule",{value:true}); |
| 34 | +exports.default=TextEditor; |