mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +00:00
Add data: URL folding for CSS.
Regex might need tweaking to catch all cases, but it catches the basics.
This commit is contained in:
@@ -433,9 +433,17 @@ const CodeEditor = createClass({
|
||||
}
|
||||
text = foldPreviewText || `Lines ${from.line+1}-${to.line+1}`;
|
||||
|
||||
|
||||
text = text.replace('{', '').trim();
|
||||
|
||||
// Extra data url chomping
|
||||
console.log(text);
|
||||
text = text.indexOf('data:') > -1 ? `${text.slice(0, text.indexOf('data:') + 5)} ...` : text;
|
||||
console.log(text);
|
||||
|
||||
if(text.length > maxLength)
|
||||
text = `${text.substr(0, maxLength)}...`;
|
||||
text = `${text.slice(0, maxLength)}...`;
|
||||
|
||||
|
||||
return `\u21A4 ${text} \u21A6`;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,18 @@ module.exports = {
|
||||
};
|
||||
}
|
||||
|
||||
// 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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user