fix(项目设置): 代码模版生成的代码添加至脚本编辑器光标位置
--bug=1002574 --user=李玉号 【github】缺陷记录2021-04-12 https://www.tapd.cn/55049933/s/1173839
This commit is contained in:
parent
fd36abc220
commit
a1090e60da
|
@ -218,12 +218,9 @@ export default {
|
|||
}
|
||||
},
|
||||
handleCodeTemplate(code) {
|
||||
if (!this.jsr223ProcessorData.script) {
|
||||
this.jsr223ProcessorData.script = code;
|
||||
} else {
|
||||
this.jsr223ProcessorData.script = this.jsr223ProcessorData.script + '\n' + code;
|
||||
if (this.$refs.codeEdit) {
|
||||
this.$refs.codeEdit.insert(code);
|
||||
}
|
||||
this.reload();
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<editor v-model="formatData" :lang="mode" @init="editorInit" :theme="theme" :height="height" :key="readOnly"/>
|
||||
<editor v-model="formatData" :lang="mode" @init="editorInit" :theme="theme" :height="height" :key="readOnly" ref="msEditor"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {formatHtml, formatJson, formatXml} from "../../../../../common/js/format-utils";
|
||||
import {formatJson, formatXml} from "../../../../../common/js/format-utils";
|
||||
import toDiffableHtml from 'diffable-html';
|
||||
|
||||
export default {
|
||||
|
@ -65,6 +65,11 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
insert(code) {
|
||||
if (this.$refs.msEditor.editor) {
|
||||
this.$refs.msEditor.editor.insert(code);
|
||||
}
|
||||
},
|
||||
editorInit: function (editor) {
|
||||
require('brace/ext/language_tools') //language extension prerequsite...
|
||||
this.modes.forEach(mode => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<editor v-model="formatData" :lang="mode" @init="editorInit" :theme="theme" :height="height"/>
|
||||
<editor v-model="formatData" :lang="mode" @init="editorInit" :theme="theme" :height="height" ref="msEditor"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {formatHtml, formatJson, formatXml} from "../../../../common/js/format-utils";
|
||||
import {formatJson, formatXml} from "../../../../common/js/format-utils";
|
||||
import toDiffableHtml from 'diffable-html';
|
||||
|
||||
export default {
|
||||
|
@ -70,6 +70,11 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
insert(code) {
|
||||
if (this.$refs.msEditor.editor) {
|
||||
this.$refs.msEditor.editor.insert(code);
|
||||
}
|
||||
},
|
||||
editorInit: function (editor) {
|
||||
require('brace/ext/language_tools') //language extension prerequsite...
|
||||
this.modes.forEach(mode => {
|
||||
|
|
|
@ -210,12 +210,9 @@ export default {
|
|||
}
|
||||
},
|
||||
handleCodeTemplate(code) {
|
||||
if (!this.form.script) {
|
||||
this.form.script = code;
|
||||
} else {
|
||||
this.form.script = this.form.script + '\n' + code;
|
||||
if (this.$refs.codeEdit) {
|
||||
this.$refs.codeEdit.insert(code);
|
||||
}
|
||||
this.reloadCodeEdit();
|
||||
},
|
||||
reload() {
|
||||
this.isFormAlive = false;
|
||||
|
|
Loading…
Reference in New Issue