51
51
52
52
{{ highlight $codeSnippet $language }}
53
53
54
+ < style >
55
+ div .code-toolbar > .toolbar {
56
+ display : none !important ;
57
+ }
58
+ </ style >
59
+
54
60
{{ if $hasFragment }}
55
61
{{ $uniqueId := md5 $path }}
56
62
< div class ="mt-4 pb-2 ">
70
76
< 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; ">
71
77
< h5 style ="margin: 0; "> {{ $path }}</ h5 >
72
78
< 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; ">
74
80
Copy
75
81
</ 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; ">
77
83
Close
78
84
</ button >
79
85
</ div >
@@ -85,6 +91,11 @@ <h5 style="margin: 0;">{{ $path }}</h5>
85
91
</ div >
86
92
87
93
< script >
94
+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
95
+ const toolbars = document . querySelectorAll ( 'div.code-toolbar > .toolbar' ) ;
96
+ toolbars . forEach ( toolbar => toolbar . remove ( ) ) ;
97
+ } ) ;
98
+
88
99
window . showCodeModal = window . showCodeModal || function ( id ) {
89
100
document . getElementById ( 'codeModal_' + id ) . style . display = 'block' ;
90
101
document . body . style . overflow = 'hidden' ;
@@ -97,7 +108,8 @@ <h5 style="margin: 0;">{{ $path }}</h5>
97
108
98
109
window . copyCode = window . copyCode || function ( id , event ) {
99
110
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 ;
101
113
102
114
if ( navigator . clipboard ) {
103
115
navigator . clipboard . writeText ( code ) . then ( ( ) => {
0 commit comments