0
0
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:
Trevor Buckner
2024-08-08 17:48:32 -04:00
parent 643af98ca3
commit 31352e417f

View File

@@ -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;
}); });
} }