mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 14:34:13 +08:00
修复编辑器自动换行bug
This commit is contained in:
parent
79a004e6a4
commit
7b40094bbb
@ -121,6 +121,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
resizeTimeout: null,
|
resizeTimeout: null,
|
||||||
showAIAssistant: false,
|
showAIAssistant: false,
|
||||||
|
wordWrap: "off",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -179,6 +180,7 @@ export default defineComponent({
|
|||||||
value: this.modelValue || "",
|
value: this.modelValue || "",
|
||||||
language,
|
language,
|
||||||
theme: this.theme,
|
theme: this.theme,
|
||||||
|
wordWrap: this.wordWrap,
|
||||||
};
|
};
|
||||||
|
|
||||||
editor = monaco.editor.create(this.$refs.editorContainer, options);
|
editor = monaco.editor.create(this.$refs.editorContainer, options);
|
||||||
@ -354,9 +356,11 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
bindKeys() {
|
bindKeys() {
|
||||||
// alt + z 换行
|
// alt + z 换行
|
||||||
const revWordWrap = this.wordWrap === "on" ? "off" : "on";
|
|
||||||
editor.addCommand(monaco.KeyMod.Alt | monaco.KeyCode.KeyZ, () => {
|
editor.addCommand(monaco.KeyMod.Alt | monaco.KeyCode.KeyZ, () => {
|
||||||
editor.updateOptions({ wordWrap: revWordWrap });
|
this.wordWrap = this.wordWrap === "on" ? "off" : "on";
|
||||||
|
editor.updateOptions({
|
||||||
|
wordWrap: this.wordWrap,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 替换选中的文本,供外部调用
|
// 替换选中的文本,供外部调用
|
||||||
|
Loading…
x
Reference in New Issue
Block a user