Skip to content

Commit b446afb

Browse files
committed
fix: improve plugin market editor layout
1 parent 8580af3 commit b446afb

1 file changed

Lines changed: 86 additions & 37 deletions

File tree

src/components/dialog/PluginMarketSettingDialog.vue

Lines changed: 86 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ function startEdit(index: number) {
199199
}
200200
201201
/** 保存当前行内编辑的仓库地址。 */
202-
function saveEdit() {
203-
if (editingIndex.value === null) return
202+
function saveEdit(index = editingIndex.value) {
203+
if (index === null) return
204204
205205
const url = editingUrl.value.trim()
206-
if (!validateRepoUrl(url, editingIndex.value)) return
206+
if (!validateRepoUrl(url, index)) return
207207
208-
repoList.value[editingIndex.value] = url
208+
repoList.value[index] = url
209209
syncTextFromList()
210210
editingIndex.value = null
211211
editingUrl.value = ''
@@ -330,10 +330,10 @@ onMounted(() => {
330330
<VListItemTitle>
331331
<div class="plugin-market-repo-title">
332332
<span class="plugin-market-repo-index">{{ index + 1 }}</span>
333-
<span class="text-truncate" :title="repo">{{ formatRepoDisplay(repo) }}</span>
333+
<span class="plugin-market-repo-name" :title="repo">{{ formatRepoDisplay(repo) }}</span>
334334
</div>
335335
</VListItemTitle>
336-
<VListItemSubtitle class="text-truncate mt-1" :title="repo">
336+
<VListItemSubtitle class="plugin-market-repo-url mt-1" :title="repo">
337337
{{ repo }}
338338
</VListItemSubtitle>
339339
</template>
@@ -345,7 +345,7 @@ onMounted(() => {
345345
variant="outlined"
346346
hide-details
347347
autofocus
348-
@keyup.enter="saveEdit"
348+
@keyup.enter="saveEdit(index)"
349349
@keyup.escape="cancelEdit"
350350
/>
351351

@@ -364,8 +364,13 @@ onMounted(() => {
364364

365365
<template #append v-else>
366366
<div class="d-flex align-center">
367-
<IconBtn icon="mdi-check" size="small" variant="text" color="success" @click="saveEdit" />
368-
<IconBtn icon="mdi-close" size="small" variant="text" @click="cancelEdit" />
367+
<VBtn
368+
icon="mdi-check"
369+
size="small"
370+
variant="text"
371+
color="success"
372+
@click.stop="saveEdit(index)"
373+
/>
369374
</div>
370375
</template>
371376
</VListItem>
@@ -383,16 +388,17 @@ onMounted(() => {
383388
</div>
384389

385390
<div v-else class="plugin-market-text-panel">
386-
<VTextarea
387-
v-model="repoText"
388-
class="plugin-market-textarea"
389-
rows="8"
390-
variant="outlined"
391-
prepend-inner-icon="mdi-text-box-edit-outline"
392-
:placeholder="t('dialog.pluginMarketSetting.textPlaceholder')"
393-
:hint="t('dialog.pluginMarketSetting.textHint')"
394-
persistent-hint
395-
/>
391+
<div class="plugin-market-textarea-field">
392+
<VIcon icon="mdi-text-box-edit-outline" class="plugin-market-textarea-icon" />
393+
<textarea
394+
v-model="repoText"
395+
class="plugin-market-textarea"
396+
:placeholder="t('dialog.pluginMarketSetting.textPlaceholder')"
397+
/>
398+
</div>
399+
<div class="plugin-market-text-hint">
400+
{{ t('dialog.pluginMarketSetting.textHint') }}
401+
</div>
396402

397403
<VAlert
398404
v-if="parsedTextRepos.invalidRepos.length > 0"
@@ -488,7 +494,7 @@ onMounted(() => {
488494
display: flex;
489495
flex: 1;
490496
flex-direction: column;
491-
gap: 0.75rem;
497+
gap: 0.5rem;
492498
min-block-size: 0;
493499
}
494500
@@ -520,6 +526,22 @@ onMounted(() => {
520526
min-inline-size: 0;
521527
}
522528
529+
.plugin-market-repo-name,
530+
.plugin-market-repo-url {
531+
display: -webkit-box;
532+
overflow: hidden;
533+
-webkit-box-orient: vertical;
534+
-webkit-line-clamp: 2;
535+
line-break: anywhere;
536+
overflow-wrap: anywhere;
537+
white-space: normal;
538+
word-break: break-word;
539+
}
540+
541+
.plugin-market-repo-url {
542+
line-height: 1.4;
543+
}
544+
523545
.plugin-market-repo-index {
524546
flex: 0 0 auto;
525547
color: rgba(var(--v-theme-on-surface), 0.48);
@@ -536,29 +558,56 @@ onMounted(() => {
536558
min-block-size: 14rem;
537559
}
538560
539-
.plugin-market-textarea {
561+
.plugin-market-textarea-field {
562+
position: relative;
563+
display: flex;
540564
flex: 1;
565+
border: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
566+
border-radius: 8px;
567+
background: rgba(var(--v-theme-surface), 0.72);
541568
min-block-size: 0;
569+
overflow: hidden;
570+
transition: border-color 0.2s ease, box-shadow 0.2s ease;
542571
543-
:deep(.v-input__control),
544-
:deep(.v-field),
545-
:deep(.v-field__field) {
546-
block-size: 100%;
547-
min-block-size: 0;
572+
&:focus-within {
573+
border-color: rgb(var(--v-theme-primary));
574+
box-shadow: 0 0 0 1px rgb(var(--v-theme-primary));
548575
}
576+
}
549577
550-
:deep(.v-field__input) {
551-
align-items: stretch;
552-
block-size: 100%;
553-
min-block-size: 0;
554-
}
578+
.plugin-market-textarea-icon {
579+
position: absolute;
580+
z-index: 1;
581+
color: rgba(var(--v-theme-on-surface), 0.62);
582+
inset-block-start: 1.25rem;
583+
inset-inline-start: 1rem;
584+
pointer-events: none;
585+
}
555586
556-
:deep(textarea) {
557-
block-size: 100%;
558-
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
559-
line-height: 1.6;
560-
overflow-y: auto;
561-
}
587+
.plugin-market-textarea {
588+
flex: 1;
589+
border: 0;
590+
background: transparent;
591+
block-size: 100%;
592+
color: rgb(var(--v-theme-on-surface));
593+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
594+
font-size: 1rem;
595+
line-height: 1.6;
596+
min-block-size: 0;
597+
outline: none;
598+
overflow-y: auto;
599+
padding: 1rem 1rem 1rem 3.25rem;
600+
resize: none;
601+
white-space: pre-wrap;
602+
word-break: break-word;
603+
}
604+
605+
.plugin-market-text-hint {
606+
flex: 0 0 auto;
607+
color: rgba(var(--v-theme-on-surface), 0.62);
608+
font-size: 0.8125rem;
609+
line-height: 1.4;
610+
padding-inline: 1rem;
562611
}
563612
564613
.plugin-market-invalid-alert {

0 commit comments

Comments
 (0)