@@ -6,8 +6,8 @@ import { EnhancerRegistry, TextareaRegistry } from '../lib/registries'
66const enhancers = new EnhancerRegistry ( )
77const enhancedTextareas = new TextareaRegistry ( )
88
9- // Expose for debugging in har:view
10- ; ( window as any ) . gitcassoTextareaRegistry = enhancedTextareas
9+ // Expose for debugging in har:view
10+ ; ( window as any ) . gitcassoTextareaRegistry = enhancedTextareas
1111
1212function sendEventToBackground ( type : 'ENHANCED' | 'DESTROYED' , spot : CommentSpot ) : void {
1313 const message : CommentEvent = {
@@ -88,16 +88,20 @@ function enhanceMaybe(textarea: HTMLTextAreaElement) {
8888 logger . debug ( 'activating textarea {}' , textarea )
8989 injectStyles ( )
9090
91- const enhancedTextarea = enhancers . tryToEnhance ( textarea )
92- if ( enhancedTextarea ) {
93- logger . debug (
94- 'Identified textarea:' ,
95- enhancedTextarea . spot . type ,
96- enhancedTextarea . spot . unique_key ,
97- )
98- enhancedTextareas . register ( enhancedTextarea )
99- } else {
100- logger . debug ( 'No handler found for textarea' )
91+ try {
92+ const enhancedTextarea = enhancers . tryToEnhance ( textarea )
93+ if ( enhancedTextarea ) {
94+ logger . debug (
95+ 'Identified textarea:' ,
96+ enhancedTextarea . spot . type ,
97+ enhancedTextarea . spot . unique_key ,
98+ )
99+ enhancedTextareas . register ( enhancedTextarea )
100+ } else {
101+ logger . debug ( 'No handler found for textarea' )
102+ }
103+ } catch ( e ) {
104+ logger . error ( e )
101105 }
102106}
103107
0 commit comments