2019-06-23 03:35:23 -07:00
|
|
|
<template>
|
|
|
|
<div v-if="dialogVisible">
|
|
|
|
<el-dialog :visible="dialogVisible" append-to-body width="80%" :title="`Edit ${parameter.displayName}`" :before-close="closeDialog">
|
|
|
|
|
2019-07-11 03:58:07 -07:00
|
|
|
<div class="text-editor-wrapper ignore-key-press">
|
2019-06-23 03:35:23 -07:00
|
|
|
<div class="editor-description">
|
|
|
|
{{parameter.displayName}}:
|
|
|
|
</div>
|
|
|
|
<div class="text-editor" @keydown.stop @keydown.esc="closeDialog()">
|
2020-01-03 19:48:55 -08:00
|
|
|
<el-input v-model="tempValue" type="textarea" ref="inputField" :value="value" :placeholder="parameter.placeholder" @change="valueChanged" @keydown.stop="noOp" rows="15" />
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
import {
|
|
|
|
Workflow,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
|
|
|
|
name: 'TextEdit',
|
|
|
|
props: [
|
|
|
|
'dialogVisible',
|
|
|
|
'parameter',
|
|
|
|
'value',
|
|
|
|
],
|
|
|
|
data () {
|
|
|
|
return {
|
2020-01-03 19:48:55 -08:00
|
|
|
tempValue: '', // el-input does not seem to work without v-model so add one
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
valueChanged (value: string) {
|
|
|
|
this.$emit('valueChanged', value);
|
|
|
|
},
|
|
|
|
|
|
|
|
closeDialog () {
|
|
|
|
// Handle the close externally as the visible parameter is an external prop
|
|
|
|
// and is so not allowed to be changed here.
|
|
|
|
this.$emit('closeDialog');
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
dialogVisible () {
|
|
|
|
if (this.dialogVisible === true) {
|
|
|
|
Vue.nextTick(() => {
|
|
|
|
(this.$refs.inputField as HTMLInputElement).focus();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2020-01-03 19:48:55 -08:00
|
|
|
value () {
|
|
|
|
this.tempValue = this.value as string;
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.editor-description {
|
|
|
|
font-weight: bold;
|
|
|
|
padding: 0 0 0.5em 0.2em;;
|
|
|
|
}
|
|
|
|
</style>
|