mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-06 20:52:40 +00:00
Reduce variable use
This commit is contained in:
@@ -356,23 +356,19 @@ const CodeEditor = createClass({
|
|||||||
let currentLine = from.line;
|
let currentLine = from.line;
|
||||||
const maxLength = 50;
|
const maxLength = 50;
|
||||||
|
|
||||||
let headerText = '';
|
let foldPreviewText = '';
|
||||||
let otherText = '';
|
|
||||||
while (currentLine <= to.line && text.length <= maxLength) {
|
while (currentLine <= to.line && text.length <= maxLength) {
|
||||||
const currentText = this.codeMirror.getLine(currentLine);
|
const currentText = this.codeMirror.getLine(currentLine);
|
||||||
currentLine++;
|
currentLine++;
|
||||||
if(!currentText) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(currentText[0] == '#'){
|
if(currentText[0] == '#'){
|
||||||
headerText = currentText;
|
foldPreviewText = currentText;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!otherText && currentText != '\n') {
|
if(!foldPreviewText && currentText != '\n') {
|
||||||
otherText = currentText;
|
foldPreviewText = currentText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text = headerText || otherText || `Lines ${from.line+1}-${to.line+1}`;
|
text = foldPreviewText || `Lines ${from.line+1}-${to.line+1}`;
|
||||||
|
|
||||||
text = text.trim();
|
text = text.trim();
|
||||||
if(text.length > maxLength)
|
if(text.length > maxLength)
|
||||||
|
|||||||
Reference in New Issue
Block a user