From 9ff54b193aee4f4d6b25e513d150ca8a2d4bc701 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Mon, 22 Nov 2021 11:53:48 +0000 Subject: [PATCH] Merge pull request #5836 from overleaf/jk-cm-code-folding-again [web] Add code folding to CodeMirror 6 GitOrigin-RevId: b6dcc5dbdda2676debeb986bd738b6dd1232fd5a --- .../web/frontend/js/features/outline/outline-parser.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/outline/outline-parser.js b/services/web/frontend/js/features/outline/outline-parser.js index 239ac3c48c..c2ca223ca6 100644 --- a/services/web/frontend/js/features/outline/outline-parser.js +++ b/services/web/frontend/js/features/outline/outline-parser.js @@ -34,6 +34,11 @@ const MATCHER = new RegExp( function matchOutline(content) { const lines = content.split('\n') + const flatOutline = matchOutlineFromLines(lines) + return flatOutline +} + +function matchOutlineFromLines(lines) { const flatOutline = [] lines.forEach((line, lineId) => { const match = line.match(MATCHER) @@ -125,4 +130,4 @@ function nestOutline(flatOutline) { return nestedOutlines } -export { matchOutline, nestOutline } +export { matchOutline, matchOutlineFromLines, nestOutline }