Skip to content

Commit 8f077cb

Browse files
author
Ives van Hoorne
committed
Change highlight syntax
1 parent e459a36 commit 8f077cb

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/app/components/sandbox/CodeEditor/CodeMirror.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ const highlightLines = (
205205
highlightedLines: Array<string>
206206
) => {
207207
highlightedLines.forEach(line => {
208-
cm.addLineClass(+line, 'background', 'cm-line-highlight');
208+
cm.addLineClass(+line - 1, 'background', 'cm-line-highlight');
209209
});
210210
};
211211

src/common/url.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@ export const getSandboxOptions = (url: string) => {
2020
}
2121

2222
const highlightMatch = url.match(/(\?|&)(highlights)=([^&]+)/);
23-
if (highlightMatch) {
24-
const lineHighlightsMatch = highlightMatch[3].match(/{(.*)}/);
25-
26-
if (lineHighlightsMatch) {
27-
result.highlightedLines = lineHighlightsMatch[1].split(',');
28-
}
23+
if (highlightMatch && highlightMatch[3]) {
24+
result.highlightedLines = highlightMatch[3].split(',');
2925
}
3026

3127
const editorSizeMatch = url.match(/(\?|&)(editorsize)=([^&]+)/);

0 commit comments

Comments
 (0)