explorer: Make command text selectable

This commit is contained in:
Daniel Norman
2026-11-30 12:08:38 +01:00
parent fe6257df45
commit 98d32231fc
+13 -17
View File
@@ -4,8 +4,6 @@
export let command: string;
export let fullWidth: boolean = false;
export let showPrompt: boolean = true;
let clipboard: Clipboard;
</script>
<style>
@@ -13,7 +11,6 @@
display: flex;
}
.cmd {
cursor: pointer;
height: 2.5rem;
border-radius: var(--border-radius-sm);
display: flex;
@@ -24,13 +21,21 @@
border: 1px solid var(--color-border-alpha-subtle);
color: var(--color-text-secondary);
background-color: var(--color-surface-alpha-mid);
user-select: none;
overflow: hidden;
}
.cmd:hover {
border: 1px solid var(--color-border-mid);
color: var(--color-text-primary);
}
.text {
white-space: nowrap;
overflow-x: auto;
scrollbar-width: none;
}
.prompt {
margin-right: 1ch;
user-select: none;
}
.clipboard {
display: flex;
align-items: center;
@@ -49,21 +54,12 @@
</style>
<div class="wrapper" class:full-width={fullWidth}>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div
role="button"
tabindex="0"
class="cmd"
class:full-width={fullWidth}
on:click={() => {
clipboard.copy();
}}>
<div class="txt-overflow">
{#if showPrompt}${/if}
{command}
<div class="cmd" class:full-width={fullWidth}>
<div class="text">
{#if showPrompt}<span class="prompt">$</span>{/if}{command}
</div>
<div class="clipboard">
<Clipboard bind:this={clipboard} text={command} />
<Clipboard text={command} />
</div>
</div>
</div>