Commit 25f4003f by Johannes Edmeier

Allow esc/enter to cancel/save when edition MBean attributes.

parent 957aa085
......@@ -29,14 +29,17 @@
</button>
</div>
<div class="control is-expanded has-icons-right">
<input v-if="!hasComplexValue" class="input" type="text" :readonly="!editing"
:value="editing? input : value" @input="input = $event.target.value"
@dblclick="edit">
<textarea v-else class="input m-bean-attribute--text" :readonly="!editing"
v-text="jsonValue"/>
<span class="icon is-right has-text-warning" v-if="error">
<font-awesome-icon icon="exclamation-triangle"/>
</span>
<template v-if="!editing">
<input v-if="!hasComplexValue" class="input" type="text" readonly :value="value" @dblclick="edit">
<textarea v-else class="input m-bean-attribute--text" readonly v-text="jsonValue"/>
<span class="icon is-right has-text-warning" v-if="error">
<font-awesome-icon icon="exclamation-triangle"/>
</span>
</template>
<template v-else>
<input v-if="!hasComplexValue" class="input" type="text" ref="input"
v-model="input" @keyup.esc="cancel" @keyup.enter="save">
</template>
</div>
</div>
<div class="help" v-text="descriptor.desc"/>
......@@ -86,10 +89,12 @@
},
},
methods: {
edit() {
if (this.descriptor.rw) {
async edit() {
if (this.descriptor.rw && !this.hasComplexValue) {
this.input = this.value;
this.editing = true;
await this.$nextTick();
this.$refs.input.focus();
}
},
cancel() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment