11import OverType , { type OverTypeInstance } from "overtype"
2- import type React from "react"
3- import type {
4- CommentEnhancer ,
5- CommentSpot ,
6- StrippedLocation ,
2+ import {
3+ CommentEnhancerNoDraftHistory ,
4+ type CommentSpot ,
5+ DRAFT_STORAGE_UNSUPPORTED ,
6+ type StrippedLocation ,
77} from "@/lib/enhancer"
8- import { logger } from "@/lib/logger"
98import { fixupOvertype , modifyDOM } from "../overtype-misc"
109import {
1110 commonGitHubOptions ,
@@ -22,7 +21,7 @@ export interface GitHubEditSpot extends CommentSpot {
2221 type : typeof GH_EDIT
2322}
2423
25- export class GitHubEditEnhancer implements CommentEnhancer < GitHubEditSpot > {
24+ export class GitHubEditEnhancer extends CommentEnhancerNoDraftHistory < GitHubEditSpot > {
2625 forSpotTypes ( ) : string [ ] {
2726 return [ GH_EDIT ]
2827 }
@@ -44,15 +43,10 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
4443 if ( itemId ) {
4544 // Exclude textareas within Shared-module__CommentBox (those are for adding new comments, not editing)
4645 if ( ! isInProjectCommentBox ( textarea ) ) {
47- const unique_key = `github.com:project-draft:${ itemId } :edit-body`
48- logger . debug (
49- `${ this . constructor . name } enhanced project draft body textarea` ,
50- unique_key
51- )
5246 return {
5347 isIssue : true ,
5448 type : GH_EDIT ,
55- unique_key,
49+ unique_key : DRAFT_STORAGE_UNSUPPORTED ,
5650 }
5751 }
5852 }
@@ -63,15 +57,10 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
6357 // Edit mode: empty placeholder
6458 // Add new comment mode: has placeholder "Add your comment here..." or similar
6559 if ( ! textarea . placeholder || textarea . placeholder . trim ( ) === "" ) {
66- const unique_key = `github.com:${ issueInfo . slug } :${ issueInfo . number } :edit-comment`
67- logger . debug (
68- `${ this . constructor . name } enhanced project issue comment edit textarea` ,
69- unique_key
70- )
7160 return {
7261 isIssue : true ,
7362 type : GH_EDIT ,
74- unique_key,
63+ unique_key : DRAFT_STORAGE_UNSUPPORTED ,
7564 }
7665 }
7766 }
@@ -86,9 +75,6 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
8675 if ( ! match ) {
8776 return null
8877 }
89- const [ , owner , repo , numberStr ] = match
90- const number = parseInt ( numberStr ! , 10 )
91- const unique_key = `github.com:${ owner } /${ repo } :${ number } :edit-body`
9278
9379 // Only enhance textareas that are for editing issue/PR body
9480 const isIssueBodyRootEdit = textarea . closest ( ".react-issue-body" )
@@ -102,15 +88,10 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
10288 if ( ! isIssueBodyRootEdit && ! isIssueBodyCommentEdit && ! isPRBodyEdit ) {
10389 return null
10490 }
105-
106- logger . debug (
107- `${ this . constructor . name } enhanced issue/PR body textarea` ,
108- unique_key
109- )
11091 return {
11192 isIssue : ! ! ( isIssueBodyRootEdit || isIssueBodyCommentEdit ) ,
11293 type : GH_EDIT ,
113- unique_key,
94+ unique_key : DRAFT_STORAGE_UNSUPPORTED ,
11495 }
11596 }
11697
@@ -128,12 +109,4 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
128109 )
129110 return overtype
130111 }
131-
132- tableUpperDecoration ( _spot : GitHubEditSpot ) : React . ReactNode {
133- return < span > N/A</ span >
134- }
135-
136- tableTitle ( _spot : GitHubEditSpot ) : string {
137- return "N/A"
138- }
139112}
0 commit comments