mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-09-24 13:03:30 +08:00
退出时保存光标位置
This commit is contained in:
@@ -209,22 +209,20 @@ export default {
|
||||
created() {},
|
||||
methods: {
|
||||
init() {
|
||||
window.commandEditor = this;
|
||||
let quickCommandInfo =
|
||||
this.action.type === "run"
|
||||
this.action.type !== "edit"
|
||||
? this.$utools.getDB(this.$utools.DBPRE.CFG + "preferences")
|
||||
?.codeHistory
|
||||
?.codeHistory[this.action.type]
|
||||
: this.action.data;
|
||||
_.merge(this.quickcommandInfo, quickCommandInfo);
|
||||
// monaco 相关
|
||||
this.$refs.editor.setEditorValue(this.quickcommandInfo.cmd);
|
||||
this.setLanguage(this.quickcommandInfo.program);
|
||||
this.$refs.editor.setCursorPosition(this.quickcommandInfo.cursorPosition)
|
||||
// 默认命令不可编辑
|
||||
if (this.quickcommandInfo.tags?.includes("默认") && !utools.isDev()) {
|
||||
this.canCommandSave = false;
|
||||
}
|
||||
if (this.action.type === "run")
|
||||
this.$profile.codeHistory = this.quickcommandInfo;
|
||||
},
|
||||
programChanged(value) {
|
||||
this.setLanguage(value);
|
||||
|
@@ -67,9 +67,6 @@ export default {
|
||||
*/
|
||||
action: Object,
|
||||
},
|
||||
mounted() {
|
||||
window.runResult = this;
|
||||
},
|
||||
computed: {
|
||||
fromUtools() {
|
||||
return this.action.type === "input";
|
||||
|
@@ -275,9 +275,6 @@ export default {
|
||||
quickcommandInfo: Object,
|
||||
canCommandSave: Boolean,
|
||||
},
|
||||
mounted() {
|
||||
window.CommandSideBar = this;
|
||||
},
|
||||
computed: {
|
||||
specialVarsOptions() {
|
||||
let x = Object.values(specialVars).filter(
|
||||
|
@@ -213,9 +213,6 @@ export default {
|
||||
return this.configurationPage.activatedQuickCommandFeatureCodes.length;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
window.configurationMenu = this;
|
||||
},
|
||||
props: {
|
||||
isTagStared: Boolean,
|
||||
currentTag: String,
|
||||
|
@@ -176,6 +176,13 @@ export default {
|
||||
setEditorLanguage(language) {
|
||||
monaco.editor.setModelLanguage(this.rawEditor.getModel(), language);
|
||||
},
|
||||
getCursorPosition() {
|
||||
return this.rawEditor.getPosition();
|
||||
},
|
||||
setCursorPosition(pos) {
|
||||
if (!pos) return;
|
||||
this.rawEditor.setPosition(pos);
|
||||
},
|
||||
repacleEditorSelection(text) {
|
||||
var selection = this.rawEditor.getSelection();
|
||||
var range = new monaco.Range(
|
||||
|
@@ -76,7 +76,6 @@ export default {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
window.SelectList = this;
|
||||
window.temporaryStore.updateSelectList = (opt, id) => {
|
||||
if (typeof id === "undefined") this.items.push(opt);
|
||||
else this.items[id] = opt;
|
||||
|
Reference in New Issue
Block a user