Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit291c27c

Browse files
committed
clean code
1 parentc63f1d2 commit291c27c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎web_src/js/features/repo-code.ts‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ function showLineButton() {
8181
el.remove();
8282
}
8383

84-
// Find first active row and add button
85-
constactiveRows=document.querySelectorAll('.code-view tr.active');
86-
if(activeRows.length===0)return;
84+
// find active row and add button
85+
consttr=document.querySelector('.code-view tr.active');
86+
if(!tr)return;
87+
88+
consttd=tr.querySelector('td.lines-num');
8789

88-
constfirstActiveRow=activeRows[0];
89-
consttd=firstActiveRow.querySelector('td.lines-num');
9090
constbtn=document.createElement('button');
9191
btn.classList.add('code-line-button','ui','basic','button');
9292
btn.innerHTML=svg('octicon-kebab-horizontal');
@@ -97,28 +97,28 @@ function showLineButton() {
9797

9898
createTippy(btn,{
9999
theme:'menu',
100-
trigger:'manual',// Use manual trigger
100+
trigger:'click',
101+
hideOnClick:true,
101102
content:menu,
102103
placement:'right-start',
103104
interactive:true,
104-
appendTo:()=>document.body,
105+
onShow:(tippy)=>{
106+
tippy.popper.addEventListener('click',()=>{
107+
tippy.hide();
108+
},{once:true});
109+
},
105110
});
106111

107112
// Handle menu button click manually
108113
btn.addEventListener('click',(e)=>{
109114
e.stopPropagation();
110115
consttippyInstance=btn._tippy;
111-
if(tippyInstance?.state.isVisible){
116+
if(tippyInstance?.state.isShown){
112117
tippyInstance.hide();
113118
}elseif(tippyInstance){
114119
tippyInstance.show();
115120
}
116121
});
117-
118-
// Hide menu when clicking menu items
119-
menu.addEventListener('click',()=>{
120-
btn._tippy?.hide();
121-
});
122122
}
123123

124124
exportfunctioninitRepoCodeView(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp