Skip to content

Commit

Permalink
feat: prompt editor (#3929)
Browse files Browse the repository at this point in the history
* feat(Prompt): editor

* docs(ui dev): update supported inquirer types

(cherry picked from commit 3f9838b)
  • Loading branch information
Akryum authored and sodatea committed May 25, 2019
1 parent 204e1fc commit dbac817
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/dev-guide/ui-api.md
Expand Up @@ -526,7 +526,7 @@ However, you can add the following additional fields (which are optional and onl
}
```

Supported inquirer types: `checkbox`, `confirm`, `input`, `password`, `list`, `rawlist`.
Supported inquirer types: `checkbox`, `confirm`, `input`, `password`, `list`, `rawlist`, `editor`.

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

Expand Down
5 changes: 5 additions & 0 deletions packages/@vue/cli-ui/src/components/prompt/Prompt.vue
Expand Up @@ -52,6 +52,11 @@ export default {
align-items stretch
justify-content center
&.vertical
grid-template-columns auto
grid-template-areas "info" "input"
grid-gap $padding-item
.list-item-info
margin-right ($padding-item * 2)
</style>
39 changes: 39 additions & 0 deletions packages/@vue/cli-ui/src/components/prompt/PromptEditor.vue
@@ -0,0 +1,39 @@
<template>
<VueDisable
:disabled="!prompt.enabled"
class="prompt prompt-editor"
>
<div class="prompt-content vertical">
<ListItemInfo
:name="$t(prompt.message)"
:description="$t(prompt.description)"
:link="prompt.link"
/>

<div class="prompt-input">
<VueInput
:value="value(prompt.value)"
type="textarea"
@update="value => answer(value)"
/>
</div>
</div>

<PromptError :error="prompt.error"/>
</VueDisable>
</template>

<script>
import Prompt from './Prompt'
export default {
extends: Prompt,
buffer: true
}
</script>

<style lang="stylus" scoped>
.vue-ui-input /deep/ > .content > .input-wrapper > textarea.input
min-height 16em
</style>

0 comments on commit dbac817

Please sign in to comment.