File tree Expand file tree Collapse file tree
rustedwarfareapicode/.vitepress/theme Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ async function init() {
1818
1919 for ( let i = 0 ; i < copyBtnList . length ; i ++ ) {
2020 const btn = copyBtnList [ i ] ;
21- btn . addEventListener ( "click" , ( ) => {
21+ btn . addEventListener ( "touchend" , ( ) => {
22+ alert ( "touchend" ) ;
2223 const parentDiv = btn . parentNode ;
2324 const codeElem = parentDiv . querySelector ( "code" ) ;
2425 const spans = [ ...codeElem . querySelectorAll ( "span" ) ] ;
@@ -27,7 +28,9 @@ async function init() {
2728 ] . join ( "" ) ;
2829
2930 if ( navigator . clipboard ) {
30- navigator . clipboard . writeText ( textToCopy ) ;
31+ navigator . clipboard . writeText ( textToCopy ) . then ( ( ) => {
32+ console . log ( "Text copied to clipboard" ) ;
33+ } ) ;
3134 } else {
3235 const textarea = document . createElement ( "textarea" ) ;
3336 textarea . value = textToCopy ;
You can’t perform that action at this time.
0 commit comments