Commit 25f4003f by Johannes Edmeier

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

parent 957aa085
...@@ -29,14 +29,17 @@ ...@@ -29,14 +29,17 @@
</button> </button>
</div> </div>
<div class="control is-expanded has-icons-right"> <div class="control is-expanded has-icons-right">
<input v-if="!hasComplexValue" class="input" type="text" :readonly="!editing" <template v-if="!editing">
:value="editing? input : value" @input="input = $event.target.value" <input v-if="!hasComplexValue" class="input" type="text" readonly :value="value" @dblclick="edit">
@dblclick="edit"> <textarea v-else class="input m-bean-attribute--text" readonly v-text="jsonValue"/>
<textarea v-else class="input m-bean-attribute--text" :readonly="!editing" <span class="icon is-right has-text-warning" v-if="error">
v-text="jsonValue"/> <font-awesome-icon icon="exclamation-triangle"/>
<span class="icon is-right has-text-warning" v-if="error"> </span>
<font-awesome-icon icon="exclamation-triangle"/> </template>
</span> <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> </div>
<div class="help" v-text="descriptor.desc"/> <div class="help" v-text="descriptor.desc"/>
...@@ -86,10 +89,12 @@ ...@@ -86,10 +89,12 @@
}, },
}, },
methods: { methods: {
edit() { async edit() {
if (this.descriptor.rw) { if (this.descriptor.rw && !this.hasComplexValue) {
this.input = this.value; this.input = this.value;
this.editing = true; this.editing = true;
await this.$nextTick();
this.$refs.input.focus();
} }
}, },
cancel() { 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