@@ -37,11 +37,7 @@ class CommentsWidget extends WidgetType {
37
37
38
38
toDOM ( view : EditorView ) : HTMLElement {
39
39
const comments = ( view . state . facet ( lineCommentsFacet ) [ 0 ] || [ ] ) [ this . line . number - 1 ] ;
40
-
41
40
const elem = document . createElement ( 'line-comments' ) ;
42
- elem . style . display = 'block' ;
43
- elem . style . backgroundColor = '#009bff80' ;
44
- elem . style . paddingLeft = '1rem' ;
45
41
46
42
if ( comments ?. length ) {
47
43
elem . innerText = `💬 COMMENTS (${ comments ?. length || 0 } ) FOR LINE #${ this . line . number } ` ;
@@ -60,8 +56,8 @@ function lineCommentsDecorations(state: EditorState) {
60
56
Decoration . widget ( {
61
57
widget : new CommentsWidget ( line ) ,
62
58
side : 10 ,
63
- inlineOrder : true ,
64
- block : true ,
59
+ // inlineOrder: true,
60
+ // block: true,
65
61
} ) . range ( line . to ) ,
66
62
) ;
67
63
}
@@ -140,8 +136,25 @@ export function lineComments() {
140
136
} ) ,
141
137
highlightActiveLineGutterRS ( ) ,
142
138
EditorView . baseTheme ( {
139
+ '.cm-line' : {
140
+ '& line-comments' : {
141
+ display : 'block' ,
142
+ backgroundColor : '#009bff80' ,
143
+ paddingLeft : '1rem' ,
144
+ marginRight : '-1rem' ,
145
+
146
+ '& + br' : {
147
+ display : 'none' ,
148
+ } ,
149
+ } ,
150
+
151
+ '& .cm-insertedLine + br' : {
152
+ display : 'none' ,
153
+ } ,
154
+ } ,
155
+
143
156
'.cm-gutters.cm-gutters-rs' : {
144
- backgroundColor : '#ff000070' , // 'transparent',
157
+ backgroundColor : '#ffffff20' , // '# ff000070', // 'transparent',
145
158
146
159
'& .cm-custom-gutter-rs' : {
147
160
minWidth : '24px' ,
@@ -150,14 +163,26 @@ export function lineComments() {
150
163
'& .cm-gutterElement' : {
151
164
cursor : 'pointer' ,
152
165
166
+ '& comments-count' : {
167
+ display : 'block' ,
168
+ backgroundColor : '#ffcd72c0' ,
169
+ borderRadius : '50%' ,
170
+ color : 'black' ,
171
+ transform : 'scale(0.7)' ,
172
+ fontWeight : 'bold' ,
173
+ } ,
174
+
153
175
'& comment-button' : {
154
- opacity : '0.2 ' ,
176
+ opacity : '0.15 ' ,
155
177
} ,
156
178
157
179
'&:hover' : {
158
180
'& comment-button' : {
159
181
opacity : '1' ,
160
182
} ,
183
+ '& comments-count' : {
184
+ backgroundColor : '#ffa500' ,
185
+ } ,
161
186
} ,
162
187
} ,
163
188
} ,
0 commit comments