Skip to content

Commit

Permalink
Changing command name and adding subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
Samantha Zhang committed Jul 19, 2018
1 parent 7d88da2 commit e7f1d9c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 12 additions & 4 deletions keymaps/code-fold.json
@@ -1,6 +1,14 @@
{
"body": {
"cmd-r": "codefold:foldAll",
"cmd-t": "codefold:unfoldAll"
".platform-darwin .CodeMirror": {
"cmd-r": "codefold:fold-all",
"cmd-t": "codefold:unfold-all"
},
".platform-linux .CodeMirror": {
"ctrl-r": "codefold:fold-all",
"ctrl-t": "codefold:unfold-all"
},
".platform-win32 .CodeMirror": {
"ctrl-r": "codefold:fold-all",
"ctrl-t": "codefold:unfold-all"
}
}
}
7 changes: 4 additions & 3 deletions lib/code-fold.js
Expand Up @@ -8,9 +8,9 @@ module.exports = {

activate() {
global.inkdrop.on('editor:init', this.handleEditorInit.bind(this));
inkdrop.commands.add(document.body, {
'codefold:foldAll': () => this.foldAll(),
'codefold:unfoldAll': () => this.unfoldAll()
this.subscription = inkdrop.commands.add(document.body, {
'codefold:fold-all': () => this.foldAll(),
'codefold:unfold-all': () => this.unfoldAll(),
});
},

Expand All @@ -19,6 +19,7 @@ module.exports = {
if (editor && editor.codeMirror && this.originalGutters) {
editor.codeMirror.setOption('gutters', this.originalGutters);
}
this.subscription.dispose();
},

handleEditorInit(editor) {
Expand Down

0 comments on commit e7f1d9c

Please sign in to comment.