File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
browser-extension/src/playgrounds Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import OverType from "../overtype/overtype" ;
2+
3+ export function githubPrNewCommentContentScript ( ) {
4+ if ( window . location . hostname !== "github.com" ) {
5+ return ;
6+ }
7+
8+ const ghCommentBox = document . getElementById (
9+ "new_comment_field"
10+ ) as HTMLTextAreaElement | null ;
11+ if ( ghCommentBox ) {
12+ const overtypeContainer = modifyDOM ( ghCommentBox ) ;
13+ new OverType ( overtypeContainer , {
14+ placeholder : "Add your comment here..." ,
15+ autoResize : true ,
16+ minHeight : "102px" ,
17+ padding : "var(--base-size-8)" ,
18+ } ) ;
19+ }
20+ }
21+
22+ function modifyDOM ( overtypeInput : HTMLTextAreaElement ) : HTMLElement {
23+ overtypeInput . classList . add ( "overtype-input" ) ;
24+ const overtypePreview = document . createElement ( "div" ) ;
25+ overtypePreview . classList . add ( "overtype-preview" ) ;
26+ overtypeInput . insertAdjacentElement ( "afterend" , overtypePreview ) ;
27+ const overtypeWrapper = overtypeInput . parentElement ! . closest ( "div" ) ! ;
28+ overtypeWrapper . classList . add ( "overtype-wrapper" ) ;
29+ overtypeInput . placeholder = "Add your comment here..." ;
30+ const overtypeContainer = overtypeWrapper . parentElement ! . closest ( "div" ) ! ;
31+ overtypeContainer . classList . add ( "overtype-container" ) ;
32+ return overtypeContainer . parentElement ! . closest ( "div" ) ! ;
33+ }
You can’t perform that action at this time.
0 commit comments