@@ -10,7 +10,7 @@ import { seedTextViewContext } from "./seed-context";
10
10
import { addAppListener , SeedState } from "./redux/seed-store" ;
11
11
import { initText , setText , TextState } from "./redux/textsSlice" ;
12
12
import { initTextView , setText as setTextViewText , scrolledTo , fetchAnnotationsPerSegment } from "./redux/textViewsSlice" ;
13
- import { annotationSelected } from './redux/annotationsSlice' ;
13
+ import { annotationSelected , annotationsPassedBy } from './redux/annotationsSlice' ;
14
14
import { selectAnnotationsAtSegmentThunk , passByAnnotationsAtSegmentThunk } from "./redux/selectAnnotations" ;
15
15
import { CSSDefinition } from './redux/cssTypes' ;
16
16
import { scrolled , syncOthers } from './redux/synopsisSlice' ;
@@ -121,16 +121,34 @@ export class SeedTextView extends windowMixin(storeConsumerMixin(LitElement)) {
121
121
this . store ?. dispatch ( addAppListener ( {
122
122
actionCreator : annotationSelected ,
123
123
effect : ( _action , listenerApi ) : void => {
124
- // reset highlightning of priviously selected annotation
124
+ // reset highlighting of previously selected annotation
125
125
if ( this . annotationSelected ) {
126
126
this . colorizeAnnotation ( listenerApi . getState ( ) , this . annotationSelected , { "border" : "none" } ) ;
127
127
}
128
128
// highlight currently selected annotation
129
129
this . annotationSelected = listenerApi . getState ( ) . annotations . annotationSelected ?? "unknown" ;
130
+ // TODO: make CSS configurable
130
131
this . colorizeAnnotation ( listenerApi . getState ( ) , this . annotationSelected , { "border" : "1px solid red" } ) ;
131
132
}
132
133
} ) ) ;
133
134
135
+ this . store ?. dispatch ( addAppListener ( {
136
+ actionCreator : annotationsPassedBy ,
137
+ effect : ( _action , listenerApi ) : void => {
138
+ // reset highlighting of previously transient annotations:
139
+ // general annotation highlighting and transient
140
+ // highlighting are bound to the same visual category,
141
+ // so we can use the general highlighting for a reset
142
+ this . colorizeText ( listenerApi . getState ( ) . textViews [ this . id ] . cssPerSegment ) ;
143
+ // highlight transient annotations
144
+ const annotIds : Array < string > = listenerApi . getState ( ) . annotations . annotationsTransient ;
145
+ annotIds . forEach ( annotId => {
146
+ // TODO: make CSS configurable
147
+ this . colorizeAnnotation ( listenerApi . getState ( ) , annotId , { "background-color" : "silver" } ) ;
148
+ } ) ;
149
+ }
150
+ } ) ) ;
151
+
134
152
// this.storeUnsubscribeListeners.push(subsc);
135
153
}
136
154
0 commit comments