Skip to content

Feat prompt editor #3929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/dev-guide/ui-api.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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>