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

Commite9b224e

Browse files
committed
window module, various fixes
1 parent3f197cf commite9b224e

File tree

24 files changed

+75
-104
lines changed

24 files changed

+75
-104
lines changed

‎lib/actions/_types.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ exports.HINT_POSITION_SET = 'HINT_POSITION_SET';
66
exports.PAGE_SET='PAGE_SET';
77
exports.PROGRESS_LOAD='PROGRESS_LOAD';
88
exports.PROGRESS_PAGE_POSITION_LOAD='PROGRESS_PAGE_POSITION_LOAD';
9-
exports.QUIT='QUIT';
109
exports.ROUTE_SET='ROUTE_SET';
1110
exports.TEST_SAVE='TEST_SAVE';
1211
exports.SETUP_PACKAGE='SETUP_PACKAGE';
@@ -17,4 +16,3 @@ exports.TEST_RUN = 'TEST_RUN';
1716
exports.TUTORIAL_SET='TUTORIAL_SET';
1817
exports.TUTORIAL_UPDATE='TUTORIAL_UPDATE';
1918
exports.TUTORIALS_FIND='TUTORIALS_FIND';
20-
exports.WINDOW_TOGGLE='WINDOW_TOGGLE';

‎lib/actions/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,4 @@ exports.tutorialsFind = tutorial_1.tutorialsFind;
2828
exports.tutorialSet=tutorial_1.tutorialSet;
2929
exports.tutorialUpdate=tutorial_1.tutorialUpdate;
3030
vartoggle_1=require('./toggle');
31-
exports.windowToggle=toggle_1.windowToggle;
3231
exports.devToolsToggle=toggle_1.devToolsToggle;
33-
exports.quit=toggle_1.quit;

‎lib/actions/toggle.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
"use strict";
22
var_types_1=require('./_types');
3-
functionwindowToggle(){
4-
return{type:_types_1.WINDOW_TOGGLE};
5-
}
6-
exports.windowToggle=windowToggle;
73
functiondevToolsToggle(){
84
return{type:_types_1.DEVTOOLS_TOGGLE};
95
}
106
exports.devToolsToggle=devToolsToggle;
11-
functionquit(){
12-
return{type:_types_1.QUIT};
13-
}
14-
exports.quit=quit;

