fix: double-paste bug, show actual yt-dlp errors in UI
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -33,32 +33,40 @@
|
||||
function handlePaste(e: ClipboardEvent) {
|
||||
const text = e.clipboardData?.getData('text')?.trim();
|
||||
if (text && (text.startsWith('http://') || text.startsWith('https://'))) {
|
||||
e.preventDefault();
|
||||
inputValue = text;
|
||||
setTimeout(handleSubmit, 50);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="url-input">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Paste a video URL and press Enter…"
|
||||
bind:value={inputValue}
|
||||
onkeydown={handleKeydown}
|
||||
onpaste={handlePaste}
|
||||
disabled={session.status === 'resolving'}
|
||||
/>
|
||||
{#if session.status === 'resolving'}
|
||||
<span class="spinner">⏳</span>
|
||||
{/if}
|
||||
<div class="url-input-wrapper">
|
||||
<div class="url-input">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Paste a video URL and press Enter…"
|
||||
bind:value={inputValue}
|
||||
onkeydown={handleKeydown}
|
||||
onpaste={handlePaste}
|
||||
disabled={session.status === 'resolving'}
|
||||
/>
|
||||
{#if session.status === 'resolving'}
|
||||
<span class="spinner">⏳</span>
|
||||
{/if}
|
||||
</div>
|
||||
{#if session.error}
|
||||
<span class="error" title={session.error}>⚠</span>
|
||||
<div class="error-bar" title={session.error}>⚠ {session.error}</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.url-input {
|
||||
.url-input-wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.url-input {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
@@ -69,8 +77,13 @@
|
||||
.spinner {
|
||||
animation: pulse 1s ease-in-out infinite;
|
||||
}
|
||||
.error {
|
||||
.error-bar {
|
||||
color: var(--danger);
|
||||
font-size: 12px;
|
||||
line-height: 1.3;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
cursor: help;
|
||||
}
|
||||
@keyframes pulse {
|
||||
|
||||
Reference in New Issue
Block a user