Resolve navigating cells with arrow keys to close #5196
Showing 2 of 2 files from the diff.
@@ -87,7 +87,7 @@
Loading
87 | 87 | export default class CodeMirrorEditor extends React.Component< |
|
88 | 88 | CodeMirrorEditorProps, |
|
89 | 89 | CodeMirrorEditorState |
|
90 | - | > { |
|
90 | + | > { |
|
91 | 91 | static defaultProps: Partial<CodeMirrorEditorProps> = { |
|
92 | 92 | value: "", |
|
93 | 93 | channels: null, |
@@ -407,7 +407,7 @@
Loading
407 | 407 | this.cm && |
|
408 | 408 | this.props.value !== undefined && |
|
409 | 409 | normalizeLineEndings(this.cm.getValue()) !== |
|
410 | - | normalizeLineEndings(this.props.value) |
|
410 | + | normalizeLineEndings(this.props.value) |
|
411 | 411 | ) { |
|
412 | 412 | if (this.props.preserveScrollPosition) { |
|
413 | 413 | const prevScrollPosition = this.cm.getScrollInfo(); |
@@ -474,10 +474,9 @@
Loading
474 | 474 | goLineDownOrEmit(editor: Editor & Doc): void { |
|
475 | 475 | const cursor: Position = editor.getCursor(); |
|
476 | 476 | const lastLineNumber: number = editor.lastLine(); |
|
477 | - | const lastLine: string = editor.getLine(lastLineNumber); |
|
477 | + | ||
478 | 478 | if ( |
|
479 | 479 | cursor.line === lastLineNumber && |
|
480 | - | cursor.ch === lastLine.length && |
|
481 | 480 | !editor.somethingSelected() |
|
482 | 481 | ) { |
|
483 | 482 | CodeMirror.signal(editor, "bottomBoundary"); |
@@ -528,13 +527,13 @@
Loading
528 | 527 | /> |
|
529 | 528 | {tooltipNode |
|
530 | 529 | ? ReactDOM.createPortal( |
|
531 | - | <Tooltip |
|
532 | - | bundle={bundle} |
|
533 | - | cursorCoords={cursorCoords} |
|
534 | - | deleteTip={this.deleteTip} |
|
535 | - | />, |
|
536 | - | tooltipNode |
|
537 | - | ) |
|
530 | + | <Tooltip |
|
531 | + | bundle={bundle} |
|
532 | + | cursorCoords={cursorCoords} |
|
533 | + | deleteTip={this.deleteTip} |
|
534 | + | />, |
|
535 | + | tooltipNode |
|
536 | + | ) |
|
538 | 537 | : null} |
|
539 | 538 | </React.Fragment> |
|
540 | 539 | ); |
@@ -1,7 +1,8 @@
Loading
1 | - | import { AppState, ContentRef, selectors } from "@nteract/core"; |
|
1 | + | import { AppState, ContentRef, selectors, actions } from "@nteract/core"; |
|
2 | 2 | import CodeMirrorEditor from "@nteract/editor"; |
|
3 | 3 | import { createConfigCollection, createDeprecatedConfigOption, defineConfigOption, HasPrivateConfigurationState } from "@nteract/mythic-configuration"; |
|
4 | 4 | import { connect } from "react-redux"; |
|
5 | + | import { Dispatch } from "redux"; |
|
5 | 6 | ||
6 | 7 | const codeMirrorConfig = createConfigCollection({ |
|
7 | 8 | key: "codeMirror", |
@@ -15,16 +16,16 @@
Loading
15 | 16 | }); |
|
16 | 17 | ||
17 | 18 | const BOOLEAN = [ |
|
18 | - | {label: "Yes", value: true}, |
|
19 | - | {label: "No", value: false}, |
|
19 | + | { label: "Yes", value: true }, |
|
20 | + | { label: "No", value: false }, |
|
20 | 21 | ]; |
|
21 | 22 | ||
22 | 23 | defineConfigOption({ |
|
23 | 24 | label: "Blink Editor Cursor", |
|
24 | 25 | key: "codeMirror.cursorBlinkRate", |
|
25 | 26 | values: [ |
|
26 | - | {label: "Yes", value: 530}, |
|
27 | - | {label: "No", value: 0}, |
|
27 | + | { label: "Yes", value: 530 }, |
|
28 | + | { label: "No", value: 0 }, |
|
28 | 29 | ], |
|
29 | 30 | defaultValue: 0, |
|
30 | 31 | }); |
@@ -61,9 +62,9 @@
Loading
61 | 62 | label: "Tab Size", |
|
62 | 63 | key: "codeMirror.tabSize", |
|
63 | 64 | values: [ |
|
64 | - | {label: "2 Spaces", value: 2}, |
|
65 | - | {label: "3 Spaces", value: 3}, |
|
66 | - | {label: "4 Spaces", value: 4}, |
|
65 | + | { label: "2 Spaces", value: 2 }, |
|
66 | + | { label: "3 Spaces", value: 3 }, |
|
67 | + | { label: "4 Spaces", value: 4 }, |
|
67 | 68 | ], |
|
68 | 69 | defaultValue: 4, |
|
69 | 70 | }); |
@@ -95,6 +96,11 @@
Loading
95 | 96 | editorType: string; |
|
96 | 97 | } |
|
97 | 98 | ||
99 | + | interface DispatchProps { |
|
100 | + | focusAbove: () => void; |
|
101 | + | focusBelow: () => void; |
|
102 | + | } |
|
103 | + | ||
98 | 104 | const makeMapStateToProps = (state: AppState & HasPrivateConfigurationState, ownProps: ComponentProps) => { |
|
99 | 105 | const { id, contentRef } = ownProps; |
|
100 | 106 | const mapStateToProps = (state: AppState & HasPrivateConfigurationState) => { |
@@ -147,4 +153,24 @@
Loading
147 | 153 | return mapStateToProps; |
|
148 | 154 | }; |
|
149 | 155 | ||
150 | - | export default connect(makeMapStateToProps)(CodeMirrorEditor); |
|
156 | + | export const makeMapDispatchToProps = ( |
|
157 | + | initialDispatch: Dispatch, |
|
158 | + | ownProps: ComponentProps |
|
159 | + | ) => { |
|
160 | + | const { id, contentRef } = ownProps; |
|
161 | + | const mapDispatchToProps = (dispatch: Dispatch) => { |
|
162 | + | return { |
|
163 | + | focusBelow: () => { |
|
164 | + | dispatch(actions.focusNextCell({ id, contentRef, createCellIfUndefined: true })); |
|
165 | + | dispatch(actions.focusNextCellEditor({ id, contentRef })); |
|
166 | + | }, |
|
167 | + | focusAbove: () => { |
|
168 | + | dispatch(actions.focusPreviousCell({ id, contentRef })); |
|
169 | + | dispatch(actions.focusPreviousCellEditor({ id, contentRef })); |
|
170 | + | } |
|
171 | + | } |
|
172 | + | }; |
|
173 | + | return mapDispatchToProps; |
|
174 | + | }; |
|
175 | + | ||
176 | + | export default connect(makeMapStateToProps, makeMapDispatchToProps)(CodeMirrorEditor); |
Files | Coverage |
---|---|
applications/desktop/src | 56.57% |
packages | 73.50% |
Project Totals (235 files) | 70.95% |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.