mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-03 12:42:41 +00:00
Merge pull request #2396 from G-Ambatte/adjustCodeFold-#1907
[Editor] Change folded code text generation
This commit is contained in:
@@ -355,12 +355,20 @@ const CodeEditor = createClass({
|
|||||||
let text = '';
|
let text = '';
|
||||||
let currentLine = from.line;
|
let currentLine = from.line;
|
||||||
const maxLength = 50;
|
const maxLength = 50;
|
||||||
|
|
||||||
|
let foldPreviewText = '';
|
||||||
while (currentLine <= to.line && text.length <= maxLength) {
|
while (currentLine <= to.line && text.length <= maxLength) {
|
||||||
text += this.codeMirror.getLine(currentLine);
|
const currentText = this.codeMirror.getLine(currentLine);
|
||||||
if(currentLine < to.line)
|
currentLine++;
|
||||||
text += ' ';
|
if(currentText[0] == '#'){
|
||||||
currentLine += 1;
|
foldPreviewText = currentText;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!foldPreviewText && currentText != '\n') {
|
||||||
|
foldPreviewText = currentText;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
text = foldPreviewText || `Lines ${from.line+1}-${to.line+1}`;
|
||||||
|
|
||||||
text = text.trim();
|
text = text.trim();
|
||||||
if(text.length > maxLength)
|
if(text.length > maxLength)
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
text-shadow: none;
|
text-shadow: none;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
color: grey;
|
||||||
|
}
|
||||||
|
|
||||||
.sourceMoveFlash .CodeMirror-line{
|
.sourceMoveFlash .CodeMirror-line{
|
||||||
animation-name: sourceMoveAnimation;
|
animation-name: sourceMoveAnimation;
|
||||||
|
|||||||
Reference in New Issue
Block a user