fix(项目设置): 代码模版生成的代码添加至脚本编辑器光标位置

--bug=1002574 --user=李玉号 【github】缺陷记录2021-04-12
https://www.tapd.cn/55049933/s/1173839
This commit is contained in:
shiziyuan9527 2022-06-06 15:21:27 +08:00 committed by shiziyuan9527
parent 1689b29b02
commit 9becbe564d
4 changed files with 18 additions and 14 deletions

View File

@ -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();
},
}
}

View File

@ -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 => {

View File

@ -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 => {

View File

@ -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;