Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5176afd

Browse files
committed
use redux diff-logger
1 parent50656aa commit5176afd

File tree

14 files changed

+340
-17
lines changed

14 files changed

+340
-17
lines changed

‎lib/options/configureStore.js‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎lib/options/configureStore.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
"atom-plugin-command-line":"1.0.2",
3333
"coderoad-cli":"0.10.0",
3434
"marked":"0.3.6",
35-
"material-ui":"0.15.4",
35+
"material-ui":"0.16.0",
3636
"node-file-exists":"1.1.0",
3737
"react":"15.3.2",
3838
"react-dom":"15.3.2",
3939
"react-redux":"4.4.5",
4040
"react-router-sans-urls":"0.1.2",
4141
"react-tap-event-plugin":"1.0.0",
4242
"redux":"3.6.0",
43-
"redux-logger":"2.6.1",
43+
"redux-logger":"2.7.0",
4444
"redux-thunk":"2.1.0",
4545
"reselect":"2.5.4"
4646
},
@@ -49,8 +49,8 @@
4949
"electron-chromedriver":"^1.4.0",
5050
"eslint":"^3.6.1",
5151
"eslint-plugin-react":"^6.3.0",
52-
"jest":"^15.1.1",
53-
"jest-cli":"^15.1.1",
52+
"jest":"^16.0.1",
53+
"jest-cli":"^16.0.1",
5454
"react-addons-test-utils":"15.3.2",
5555
"react-test-renderer":"15.3.2",
5656
"redux-mock-store":"^1.2.1",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
importRadiumfrom'radium';
2+
import*asReactfrom'react';
3+
4+
import{Markdown}from'../index';
5+
import{Card,CardHeader,CardText}from'material-ui/Card';
6+
7+
conststyles={
8+
card:{
9+
margin:'5px',
10+
},
11+
};
12+
13+
@Radium()
14+
constContentCard:React.StatelessComponent<{
15+
title:string,content?:string
16+
}>=({title, content})=>(
17+
<Cardstyle={styles.card}>
18+
{title ?<CardHeadertitle={title}/> :null}
19+
<CardText>
20+
<Markdownchildren={content||''}/>
21+
</CardText>
22+
</Card>
23+
);
24+
exportdefaultContentCard;
25+
26+
// ContentCard.propTypes = {
27+
// title: React.PropTypes.string,
28+
// content: React.PropTypes.string.optional,
29+
// };
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import*asReactfrom'react';
2+
3+
importhighlightfrom'./syntax-highlighter';
4+
5+
constCodeBlock:React.StatelessComponent<{
6+
children:string,style?:React.CSSProperties,lang:string
7+
}>=({style, children, lang})=>(
8+
<pre>
9+
<code
10+
style={style ?style :{}}
11+
dangerouslySetInnerHTML={{__html:highlight(children,lang)}}
12+
/>
13+
</pre>
14+
);
15+
exportdefaultCodeBlock;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import*asmarkedfrom'marked';
2+
3+
importhighlightfrom'./syntax-highlighter';
4+
5+
constoptions={
6+
breaks:true,
7+
gfm:true,
8+
highlight,
9+
tables:true,
10+
sanitize:true,
11+
smartLists:true,
12+
};
13+
14+
exportdefaultfunction(text:string):string{
15+
returntypeoftext!=='string' ?'' :marked(text.toString(),options);
16+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import*asReactfrom'react';
2+
3+
importformatTextfrom'./formatText';
4+
5+
constMarkdown:React.StatelessComponent<{
6+
children:string,style?:React.CSSProperties
7+
}>=({style, children})=>(
8+
<span
9+
className='cr-markdown'
10+
style={style ?style :{}}
11+
dangerouslySetInnerHTML={{__html:formatText(children)}}
12+
/>
13+
);
14+
exportdefaultMarkdown;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import{editor}from'../../../index';
2+
3+
exportdefaultfunctionhighlight(text:string,lang:string):string{
4+
constscopeName=`source.${lang}`;
5+
// get grammar
6+
constgrammar=editor.grammar.getFromScope(scopeName);
7+
// no grammar, return text
8+
if(!grammar){
9+
returntext;
10+
}
11+
// get tokens
12+
constlineTokens=editor.grammar.tokenizeLines(grammar,text);
13+
if(lineTokens.length>0){
14+
constlastLineTokens=lineTokens[lineTokens.length-1];
15+
if(lastLineTokens.length===1&&lastLineTokens[0].value===''){
16+
lineTokens.pop();
17+
}
18+
}
19+
lethtml='<pre class="editor editor-colors">';
20+
21+
lineTokens.forEach(line=>{
22+
html+='<div class="line">';
23+
line.forEach(({value, scopes})=>{
24+
// account for spaces
25+
if(!value){
26+
value=' ';
27+
}
28+
// wrap text with class spans
29+
scopes.forEach(scope=>{
30+
html+=`<span class="${scope.replace(/\./g,' ')}">`;
31+
});
32+
// text
33+
html+=`${value}`;
34+
// closing tags
35+
scopes.forEach(scope=>{
36+
html+='</span>';
37+
});
38+
});
39+
});
40+
html+='</div></pre>';
41+
returnhtml;
42+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import*asReactfrom'react';
2+
import{connect}from'react-redux';
3+
4+
import{routeSet}from'../../actions';
5+
importRaisedButtonfrom'material-ui/RaisedButton';
6+
7+
classRouteButtonextendsReact.Component<{
8+
label:string,route:string,routeSet:any,style:React.CSSProperties
9+
},{}>{
10+
publicrender(){
11+
const{label, route, style, routeSet}=this.props;
12+
return(
13+
<RaisedButton
14+
label={label}
15+
style={style||{}}
16+
onTouchTap={routeSet.bind(this,route)}
17+
secondary={true}
18+
/>
19+
);
20+
}
21+
}
22+
23+
// RouteButton.propTypes = {
24+
// label: React.PropTypes.string,
25+
// route: React.PropTypes.string,
26+
// routeSet: React.PropTypes.func.optional,
27+
// style: React.PropTypes.object.optional,
28+
// };
29+
30+
constmapStateToProps=(state,props)=>({
31+
label:props.label,
32+
route:props.route,
33+
style:props.style||{}
34+
});
35+
constmapDispatchToProps={routeSet};
36+
37+
exportdefaultconnect(mapStateToProps,mapDispatchToProps)(RouteButton);
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import*asReactfrom'react';
2+
3+
interfaceIStyles{
4+
editor:React.CSSProperties;
5+
};
6+
7+
conststyles:IStyles={
8+
editor:{
9+
textAlign:'left',
10+
},
11+
};
12+
13+
exportdefaultclassTextEditorextendsReact.Component<{
14+
name:string,text?:string,lang:string,onSave?:()=>any,
15+
placeholder?:string,
16+
},{}>{
17+
18+
// create a new TextEditor
19+
publiced=atom.workspace.buildTextEditor();
20+
publicget():string{
21+
returnthis.ed.getText();
22+
}
23+
publicrender(){
24+
return<divid={this.props.name}style={styles.editor}/>;
25+
}
26+
privatecomponentDidMount(){
27+
const{name, text, lang, placeholder}=this.props;
28+
// specify language
29+
this.ed.setGrammar(
30+
atom.grammars.grammarForScopeName(`source.${lang}`)
31+
);
32+
if(text){
33+
this.ed.setText(text||'');
34+
}
35+
if(placeholder){
36+
this.ed.setPlaceholderText(placeholder);
37+
}
38+
// append editor to rendered div
39+
document.querySelector(`#${name}`).appendChild(this.ed.getElement());
40+
}
41+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp