File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,12 +95,20 @@ html {
9595
9696# share-url {
9797 flex : 1 ;
98+ min-width : 0 ;
9899 padding : 6px 8px ;
99100 font-size : 12px ;
100101 border : 1px solid # ccc;
101102 border-radius : 3px ;
102103}
103104
105+ # copy-url-btn {
106+ padding : 6px 10px ;
107+ font-size : 12px ;
108+ cursor : pointer;
109+ white-space : nowrap;
110+ }
111+
104112. no-functions {
105113 padding : 20px ;
106114 color : # 856404;
Original file line number Diff line number Diff line change 2020 < div class ="share-block ">
2121 < label > Share URL:</ label >
2222 < input type ="text " id ="share-url " readonly />
23+ < button id ="copy-url-btn " title ="Copy to clipboard "> Copy</ button >
2324 </ div >
2425 < div id ="editor "> </ div >
2526 < div class ="button-bar ">
Original file line number Diff line number Diff line change @@ -210,6 +210,14 @@ function setupResizableGutter() {
210210
211211window . addEventListener ( "DOMContentLoaded" , ( ) => {
212212 document . getElementById ( "execute-btn" ) . addEventListener ( "click" , executeCode ) ;
213+ document . getElementById ( "copy-url-btn" ) . addEventListener ( "click" , ( ) => {
214+ const url = document . getElementById ( "share-url" ) . value ;
215+ navigator . clipboard . writeText ( url ) . then ( ( ) => {
216+ const btn = document . getElementById ( "copy-url-btn" ) ;
217+ btn . textContent = "Copied!" ;
218+ setTimeout ( ( ) => { btn . textContent = "Copy" ; } , 1500 ) ;
219+ } ) ;
220+ } ) ;
213221 setupResizableGutter ( ) ;
214222 initWorker ( ) ;
215223} ) ;
You can’t perform that action at this time.
0 commit comments