mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-12-02 19:40:35 +08:00
explorer: Make command text selectable
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user