5151
5252{{ highlight $codeSnippet $language }}
5353
54+ < style >
55+ div .code-toolbar > .toolbar {
56+ display : none !important ;
57+ }
58+ </ style >
59+
5460{{ if $hasFragment }}
5561{{ $uniqueId := md5 $path }}
5662< div class ="mt-4 pb-2 ">
7076 < div style ="position: sticky; top: 0; z-index: 10; background: white; box-shadow: 0 2px 2px rgba(0,0,0,0.1); padding: 10px 15px; border-bottom: 1px solid #dee2e6; display: flex; justify-content: space-between; align-items: center; height: 50px; ">
7177 < h5 style ="margin: 0; "> {{ $path }}</ h5 >
7278 < div >
73- < button onclick ="copyCode('{{ $uniqueId }}', event) " style ="margin-right: 10px; padding: 5px 10px; border: 1px solid #007bff; background: #007bff; color: white; border-radius: 4px; cursor: pointer; ">
79+ < button onclick ="copyCode('{{ $uniqueId }}', event) " style ="margin-right: 10px; padding: 5px 10px; border: 1px solid #007bff; background: #007bff; color: white; border-radius: 4px; cursor: pointer; user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; ">
7480 Copy
7581 </ button >
76- < button onclick ="closeCodeModal('{{ $uniqueId }}') " style ="padding: 5px 10px; border: 1px solid #6c757d; background: #6c757d; color: white; border-radius: 4px; cursor: pointer; ">
82+ < button onclick ="closeCodeModal('{{ $uniqueId }}') " style ="padding: 5px 10px; border: 1px solid #6c757d; background: #6c757d; color: white; border-radius: 4px; cursor: pointer; user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; ">
7783 Close
7884 </ button >
7985 </ div >
@@ -85,6 +91,11 @@ <h5 style="margin: 0;">{{ $path }}</h5>
8591</ div >
8692
8793< script >
94+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
95+ const toolbars = document . querySelectorAll ( 'div.code-toolbar > .toolbar' ) ;
96+ toolbars . forEach ( toolbar => toolbar . remove ( ) ) ;
97+ } ) ;
98+
8899window . showCodeModal = window . showCodeModal || function ( id ) {
89100 document . getElementById ( 'codeModal_' + id ) . style . display = 'block' ;
90101 document . body . style . overflow = 'hidden' ;
@@ -97,7 +108,8 @@ <h5 style="margin: 0;">{{ $path }}</h5>
97108
98109window . copyCode = window . copyCode || function ( id , event ) {
99110 const codeElement = document . getElementById ( 'codeContent_' + id ) ;
100- const code = codeElement . textContent ;
111+ const preElement = codeElement . querySelector ( 'pre' ) ;
112+ const code = preElement ? preElement . textContent : codeElement . textContent ;
101113
102114 if ( navigator . clipboard ) {
103115 navigator . clipboard . writeText ( code ) . then ( ( ) => {
0 commit comments