mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-05 21:02:43 +00:00
Merge branch 'code-folding' into codemirror-tweaks
# Conflicts: # shared/naturalcrit/codeEditor/codeEditor.jsx
This commit is contained in:
@@ -92,8 +92,6 @@ const CodeEditor = createClass({
|
|||||||
'Cmd-M' : this.makeSpan,
|
'Cmd-M' : this.makeSpan,
|
||||||
'Ctrl-/' : this.makeComment,
|
'Ctrl-/' : this.makeComment,
|
||||||
'Cmd-/' : this.makeComment,
|
'Cmd-/' : this.makeComment,
|
||||||
'Ctrl-\\' : this.toggleCodeFolded,
|
|
||||||
'Cmd-\\' : this.toggleCodeFolded,
|
|
||||||
'Ctrl-[' : this.foldAllCode,
|
'Ctrl-[' : this.foldAllCode,
|
||||||
'Cmd-[' : this.foldAllCode,
|
'Cmd-[' : this.foldAllCode,
|
||||||
'Ctrl-]' : this.unfoldAllCode,
|
'Ctrl-]' : this.unfoldAllCode,
|
||||||
@@ -171,10 +169,6 @@ const CodeEditor = createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleCodeFolded : function() {
|
|
||||||
this.codeMirror.foldCode(this.codeMirror.getCursor());
|
|
||||||
},
|
|
||||||
|
|
||||||
foldAllCode : function() {
|
foldAllCode : function() {
|
||||||
this.codeMirror.execCommand('foldAll');
|
this.codeMirror.execCommand('foldAll');
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,13 +6,12 @@ module.exports = {
|
|||||||
|
|
||||||
if(start.line === cm.firstLine() || prevLine.match(matcher)) {
|
if(start.line === cm.firstLine() || prevLine.match(matcher)) {
|
||||||
const lastLineNo = cm.lastLine();
|
const lastLineNo = cm.lastLine();
|
||||||
let end = start.line, nextLine = cm.getLine(start.line + 1);
|
let end = start.line;
|
||||||
|
|
||||||
while (end < lastLineNo) {
|
while (end < lastLineNo) {
|
||||||
if(nextLine.match(matcher))
|
if(cm.getLine(end + 1).match(matcher))
|
||||||
break;
|
break;
|
||||||
++end;
|
++end;
|
||||||
nextLine = cm.getLine(end + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -24,4 +23,4 @@ module.exports = {
|
|||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user