ui: editor: always use LF as line ending

This commit is contained in:
undefined committed 2022-03-13 01:55:18 +08:00
1 parent 32bf5b9a7e
commit c4521d9ce3
4 files changed
+10 -10

No files matched your search

@@ -143,7 +143,7 @@ export default class Editor extends DOMAttachedObject {
});
}
this.editor.onDidChangeModelContent(() => {
const val = this.editor.getValue();
const val = this.editor.getValue({ lineEnding: '\n', preserveBOM: false });
$dom.val(val);
$dom.text(val);
if (onChange) onChange(val);
@@ -208,7 +208,7 @@ export default class Editor extends DOMAttachedObject {
value(val?: string) {
this.ensureValid();
if (typeof val === 'string') return (this.editor || this.vditor).setValue(val);
return (this.editor || this.vditor).getValue();
return (this.editor || this.vditor).getValue({ lineEnding: '\n', preserveBOM: false });
}
focus() {