Skip to content

Commit b7108e7

Browse files
committed
fix for atom 1.6
1 parent 47470eb commit b7108e7

File tree

9 files changed

+19
-17
lines changed

9 files changed

+19
-17
lines changed

lib/atom/editor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ exports.setAtomGlobals = setAtomGlobals;
1313
var getEditorCount = 0;
1414
function save() {
1515
var editor = findEditor();
16-
console.log(editor);
1716
editor.save();
1817
}
1918
exports.save = save;
2019
function findEditor() {
2120
var editor = atom.workspace.getActiveTextEditor();
21+
var max = 1000;
2222
if (!editor) {
2323
getEditorCount += 1;
2424
setTimeout(function () {
2525
return findEditor();
2626
}, 10);
2727
}
28-
else if (getEditorCount > 1000) {
28+
else if (getEditorCount > max) {
2929
console.log('Failed to find active editor');
30-
return undefined;
30+
return null;
3131
}
3232
else {
3333
getEditorCount = 0;

lib/atom/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ var Main = (function () {
1616
}
1717
Main.prototype.activate = function () {
1818
atom.workspace.addRightPanel({
19-
item: this.root
19+
item: this.root,
20+
priority: 0
2021
});
2122
subscriptions_1.onActivateSubscriptions();
2223
render_1.render(this.root);

lib/components/app/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ var default_1 = (function (_super) {
2626
}
2727
default_1.prototype.render = function () {
2828
var state = this.props.state;
29-
return (React.createElement("section", {className: 'cr', key: 'main'}, React.createElement(_components_1.Menu, {route: state.route, position: state.position}), React.createElement(_components_1.Router, {state: state}), React.createElement(_components_1.Alert, {alert: state.alert})));
29+
var height = atom.getCurrentWindow().getBounds().height;
30+
return (React.createElement("section", {className: 'cr', key: 'main', style: { height: height }}, React.createElement(_components_1.Menu, {route: state.route, position: state.position}), React.createElement(_components_1.Router, {state: state, ref: 'route'}), React.createElement(_components_1.Alert, {alert: state.alert})));
3031
};
3132
default_1 = __decorate([
3233
ThemeDecorator(ThemeManager.getMuiTheme(theme_1.default)),

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"react": "0.14.7",
4444
"react-dom": "0.14.7",
4545
"react-redux": "4.4.0",
46+
"react-scrollbar": "^0.4.0",
4647
"react-tap-event-plugin": "0.2.2",
4748
"redux": "3.3.1"
4849
},

src/atom/editor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,27 @@ let getEditorCount = 0;
1313

1414
export function save() {
1515
const editor = findEditor();
16-
console.log(editor);
1716
editor.save();
1817
}
1918

20-
export function findEditor() {
19+
export function findEditor(): AtomCore.IEditor {
2120
let editor = atom.workspace.getActiveTextEditor();
21+
const max = 1000;
2222
if (!editor) {
2323
getEditorCount += 1;
2424
setTimeout(function() {
2525
return findEditor();
2626
}, 10);
27-
} else if (getEditorCount > 1000) {
27+
} else if (getEditorCount > max) {
2828
console.log('Failed to find active editor');
29-
return undefined;
29+
return null;
3030
} else {
3131
getEditorCount = 0;
3232
return editor;
3333
}
3434
}
3535

36-
export function getEditor() {
36+
export function getEditor(): Promise<AtomCore.IEditor> {
3737
return new Promise((resolve, reject) => {
3838
resolve(findEditor());
3939
});

src/atom/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class Main {
2121
activate(): void {
2222
// create atom panel
2323
atom.workspace.addRightPanel({
24-
item: this.root
24+
item: this.root,
25+
priority: 0
2526
});
2627
onActivateSubscriptions();
2728
// render React component

src/components/_index.less

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
@import './start/_start';
99

1010
#crv {
11-
min-height: 600px;
12-
height: 100%;
1311
position: relative;
1412
overflow-y: scroll;
1513
}

src/components/app/app.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ import Theme from '../theme/theme';
1212
export default class extends React.Component<{state?: CR.State}, {}> {
1313
render(): React.ReactElement<{}> {
1414
const state = this.props.state;
15+
const height = atom.getCurrentWindow().getBounds().height;
1516
return (
16-
<section className='cr' key='main'>
17+
<section className='cr' key='main' style={{height}}>
1718
<Menu route={state.route} position={state.position} />
18-
<Router state={state} />
19+
<Router state={state} ref='route' />
1920
<Alert alert={state.alert} />
2021
</section>
22+
2123
);
2224
}
2325
};

styles/styles.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ atom-panel-container > atom-panel > #crv {
158158
padding: 10px;
159159
}
160160
#crv {
161-
min-height: 600px;
162-
height: 100%;
163161
position: relative;
164162
overflow-y: scroll;
165163
}

0 commit comments

Comments
 (0)