File tree 6 files changed +68
-1
lines changed
6 files changed +68
-1
lines changed Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+ var __extends = ( this && this . __extends ) || function ( d , b ) {
3
+ for ( var p in b ) 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
+ var React = require ( 'react' ) ;
8
+ var styles = {
9
+ editor : {
10
+ textAlign : 'left' ,
11
+ border : '2px solid red' ,
12
+ margin : '5px' ,
13
+ borderRadius : '3px' ,
14
+ } ,
15
+ } ;
16
+ var TextEditor = ( function ( _super ) {
17
+ __extends ( TextEditor , _super ) ;
18
+ function TextEditor ( ) {
19
+ _super . apply ( this , arguments ) ;
20
+ }
21
+ TextEditor . prototype . componentDidMount = function ( ) {
22
+ var ed = 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
+ return React . createElement ( "div" , { id : this . props . name , style : styles . editor } ) ;
30
+ } ;
31
+ return TextEditor ;
32
+ } ( React . Component ) ) ;
33
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
34
+ exports . default = TextEditor ;
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ var Start_1 = require('./Start');
16
16
exports . Start = Start_1 . default ;
17
17
var Tutorials_1 = require ( './Tutorials' ) ;
18
18
exports . Tutorials = Tutorials_1 . default ;
19
+ var TextEditor_1 = require ( './TextEditor' ) ;
20
+ exports . TextEditor = TextEditor_1 . default ;
19
21
var RouteButton_1 = require ( './common/RouteButton' ) ;
20
22
exports . RouteButton = RouteButton_1 . default ;
21
23
var ContentCard_1 = require ( './common/ContentCard' ) ;
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export default class Start extends React.Component<{
18
18
} , { } > {
19
19
render ( ) {
20
20
const { ready} = this . props ;
21
+
21
22
return (
22
23
< section className = 'cr-start' >
23
24
< div style = { headerStyles } >
Original file line number Diff line number Diff line change
1
+ import * as React from 'react' ;
2
+
3
+ const styles = {
4
+ editor : {
5
+ textAlign : 'left' ,
6
+ border : '2px solid red' ,
7
+ margin : '5px' ,
8
+ borderRadius : '3px' ,
9
+ } ,
10
+ } ;
11
+
12
+ export default class TextEditor extends React . Component < {
13
+ name : string
14
+ } , { } > {
15
+ componentDidMount ( ) {
16
+ const ed = atom . workspace . buildTextEditor ( ) ;
17
+ ed . setGrammar (
18
+ atom . grammars . grammarForScopeName ( 'source.js' )
19
+ ) ;
20
+ console . log ( ed ) ;
21
+ // ed.style.textAlign = 'left';
22
+ ed . setText ( 'var a = 42;' ) ;
23
+ document . querySelector ( `#${ this . props . name } ` ) . appendChild ( ed . getElement ( ) ) ;
24
+ }
25
+ render ( ) {
26
+ return < div id = { this . props . name } style = { styles . editor } /> ;
27
+ }
28
+ }
Original file line number Diff line number Diff line change 1
1
export {
2
- Alert , Markdown
2
+ Alert , Markdown
3
3
} from 'core-coderoad' ;
4
4
5
5
export { default as AppMenu } from './AppMenu' ;
@@ -9,6 +9,7 @@ export {default as Progress} from './Progress';
9
9
export { default as Routes } from './Routes' ;
10
10
export { default as Start } from './Start' ;
11
11
export { default as Tutorials } from './Tutorials' ;
12
+ export { default as TextEditor } from './TextEditor' ;
12
13
13
14
export { default as RouteButton } from './common/RouteButton' ;
14
15
export { default as ContentCard } from './common/ContentCard' ;
Original file line number Diff line number Diff line change 120
120
" src/components/Start/Checks/VerifyButton.tsx" ,
121
121
" src/components/Start/index.tsx" ,
122
122
" src/components/Start/Welcome/index.tsx" ,
123
+ " src/components/TextEditor/index.tsx" ,
123
124
" src/components/Tutorials/index.tsx" ,
124
125
" src/components/Tutorials/LoadTutorials/index.tsx" ,
125
126
" src/components/Tutorials/SelectTutorial/index.tsx" ,
You can’t perform that action at this time.
0 commit comments