@@ -10,10 +10,15 @@ const enhancedTextareas = new TextareaRegistry()
1010; ( window as any ) . gitcassoTextareaRegistry = enhancedTextareas
1111
1212function detectLocation ( ) : StrippedLocation {
13- return {
13+ if ( ( window as any ) . gitcassoMockLocation ) {
14+ return ( window as any ) . gitcassoMockLocation
15+ }
16+ const result = {
1417 host : window . location . host ,
1518 pathname : window . location . pathname ,
1619 }
20+ logger . debug ( '[gitcasso] detectLocation called, returning:' , result )
21+ return result
1722}
1823
1924function sendEventToBackground ( type : 'ENHANCED' | 'DESTROYED' , spot : CommentSpot ) : void {
@@ -33,6 +38,7 @@ enhancedTextareas.setEventHandlers(
3338
3439export default defineContentScript ( {
3540 main ( ) {
41+ logger . debug ( 'Main was called' )
3642 const textAreasOnPageLoad = document . querySelectorAll < HTMLTextAreaElement > ( `textarea` )
3743 for ( const textarea of textAreasOnPageLoad ) {
3844 enhanceMaybe ( textarea )
@@ -42,7 +48,7 @@ export default defineContentScript({
4248 childList : true ,
4349 subtree : true ,
4450 } )
45- logger . debug ( 'Extension loaded with' , enhancers . getEnhancerCount , 'handlers' )
51+ logger . debug ( 'Extension loaded with' , enhancers . getEnhancerCount ( ) , 'handlers' )
4652 } ,
4753 matches : [ '<all_urls>' ] ,
4854 runAt : 'document_end' ,
@@ -87,6 +93,7 @@ function handleMutations(mutations: MutationRecord[]): void {
8793}
8894
8995function enhanceMaybe ( textarea : HTMLTextAreaElement ) {
96+ logger . debug ( '[gitcasso] enhanceMaybe called for textarea:' , textarea . id , textarea . className )
9097 if ( enhancedTextareas . get ( textarea ) ) {
9198 logger . debug ( 'textarea already registered {}' , textarea )
9299 return
@@ -96,7 +103,9 @@ function enhanceMaybe(textarea: HTMLTextAreaElement) {
96103 injectStyles ( )
97104
98105 try {
99- const enhancedTextarea = enhancers . tryToEnhance ( textarea , detectLocation ( ) )
106+ const location = detectLocation ( )
107+ logger . debug ( '[gitcasso] Calling tryToEnhance with location:' , location )
108+ const enhancedTextarea = enhancers . tryToEnhance ( textarea , location )
100109 if ( enhancedTextarea ) {
101110 logger . debug (
102111 'Identified textarea:' ,
0 commit comments