mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-10 09:02:42 +08:00
fix: 监听编辑器内容变化事件调整 (#5732)
调整监听编辑器内容变化事件到初始化编辑器之后,避免编辑器初始化时导致默认内容被视为用户编辑行为。
This commit is contained in:
parent
aef163df29
commit
16d26077be
1 changed files with 5 additions and 5 deletions
|
@ -393,17 +393,17 @@ const initEditor = () => {
|
||||||
let defaultContent = '\n\n\n\n';
|
let defaultContent = '\n\n\n\n';
|
||||||
editor.getModel().setValue(defaultContent);
|
editor.getModel().setValue(defaultContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
editor.getModel().pushEOL(config.eol);
|
||||||
|
|
||||||
|
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, quickSave);
|
||||||
|
|
||||||
editor.onDidChangeModelContent(() => {
|
editor.onDidChangeModelContent(() => {
|
||||||
if (editor) {
|
if (editor) {
|
||||||
form.value.content = editor.getValue();
|
form.value.content = editor.getValue();
|
||||||
isEdit.value = true;
|
isEdit.value = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// After onDidChangeModelContent
|
|
||||||
editor.getModel().pushEOL(config.eol);
|
|
||||||
|
|
||||||
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, quickSave);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue