Skip to content

Commit 142b784

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 0ee6f0d + bad067b commit 142b784

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

app/components/Playground/editor.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ function camelize(str) {
1313
});
1414
}
1515

16+
function isCommentFold(line) {
17+
var isAFold = false;
18+
if (/^\s*(\/\*|\/\/)#?region\b/.test(line)) { isAFold = true; }
19+
if (/\/\/(.*)\{/.test(line)) { isAFold = true; }
20+
if(/^\s*(\/\*\*\*).*\*\/\s*$/.test(line)) { isAFold = true; }
21+
return isAFold;
22+
}
23+
1624
const Editor = React.createClass({
1725
propTypes: {
1826
theme: React.PropTypes.string,
@@ -38,7 +46,7 @@ const Editor = React.createClass({
3846
if (foldWidgets[row] == null)
3947
foldWidgets[row] = this.getFoldWidget(row);
4048
if (foldWidgets[row] != "start") continue;
41-
if (!/#region/.test(this.getLine(row))) continue
49+
if (!isCommentFold(this.getLine(row))) continue
4250
var range = this.getFoldWidgetRange(row);
4351
// sometimes range can be incompatible with existing fold
4452
// TODO change addFold to return null istead of throwing
@@ -50,13 +58,10 @@ const Editor = React.createClass({
5058
try {
5159
// addFold can change the range
5260
var fold = this.addFold("...", range);
53-
if (fold)
54-
fold.collapseChildren = depth;
5561
} catch(e) {}
5662
}
5763
}
5864
};
59-
console.log(this.refs.ace.editor.session);
6065
this.refs.ace.editor.session.foldRegion();
6166
},
6267

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-component-styleguide",
3-
"version": "0.0.22",
3+
"version": "0.0.24",
44
"publishConfig": {
55
"registry": "http://registry.npmjs.org/"
66
},
@@ -119,4 +119,4 @@
119119
"standard": "^6.0.8",
120120
"uglify-js": "^2.6.2"
121121
}
122-
}
122+
}

0 commit comments

Comments
 (0)