add getAllFolds
This commit is contained in:
parent
a37f9562e3
commit
829c24c780
1 changed files with 23 additions and 0 deletions
|
|
@ -113,6 +113,29 @@ function Folding() {
|
|||
}
|
||||
return foundFolds;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns all folds in the document
|
||||
*/
|
||||
this.getAllFolds = function() {
|
||||
var folds = [];
|
||||
var foldLines = this.$foldData;
|
||||
|
||||
function addFold(fold) {
|
||||
folds.push(fold);
|
||||
if (!fold.subFolds)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < fold.subFolds.length; i++)
|
||||
addFold(fold.subFolds[i]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < foldLines.length; i++)
|
||||
for (var j = 0; j < foldLines[i].folds.length; j++)
|
||||
addFold(foldLines[i].folds[j]);
|
||||
|
||||
return folds;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the string between folds at the given position.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue