@@ -7,29 +7,32 @@ LSI.on("entityCreate", (region) => {
77 if ( window . BULK_REGIONS ) return ;
88
99 window . BULK_REGIONS = true ;
10- setTimeout ( ( ) => ( window . BULK_REGIONS = false ) , 1000 ) ;
10+ setTimeout ( ( ) => {
11+ window . BULK_REGIONS = false ;
12+ } , 1000 ) ;
1113
1214 setTimeout ( ( ) => {
1315 // Find all the text regions matching the selection
14- region . object . _value
15- . matchAll ( new RegExp ( region . text , "gi" ) )
16- . forEach ( ( m ) => {
17- if ( m . index === region . startOffset ) return ;
16+ const matches = Array . from (
17+ region . object . _value . matchAll ( new RegExp ( region . text , "gi" ) ) ,
18+ ) ;
19+ for ( const m of matches ) {
20+ if ( m . index === region . startOffset ) continue ;
1821
19- // Include them in the results as new selections
20- Htx . annotationStore . selected . createResult (
21- {
22- text : region . text ,
23- start : "/span[1]/text()[1]" ,
24- startOffset : m . index ,
25- end : "/span[1]/text()[1]" ,
26- endOffset : m . index + region . text . length ,
27- } ,
28- { labels : [ ...region . labeling . value . labels ] } ,
29- region . labeling . from_name ,
30- region . object ,
31- ) ;
32- } ) ;
22+ // Include them in the results as new selections
23+ Htx . annotationStore . selected . createResult (
24+ {
25+ text : region . text ,
26+ start : "/span[1]/text()[1]" ,
27+ startOffset : m . index ,
28+ end : "/span[1]/text()[1]" ,
29+ endOffset : m . index + region . text . length ,
30+ } ,
31+ { labels : [ ...region . labeling . value . labels ] } ,
32+ region . labeling . from_name ,
33+ region . object ,
34+ ) ;
35+ }
3336 Htx . annotationStore . selected . updateObjects ( ) ;
3437 } , 100 ) ;
3538} ) ;
0 commit comments