File tree Expand file tree Collapse file tree 4 files changed +35
-6
lines changed Expand file tree Collapse file tree 4 files changed +35
-6
lines changed Original file line number Diff line number Diff line change 164164										<input type="checkbox" name="{{$file.GetDiffFileName}}" autocomplete="off"{{if $file.IsViewed}} checked{{end}}> {{ctx.Locale.Tr "repo.pulls.has_viewed_file"}}
165165									</label>
166166								{{end}}
167- 								<div class="ui dropdown basic ">
167+ 								<div class="ui tiny js-btn-diff-file-menu ">
168168									{{svg "octicon-kebab-horizontal" 18 "icon tw-mx-2"}}
169- 									<div class="ui menu ">
169+ 									<div class="tippy-target ">
170170										{{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}}
171- 											<button  class="unescape-button item">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</button >
172- 											<button  class="escape-button tw-hidden item">{{ctx.Locale.Tr "repo.escape_control_characters"}}</button >
171+ 											<a  class="unescape-button item">{{ctx.Locale.Tr "repo.unescape_control_characters"}}</a >
172+ 											<a  class="escape-button tw-hidden item">{{ctx.Locale.Tr "repo.escape_control_characters"}}</a >
173173										{{end}}
174174										{{if and (not $file.IsSubmodule) (not $.PageIsWiki)}}
175175											{{if $file.IsDeleted}}
Original file line number Diff line number Diff line change 11import  $  from  'jquery' ; 
2+ import  { createTippy }  from  '../modules/tippy.ts' ; 
23import  { initCompReactionSelector }  from  './comp/ReactionSelector.ts' ; 
34import  { initRepoIssueContentHistory }  from  './repo-issue-content.ts' ; 
45import  { initDiffFileTree ,  initDiffFileList }  from  './repo-diff-filetree.ts' ; 
@@ -225,3 +226,23 @@ export function initRepoDiffView() {
225226  initViewedCheckboxListenerFor ( ) ; 
226227  initExpandAndCollapseFilesButton ( ) ; 
227228} 
229+ 
230+ export  function  initRepoDiffFileMenu ( )  { 
231+   let  tippyIndex  =  0 ; 
232+   $ ( '.js-btn-diff-file-menu' ) . each ( function  ( )  { 
233+     tippyIndex ++ ; 
234+     this . setAttribute ( 'data-diff-file-menu-tippy-target-id' ,  tippyIndex ) ; 
235+     const  $menu  =  $ ( this ) . find ( '.tippy-target' ) ; 
236+     if  ( $menu . length  <  1 )  return ; 
237+     $menu [ 0 ] . setAttribute ( 'data-diff-file-menu-tippy-id' ,  tippyIndex ) ; 
238+     createTippy ( this ,  { 
239+       content : $menu [ 0 ] , 
240+       role : 'menu' , 
241+       theme : 'menu' , 
242+       trigger : 'click' , 
243+       placement : 'bottom' , 
244+       interactive : true , 
245+       hideOnClick : true , 
246+     } ) ; 
247+   } ) ; 
248+ } 
Original file line number Diff line number Diff line change @@ -7,8 +7,15 @@ export function initUnicodeEscapeButton() {
77
88    e . preventDefault ( ) ; 
99
10-     const  fileContent  =  btn . closest ( '.file-content, .non-diff-file-content' ) ; 
10+     let  fileContent  =  btn . closest ( '.file-content, .non-diff-file-content' ) ; 
11+     if  ( ! fileContent )  { 
12+       const  tippyTarget  =  btn . closest ( '.tippy-target' ) ; 
13+       if  ( tippyTarget )  { 
14+         fileContent  =  document . querySelectorAll ( `[data-diff-file-menu-tippy-target-id="${ tippyTarget . getAttribute ( 'data-diff-file-menu-tippy-id' ) }  "]` ) [ 0 ] . closest ( '.file-content, .non-diff-file-content' ) ; 
15+       } 
16+     } 
1117    const  fileView  =  fileContent ?. querySelectorAll ( '.file-code, .file-view' ) ; 
18+     if  ( ! fileView )  return ; 
1219    if  ( btn . matches ( '.escape-button' ) )  { 
1320      for  ( const  el  of  fileView )  el . classList . add ( 'unicode-escaped' ) ; 
1421      hideElem ( btn ) ; 
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ import {initSshKeyFormParser} from './features/sshkey-helper.ts';
4242import  { initUserSettings }  from  './features/user-settings.ts' ; 
4343import  { initRepoActivityTopAuthorsChart ,  initRepoArchiveLinks }  from  './features/repo-common.ts' ; 
4444import  { initRepoMigrationStatusChecker }  from  './features/repo-migrate.ts' ; 
45- import  { initRepoDiffView }  from  './features/repo-diff.ts' ; 
45+ import  { initRepoDiffView ,   initRepoDiffFileMenu }  from  './features/repo-diff.ts' ; 
4646import  { initOrgTeamSearchRepoBox ,  initOrgTeamSettings }  from  './features/org-team.ts' ; 
4747import  { initUserAuthWebAuthn ,  initUserAuthWebAuthnRegister }  from  './features/user-auth-webauthn.ts' ; 
4848import  { initRepoRelease ,  initRepoReleaseNew }  from  './features/repo-release.ts' ; 
@@ -212,6 +212,7 @@ onDomReady(() => {
212212    initUserAuthWebAuthnRegister , 
213213    initUserSettings , 
214214    initRepoDiffView , 
215+     initRepoDiffFileMenu , 
215216    initPdfViewer , 
216217    initScopedAccessTokenCategories , 
217218    initColorPickers , 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments