@@ -37,11 +37,7 @@ class CommentsWidget extends WidgetType {
3737
3838 toDOM ( view : EditorView ) : HTMLElement {
3939 const comments = ( view . state . facet ( lineCommentsFacet ) [ 0 ] || [ ] ) [ this . line . number - 1 ] ;
40-
4140 const elem = document . createElement ( 'line-comments' ) ;
42- elem . style . display = 'block' ;
43- elem . style . backgroundColor = '#009bff80' ;
44- elem . style . paddingLeft = '1rem' ;
4541
4642 if ( comments ?. length ) {
4743 elem . innerText = `💬 COMMENTS (${ comments ?. length || 0 } ) FOR LINE #${ this . line . number } ` ;
@@ -60,8 +56,8 @@ function lineCommentsDecorations(state: EditorState) {
6056 Decoration . widget ( {
6157 widget : new CommentsWidget ( line ) ,
6258 side : 10 ,
63- inlineOrder : true ,
64- block : true ,
59+ // inlineOrder: true,
60+ // block: true,
6561 } ) . range ( line . to ) ,
6662 ) ;
6763 }
@@ -140,8 +136,25 @@ export function lineComments() {
140136 } ) ,
141137 highlightActiveLineGutterRS ( ) ,
142138 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+
143156 '.cm-gutters.cm-gutters-rs' : {
144- backgroundColor : '#ff000070' , // 'transparent',
157+ backgroundColor : '#ffffff20' , // '# ff000070', // 'transparent',
145158
146159 '& .cm-custom-gutter-rs' : {
147160 minWidth : '24px' ,
@@ -150,14 +163,26 @@ export function lineComments() {
150163 '& .cm-gutterElement' : {
151164 cursor : 'pointer' ,
152165
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+
153175 '& comment-button' : {
154- opacity : '0.2 ' ,
176+ opacity : '0.15 ' ,
155177 } ,
156178
157179 '&:hover' : {
158180 '& comment-button' : {
159181 opacity : '1' ,
160182 } ,
183+ '& comments-count' : {
184+ backgroundColor : '#ffa500' ,
185+ } ,
161186 } ,
162187 } ,
163188 } ,
0 commit comments