From ad1e8d50d75e3cdef443de9e3a1efbec334f1366 Mon Sep 17 00:00:00 2001 From: David Bolack Date: Fri, 2 Aug 2024 15:24:14 -0500 Subject: [PATCH] Correct truncation when looking for data: in css folding --- shared/naturalcrit/codeEditor/codeEditor.jsx | 2 +- shared/naturalcrit/codeEditor/fold-css.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index a96feb72..9080379a 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -438,7 +438,7 @@ const CodeEditor = createClass({ // Extra data url chomping // Try to make it pretty... - const startOfData = text.indexOf('data:'); + const startOfData = text.indexOf('data:') > 0 ? text.indexOf('data:') : false; if(startOfData) { text = (startOfData > maxLength) ? `${text.slice(0, text.indexOf(':') + 1)} ... ${text.slice(startOfData, startOfData + 5)} ...` : diff --git a/shared/naturalcrit/codeEditor/fold-css.js b/shared/naturalcrit/codeEditor/fold-css.js index a384d2fc..f21eaef4 100644 --- a/shared/naturalcrit/codeEditor/fold-css.js +++ b/shared/naturalcrit/codeEditor/fold-css.js @@ -29,7 +29,7 @@ module.exports = { // IMPORT FOLDING - const importMatcher = /^@import.*?;/; + const importMatcher = /^@import.*?[;]/; if(activeLine.match(importMatcher)) { return {