feat: add config btn and modal to view and copy config (#2289)

* add view config btn and modal

* show loading state

* add note about keyboard
This commit is contained in:
Bernd Storath
2025-11-18 11:36:46 +01:00
committed by GitHub
parent 5c97a8ba73
commit 4e4bfc75e3
5 changed files with 125 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
<template>
<div class="overflow-x-auto rounded border-2 border-red-800 py-2">
<pre
class="mx-2 inline-block"
@click="selectCode"
><code ref="codeBlock">{{ code }}</code></pre>
</div>
</template>
<script setup lang="ts">
defineProps<{
code: string;
}>();
const codeBlock = useTemplateRef('codeBlock');
function selectCode() {
// TODO: keyboard support?
if (codeBlock.value) {
const range = document.createRange();
range.selectNodeContents(codeBlock.value);
const sel = window.getSelection();
if (sel) {
sel.removeAllRanges();
sel.addRange(range);
}
}
}
</script>