custom select all only for the code
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m2s
Publish Docker Image / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 57s

This commit is contained in:
Lee 2024-06-01 18:25:46 +01:00
parent 3c4f5089ef
commit 4a2d3d4fb7

@ -30,5 +30,24 @@
</button> </button>
</div> </div>
</body> </body>
<script>hljs.highlightAll();</script> <script>
// Highlight the code block
hljs.highlightAll();
// Custom select all behavior to select all the content inside the <pre> block
document.addEventListener('keydown', function(event) {
if (event.ctrlKey && event.key === 'a') {
event.preventDefault(); // Prevent the default select all behavior
// Select all the content inside the <pre> block
const preBlock = document.querySelector('pre');
const range = document.createRange();
range.selectNodeContents(preBlock);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
});
</script>
</html> </html>