Skip to content

Commit 6856faf

Browse files
committed
Sublime KeyMaps
1 parent 2ba309b commit 6856faf

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/App.css

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
.op{
2-
height: 300px;;
2+
height: 300px;
33
}
44

55
.CodeMirror{
66
font-family: monospace;
7-
font-size: 21pt;
8-
height: 400px;
9-
/* background-color: #44475a; */
7+
font-size: 18pt;
8+
height: 450px;
109
}
1110

1211
.toggler {

src/components/Hello.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
22

3-
const Hello = props => <h1>{props.code}</h1>;
3+
const Hello = props => <h2>{props.code}</h2>;
44

55
export default Hello;

src/components/XML.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import 'codemirror/addon/edit/matchbrackets'
99
import 'codemirror/addon/edit/closebrackets'
1010
import 'codemirror/theme/dracula.css'
1111

12+
import 'codemirror/keymap/sublime'
13+
1214
import 'codemirror/addon/hint/xml-hint'
1315
import 'codemirror/addon/hint/show-hint'
1416
import 'codemirror/addon/hint/show-hint.css'
@@ -21,13 +23,13 @@ export default class XML extends Component {
2123
super(props);
2224
this.state = {
2325
name: 'CodeMirror',
24-
code: '🌹💕🐱‍🚀 <MODE>: </XML> \n<USE Ctrl+Space>',
26+
code: '<Mode>\n\t<XML/>\n</Mode>\n<AutoComplete>\n\tCtrl+Space\n</AutoComplete>\n<keyBindings>\n\tSublime\n</KeyBindings> ',
2527
viewOpToggle : false,
2628
};
2729
}
2830
autoComplete = cm => {
2931
const codeMirror = this.refs['CodeMirror'].getCodeMirrorInstance();
30-
const tags = {
32+
const customTags = {
3133
'!top': ['add','hello'],
3234
'!attrs': {},
3335
'add': {
@@ -60,7 +62,7 @@ export default class XML extends Component {
6062
};
6163

6264
const hintOptions = {
63-
schemaInfo: tags,
65+
schemaInfo: customTags,
6466
completeSingle: false,
6567
completeOnSingleClick: true,
6668
matchInMiddle: true
@@ -94,6 +96,7 @@ export default class XML extends Component {
9496
matchTags: true,
9597
extraKeys: { "Ctrl-Space": this.autoComplete},
9698
autoCloseBrackets: true,
99+
keyMap: "sublime"
97100
};
98101
return (
99102
<div>

0 commit comments

Comments
 (0)