File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed
Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ export class HandlerRegistry {
2727 identifyTextarea ( textarea : HTMLTextAreaElement ) : TextareaInfo < any > | null {
2828 for ( const handler of this . handlers ) {
2929 try {
30- const result = handler . identifyContextOf ( textarea ) ;
31- if ( result ) {
32- return result ;
30+ const context = handler . identifyContextOf ( textarea ) ;
31+ if ( context ) {
32+ return { element : textarea , context } ;
3333 }
3434 } catch ( error ) {
3535 console . warn ( 'Handler failed to identify textarea:' , error ) ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export interface TextareaHandler<T extends CommentContext = CommentContext> {
1313 // Handler metadata
1414 forCommentTypes ( ) : string [ ] ;
1515 // whenever a new `textarea` is added to any webpage, this method is called to try to find a handler for it
16- identifyContextOf ( textarea : HTMLTextAreaElement ) : TextareaInfo | null ;
16+ identifyContextOf ( textarea : HTMLTextAreaElement ) : T | null ;
1717
1818 // Popup functionality helpers
1919 generateDisplayTitle ( context : T ) : string ;
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export class GitHubHandler implements TextareaHandler<GitHubContext> {
3030 ] ;
3131 }
3232
33- identifyContextOf ( textarea : HTMLTextAreaElement ) : TextareaInfo < GitHubContext > | null {
33+ identifyContextOf ( textarea : HTMLTextAreaElement ) : GitHubContext | null {
3434 // Only handle GitHub domains
3535 if ( ! window . location . hostname . includes ( 'github' ) ) {
3636 return null ;
@@ -102,7 +102,7 @@ export class GitHubHandler implements TextareaHandler<GitHubContext> {
102102 commentId : commentId || undefined
103103 } ;
104104
105- return { element : textarea , context } ;
105+ return context ;
106106 }
107107
108108 generateDisplayTitle ( context : GitHubContext ) : string {
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export class RedditHandler implements TextareaHandler<RedditContext> {
2121 ] ;
2222 }
2323
24- identifyContextOf ( textarea : HTMLTextAreaElement ) : TextareaInfo < RedditContext > | null {
24+ identifyContextOf ( textarea : HTMLTextAreaElement ) : RedditContext | null {
2525 // Only handle Reddit domains
2626 if ( ! window . location . hostname . includes ( 'reddit' ) ) {
2727 return null ;
@@ -87,7 +87,7 @@ export class RedditHandler implements TextareaHandler<RedditContext> {
8787 commentId : commentId || undefined
8888 } ;
8989
90- return { element : textarea , context } ;
90+ return context ;
9191 }
9292
9393 generateDisplayTitle ( context : RedditContext ) : string {
You can’t perform that action at this time.
0 commit comments