mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 20:23:39 +00:00
Simplify folding logic
This commit is contained in:
@@ -27,29 +27,17 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// IMPORT FOLDING
|
// @import and data-url folding
|
||||||
|
const importMatcher = /^@import.*?;/;
|
||||||
|
const dataURLMatcher = /url\(.*?data\:.*\)/;
|
||||||
|
|
||||||
const importMatcher = /^@import.*?;/;
|
if(activeLine.match(importMatcher) || activeLine.match(dataURLMatcher)) {
|
||||||
|
|
||||||
if(activeLine.match(importMatcher)) {
|
|
||||||
return {
|
return {
|
||||||
from : CodeMirror.Pos(start.line, 0),
|
from : CodeMirror.Pos(start.line, 0),
|
||||||
to : CodeMirror.Pos(start.line, cm.getLine(start.line).length)
|
to : CodeMirror.Pos(start.line, activeLine.length)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// data-url folding FOR CSS.
|
|
||||||
|
|
||||||
const dataURLMatcher = /url\(.*?data\:.*\)/;
|
|
||||||
|
|
||||||
if(activeLine.match(dataURLMatcher)) {
|
|
||||||
return {
|
|
||||||
from : CodeMirror.Pos(start.line, 0),
|
|
||||||
to : CodeMirror.Pos(start.line, cm.getLine(start.line).length)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user