Skip to content

Commit 3f9838b

Browse files
authored
feat: prompt editor (#3929)
* feat(Prompt): editor * docs(ui dev): update supported inquirer types
1 parent edcce6a commit 3f9838b

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

docs/dev-guide/ui-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ However, you can add the following additional fields (which are optional and onl
526526
}
527527
```
528528

529-
Supported inquirer types: `checkbox`, `confirm`, `input`, `password`, `list`, `rawlist`.
529+
Supported inquirer types: `checkbox`, `confirm`, `input`, `password`, `list`, `rawlist`, `editor`.
530530

531531
In addition to those, the UI supports special types that only works with it:
532532

packages/@vue/cli-ui/src/components/prompt/Prompt.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export default {
5252
align-items stretch
5353
justify-content center
5454
55+
&.vertical
56+
grid-template-columns auto
57+
grid-template-areas "info" "input"
58+
grid-gap $padding-item
59+
5560
.list-item-info
5661
margin-right ($padding-item * 2)
5762
</style>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<template>
2+
<VueDisable
3+
:disabled="!prompt.enabled"
4+
class="prompt prompt-editor"
5+
>
6+
<div class="prompt-content vertical">
7+
<ListItemInfo
8+
:name="$t(prompt.message)"
9+
:description="$t(prompt.description)"
10+
:link="prompt.link"
11+
/>
12+
13+
<div class="prompt-input">
14+
<VueInput
15+
:value="value(prompt.value)"
16+
type="textarea"
17+
@update="value => answer(value)"
18+
/>
19+
</div>
20+
</div>
21+
22+
<PromptError :error="prompt.error"/>
23+
</VueDisable>
24+
</template>
25+
26+
<script>
27+
import Prompt from './Prompt'
28+
29+
export default {
30+
extends: Prompt,
31+
32+
buffer: true
33+
}
34+
</script>
35+
36+
<style lang="stylus" scoped>
37+
.vue-ui-input /deep/ > .content > .input-wrapper > textarea.input
38+
min-height 16em
39+
</style>

0 commit comments

Comments
 (0)