Skip to content

Commit ab04a16

Browse files
committed
make copy and close visible even when scrolled [deploy site]
1 parent 799081f commit ab04a16

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

website_and_docs/layouts/shortcodes/gh-codeblock.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868
<div id="codeModal_{{ $uniqueId }}" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1050;">
6969
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; border-radius: 8px; max-width: 90%; max-height: 90%; overflow: auto; box-shadow: 0 4px 20px rgba(0,0,0,0.3);">
70-
<div style="padding: 20px; border-bottom: 1px solid #dee2e6; display: flex; justify-content: space-between; align-items: center;">
70+
<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;">
7171
<h5 style="margin: 0;">{{ $path }}</h5>
7272
<div>
7373
<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;">
@@ -98,7 +98,7 @@ <h5 style="margin: 0;">{{ $path }}</h5>
9898
window.copyCode = window.copyCode || function(id, event) {
9999
const codeElement = document.getElementById('codeContent_' + id);
100100
const code = codeElement.textContent;
101-
101+
102102
if (navigator.clipboard) {
103103
navigator.clipboard.writeText(code).then(() => {
104104
const btn = event.target;
@@ -119,7 +119,7 @@ <h5 style="margin: 0;">{{ $path }}</h5>
119119
textArea.select();
120120
document.execCommand('copy');
121121
document.body.removeChild(textArea);
122-
122+
123123
const btn = event.target;
124124
const originalText = btn.textContent;
125125
btn.textContent = 'Copied!';

0 commit comments

Comments
 (0)