@@ -25,7 +25,7 @@ import {
25
25
historyKeymap ,
26
26
indentWithTab ,
27
27
} from "@codemirror/commands" ;
28
- import { syntaxHighlighting } from "@codemirror/language" ;
28
+ import { foldGutter , syntaxHighlighting } from "@codemirror/language" ;
29
29
import {
30
30
theme ,
31
31
textVariants ,
@@ -40,6 +40,7 @@ import {
40
40
FloatingPanel ,
41
41
} from "@webstudio-is/design-system" ;
42
42
import { MaximizeIcon } from "@webstudio-is/icons" ;
43
+ import { ChevronDownIcon , ChevronRightIcon } from "@webstudio-is/icons/svg" ;
43
44
import { solarizedLight } from "./code-highlight" ;
44
45
45
46
// This undocumented flag is required to keep contenteditable fields editable after the first activation of EditorView.
@@ -121,6 +122,10 @@ const editorContentStyle = css({
121
122
textDecoration : "underline wavy red" ,
122
123
backgroundColor : "rgba(255, 0, 0, 0.1)" ,
123
124
} ,
125
+ ".cm-gutters" : {
126
+ backgroundColor : "transparent" ,
127
+ border : 0 ,
128
+ } ,
124
129
} ) ;
125
130
126
131
const shortcutStyle = css ( {
@@ -188,6 +193,17 @@ const keyBindings = [
188
193
indentWithTab ,
189
194
] ;
190
195
196
+ export const foldGutterExtension = foldGutter ( {
197
+ markerDOM : ( isOpen ) => {
198
+ const div = document . createElement ( "div" ) ;
199
+ div . style . width = "16px" ;
200
+ div . style . height = "16px" ;
201
+ div . style . cursor = "pointer" ;
202
+ div . innerHTML = isOpen ? ChevronDownIcon : ChevronRightIcon ;
203
+ return div ;
204
+ } ,
205
+ } ) ;
206
+
191
207
export type EditorApi = {
192
208
replaceSelection : ( string : string ) => void ;
193
209
focus : ( ) => void ;
0 commit comments