‎lib/atom/subscriptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var subscriptions = null;
77
functiononActivate(){
88
subscriptions=newCompositeDisposable;
99
subscriptions.add(atom.commands.add('atom-workspace',{
10-
'cr-viewer:toggle':function(){returnstore_1.default.dispatch(actions_1.windowToggle());}
10+
'cr-viewer:toggle':function(){returnstore_1.default.dispatch({type:'WINDOW_TOGGLE'});}
1111
}));
1212
atom.workspace.observeTextEditors(function(editor){
1313
subscriptions.add(editor.onDidSave(function(){

‎lib/components/AppMenu/Quit/index.js

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,11 @@
11
"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-
var__decorate=(this&&this.__decorate)||function(decorators,target,key,desc){
8-
varc=arguments.length,r=c<3 ?target :desc===null ?desc=Object.getOwnPropertyDescriptor(target,key) :desc,d;
9-
if(typeofReflect==="object"&&typeofReflect.decorate==="function")r=Reflect.decorate(decorators,target,key,desc);
10-
elsefor(vari=decorators.length-1;i>=0;i--)if(d=decorators[i])r=(c<3 ?d(r) :c>3 ?d(target,key,r) :d(target,key))||r;
11-
returnc>3&&r&&Object.defineProperty(target,key,r),r;
12-
};
13-
var__metadata=(this&&this.__metadata)||function(k,v){
14-
if(typeofReflect==="object"&&typeofReflect.metadata==="function")returnReflect.metadata(k,v);
15-
};
162
varReact=require('react');
17-
varreact_redux_1=require('react-redux');
18-
varactions_1=require('../../../actions');
193
varMenuItem_1=require('material-ui/MenuItem');
4+
varsubscriptions_1=require('../../../atom/subscriptions');
205
varstyles={
216
textAlign:'center',
227
padding:'0px 2px',
238
};
24-
varQuit=(function(_super){
25-
__extends(Quit,_super);
26-
functionQuit(){
27-
_super.apply(this,arguments);
28-
}
29-
Quit.prototype.render=function(){
30-
return(React.createElement(MenuItem_1.default,{style:styles,key:'quit',onClick:this.props.quit},"quit"));
31-
};
32-
Quit=__decorate([
33-
react_redux_1.connect(null,function(dispatch){
34-
return{
35-
quit:function(){returndispatch(actions_1.quit());}
36-
};
37-
}),
38-
__metadata('design:paramtypes',[])
39-
],Quit);
40-
returnQuit;
41-
}(React.Component));
9+
varQuit=function(){return(React.createElement(MenuItem_1.default,{style:styles,key:'quit',onClick:subscriptions_1.onDeactivate},"quit"));};
4210
Object.defineProperty(exports,"__esModule",{value:true});
4311
exports.default=Quit;

‎lib/modules/alert/Alert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var Alert = (function (_super) {
3333
Alert.prototype.render=function(){
3434
var_a=this.props,alert=_a.alert,close=_a.close;
3535
varaction=alert.action,message=alert.message,open=alert.open,duration=alert.duration,color=alert.color;
36-
return(React.createElement(Snackbar_1.default,{style:styles,bodyStyle:{color:color},open:open,message:message||'',action:action||'',autoHideDuration:duration||2000,onRequestClose:close}));
36+
return(React.createElement(Snackbar_1.default,{style:styles,bodyStyle:{color:color},open:open,message:message||'',action:action||'',autoHideDuration:duration||2000,onActionTouchTap:close,onRequestClose:close}));
3737
};
3838
Alert=__decorate([
3939
react_redux_1.connect(null,function(dispatch){

‎lib/modules/window/actions.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"use strict";
2+
vartypes_1=require('./types');
3+
functionwindowToggle(){
4+
return{type:types_1.WINDOW_TOGGLE};
5+
}
6+
exports.windowToggle=windowToggle;

‎lib/modules/window/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
varreducer_1=require('./reducer');
3+
exports.reducer=reducer_1.default;
4+
varactions_1=require('./actions');
5+
exports.windowToggle=actions_1.windowToggle;

‎lib/modules/window/reducer.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use strict";
2+
vartypes_1=require('./types');
3+
functionwindowToggle(open,action){
4+
if(open===void0){open=false;}
5+
switch(action.type){
6+
casetypes_1.WINDOW_TOGGLE:
7+
return!open;
8+
default:
9+
returnopen;
10+
}
11+
}
12+
Object.defineProperty(exports,"__esModule",{value:true});
13+
exports.default=windowToggle;

‎lib/modules/window/types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"use strict";
2+
exports.WINDOW_TOGGLE='WINDOW_TOGGLE';

‎lib/reducers/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use strict";
22
varredux_1=require('redux');
33
varalert_1=require('../modules/alert');
4+
varwindow_1=require('../modules/window');
45
varchecks_1=require('./checks');
56
vardevTools_toggle_1=require('./devTools-toggle');
67
vardir_1=require('./dir');
@@ -17,11 +18,10 @@ var task_tests_1 = require('./task-tests');
1718
vartest_run_1=require('./test-run');
1819
vartutorial_1=require('./tutorial');
1920
vartutorial_list_1=require('./tutorial-list');
20-
varwindow_toggle_1=require('./window-toggle');
2121
Object.defineProperty(exports,"__esModule",{value:true});
2222
exports.default=redux_1.combineReducers({
2323
alert:alert_1.reducer,checks:checks_1.default,devToolsToggle:devTools_toggle_1.default,dir:dir_1.default,hintPosition:hint_position_1.default,
2424
packageJson:package_json_1.default,page:page_1.default,pagePosition:page_position_1.default,progress:progress_1.default,route:route_1.default,tasks:tasks_1.default,
2525
tutorial:tutorial_1.default,tutorialList:tutorial_list_1.default,
26-
taskActions:task_actions_1.default,taskPosition:task_position_1.default,taskTests:task_tests_1.default,testRun:test_run_1.default,windowToggle:window_toggle_1.default
26+
taskActions:task_actions_1.default,taskPosition:task_position_1.default,taskTests:task_tests_1.default,testRun:test_run_1.default,windowToggle:window_1.reducer
2727
});

‎src/actions/_types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export const HINT_POSITION_SET = 'HINT_POSITION_SET';
55
exportconstPAGE_SET='PAGE_SET';
66
exportconstPROGRESS_LOAD='PROGRESS_LOAD';
77
exportconstPROGRESS_PAGE_POSITION_LOAD='PROGRESS_PAGE_POSITION_LOAD';
8-
exportconstQUIT='QUIT';
98
exportconstROUTE_SET='ROUTE_SET';
109
exportconstTEST_SAVE='TEST_SAVE';
1110
exportconstSETUP_PACKAGE='SETUP_PACKAGE';
@@ -16,4 +15,3 @@ export const TEST_RUN = 'TEST_RUN';
1615
exportconstTUTORIAL_SET='TUTORIAL_SET';
1716
exportconstTUTORIAL_UPDATE='TUTORIAL_UPDATE';
1817
exportconstTUTORIALS_FIND='TUTORIALS_FIND';
19-
exportconstWINDOW_TOGGLE='WINDOW_TOGGLE';

‎src/actions/toggle.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
import{WINDOW_TOGGLE,DEVTOOLS_TOGGLE,QUIT}from'./_types';
2-
3-
exportfunctionwindowToggle():Action{
4-
return{type:WINDOW_TOGGLE};
5-
}
1+
import{DEVTOOLS_TOGGLE}from'./_types';
62

73
exportfunctiondevToolsToggle():Action{
84
return{type:DEVTOOLS_TOGGLE};
95
}
10-
11-
exportfunctionquit():Action{
12-
return{type:QUIT};
13-
}

‎src/atom/subscriptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
constCompositeDisposable=require('atom').CompositeDisposable;
22
importstorefrom'../store';
3-
import{testRun,alertReplay,windowToggle}from'../actions';
3+
import{testRun,alertReplay}from'../actions';
44
importRootfrom'../components/root';
55

66
letsubscriptions=null;
@@ -11,7 +11,7 @@ export function onActivate(): AtomCore.Disposable {
1111

1212
subscriptions.add(
1313
atom.commands.add('atom-workspace',{
14-
'cr-viewer:toggle':()=>store.dispatch(windowToggle())
14+
'cr-viewer:toggle':()=>store.dispatch({type:'WINDOW_TOGGLE'})
1515
})
1616
);
1717

‎src/components/AppMenu/Quit/index.tsx

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,20 @@ import * as React from 'react';
22
import{connect}from'react-redux';
33
import{quit}from'../../../actions';
44
importMenuItemfrom'material-ui/MenuItem';
5+
import{onDeactivate}from'../../../atom/subscriptions';
56

67
conststyles={
78
textAlign:'center',
89
padding:'0px 2px',
910
};
1011

11-
@connect(null,(dispatch)=>{
12-
return{
13-
quit:()=>dispatch(quit())
14-
};
15-
})
16-
exportdefaultclassQuitextendsReact.Component<{
17-
quit?:any
18-
},{}>{
19-
render(){
20-
return(
21-
<MenuItem
22-
style={styles}
23-
key='quit'
24-
onClick={this.props.quit}
25-
>
26-
quit
27-
</MenuItem>
28-
);
29-
}
30-
}
12+
constQuit=()=>(
13+
<MenuItem
14+
style={styles}
15+
key='quit'
16+
onClick={onDeactivate}
17+
>
18+
quit
19+
</MenuItem>
20+
);
21+
exportdefaultQuit;

‎src/components/AppMenu/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react';
22
importAppBarfrom'material-ui/AppBar';
33
importCloseWindowfrom'./CloseWindow';
44
importmenuRightfrom'./menuRight';
5+
import{onDeactivate}from'../../atom/subscriptions';
56

67
conststyles={
78
zIndex:'1 !important'

‎src/modules/alert/Alert.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default class Alert extends React.Component<{
3232
message={message||''}
3333
action={action||''}
3434
autoHideDuration={duration||2000}
35+
onActionTouchTap={close}
3536
onRequestClose={close}
3637
/>
3738
);

‎src/modules/window/actions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import{WINDOW_TOGGLE}from'./types';
2+
3+
exportfunctionwindowToggle():Action{
4+
return{type:WINDOW_TOGGLE};
5+
}

‎src/modules/window/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export{defaultasreducer}from'./reducer';
2+
export{windowToggle}from'./actions';

‎src/modules/window/reducer.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import{WINDOW_TOGGLE}from'./types';
2+
3+
exportdefaultfunctionwindowToggle(
4+
open=false,action:Action
5+
):boolean{
6+
switch(action.type){
7+
8+
caseWINDOW_TOGGLE:
9+
return!open;
10+
11+
default:
12+
returnopen;
13+
}
14+
}

‎src/modules/window/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exportconstWINDOW_TOGGLE='WINDOW_TOGGLE';

‎src/reducers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import{combineReducers}from'redux';
22

33
import{reducerasalert}from'../modules/alert';
4+
import{reduceraswindowToggle}from'../modules/window';
45
importchecksfrom'./checks';
56
importdevToolsTogglefrom'./devTools-toggle';
67
importdirfrom'./dir';
@@ -17,7 +18,6 @@ import taskTests from './task-tests';
1718
importtestRunfrom'./test-run';
1819
importtutorialfrom'./tutorial';
1920
importtutorialListfrom'./tutorial-list';
20-
importwindowTogglefrom'./window-toggle';
2121

2222
exportdefaultcombineReducers({
2323
alert, checks, devToolsToggle, dir, hintPosition,

‎src/reducers/window-toggle/index.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
"src/modules/alert/index.ts",
8080
"src/modules/alert/reducer.ts",
8181
"src/modules/alert/types.ts",
82+
"src/modules/window/actions.ts",
83+
"src/modules/window/index.ts",
84+
"src/modules/window/reducer.ts",
85+
"src/modules/window/types.ts",
8286
"src/reducers/checks/action-setup.ts",
8387
"src/reducers/checks/action-system.ts",
8488
"src/reducers/checks/check-system.ts",
@@ -112,7 +116,6 @@
112116
"src/reducers/tutorial/config-paths.ts",
113117
"src/reducers/tutorial/index.ts",
114118
"src/reducers/tutorial/tutorial-config.ts",
115-
"src/reducers/window-toggle/index.ts",
116119
"src/services/command-line.ts",
117120
"src/services/exists.ts",
118121
"src/services/polyfills.ts",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp