From e1f8a47553043745f86ef332ed9c50149e2d1101 Mon Sep 17 00:00:00 2001 From: paoloredis Date: Mon, 12 May 2025 11:31:54 +0200 Subject: [PATCH 1/4] Add copy to clipboard for code snippets --- assets/css/index.css | 21 +++++++++++++++ layouts/partials/scripts.html | 50 ++++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/assets/css/index.css b/assets/css/index.css index 951cc11b38..ddfacb6699 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -1073,4 +1073,25 @@ a[href*="#no-click"], img[src*="#no-click"] { .dd-item .highlight:hover { color: #5961ff; +} + +.copy-button { + background-color: #eee; + border: none; + padding: 4px; + cursor: pointer; + border-radius: 4px; + display: flex; + align-items: center; + justify-content: center; +} + +.copy-button svg { + width: 16px; + height: 16px; + fill: #333; +} + +.copy-button:hover { + background-color: #ddd; } \ No newline at end of file diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index a82336776b..90504229e2 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -1,5 +1,53 @@ - + + + + + From 5acef9761bd7d7ed11f3a47b623769710a8b4f85 Mon Sep 17 00:00:00 2001 From: paoloredis Date: Wed, 14 May 2025 15:35:24 +0200 Subject: [PATCH 4/4] Increase right padding if scrollbar is present --- layouts/partials/scripts.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 3b47b2b0e8..caaee46967 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -7,8 +7,12 @@ document.querySelectorAll('div.highlight').forEach(block => { // Create a wrapper for the button and message const wrapper = document.createElement('div'); - wrapper.style = 'position:absolute;top:10px;right:10px;z-index:1;display:flex;align-items:center;gap:6px;'; + if (block.parentElement.classList.contains("expand-content")) { + wrapper.style = 'position:absolute;top:10px;right:20px;z-index:1;display:flex;align-items:center;gap:6px;'; + } else { + wrapper.style = 'position:absolute;top:10px;right:10px;z-index:1;display:flex;align-items:center;gap:6px;'; + } // Create the copy button const button = document.createElement('button'); button.innerHTML = `