no message

This commit is contained in:
kuaifan 2022-04-25 05:03:52 +08:00
parent a723c2a44a
commit ab66b70485

View File

@ -210,8 +210,7 @@ export default {
}
// set value and clear selection
this.editor.setValue(this.value)
this.editor.clearSelection()
this.setValue(this.value)
// set ace editor options and theme
this.editor.setOptions(this.options)
@ -264,6 +263,17 @@ export default {
this.$nextTick(() => this.editor && this.editor.resize())
},
/**
* 设置内容
* @param value
*/
setValue(value) {
if (typeof value === "string" && this.editor) {
this.editor.setValue(value)
this.editor.clearSelection()
}
},
/**
* 获取文件类型
* @returns {string}
@ -359,8 +369,7 @@ export default {
if (newCode == this.code) {
return;
}
this.editor.setValue(newCode)
this.editor.clearSelection()
this.setValue(newCode)
const {row, column} = this.cursorPosition
// move cursor to current position
this.editor.selection.moveCursorTo(row, column)