diff --git a/cmdb-ui/src/modules/cmdb/views/ci_types/computedArea.vue b/cmdb-ui/src/modules/cmdb/views/ci_types/computedArea.vue
index 1d43814..05a67e3 100644
--- a/cmdb-ui/src/modules/cmdb/views/ci_types/computedArea.vue
+++ b/cmdb-ui/src/modules/cmdb/views/ci_types/computedArea.vue
@@ -6,7 +6,12 @@
{{ $t('cmdb.ciType.code') }}
-
+
@@ -49,8 +54,26 @@ export default {
height: '200px',
theme: 'monokai',
tabSize: 4,
- lineWrapping: true,
+ indentUnit: 4,
+ lineWrapping: false,
readOnly: !this.canDefineComputed,
+ extraKeys: {
+ Tab: (cm) => {
+ if (cm.somethingSelected()) {
+ cm.indentSelection('add')
+ } else {
+ cm.replaceSelection(Array(cm.getOption('indentUnit') + 1).join(' '), 'end', '+input')
+ }
+ },
+ 'Shift-Tab': (cm) => {
+ if (cm.somethingSelected()) {
+ cm.indentSelection('subtract')
+ } else {
+ const cursor = cm.getCursor()
+ cm.setCursor({ line: cursor.line, ch: cursor.ch - 4 })
+ }
+ },
+ },
},
}
},
@@ -83,6 +106,9 @@ export default {
},
})
},
+ onCodeChange(v) {
+ this.compute_script = v.replace('\t', ' ')
+ }
},
}