Monaco / Scaffold: Use LF line endings on all platforms

https://forums.zotero.org/discussion/114239/z7-beta77-scaffold-bugs-report
This commit is contained in:
Abe Jellinek 2024-05-07 12:10:57 -04:00
parent f1cf1b1a2b
commit 655575eb77
2 changed files with 4 additions and 1 deletions

View file

@ -62,6 +62,8 @@
detectIndentation: false,
...params
});
editor.getModel().setEOL(monaco.editor.EndOfLineSequence.LF);
window.onresize = function () {
editor.layout();

View file

@ -285,7 +285,8 @@ var Scaffold = new function () {
// For some reason, even if we explicitly re-set the default model's language to JavaScript,
// Monaco still treats it as TypeScript. Recreating the model manually fixes the issue.
editor.setModel(monaco.editor.createModel('', 'javascript', monaco.Uri.parse('inmemory:///translator.js')));
let model = monaco.editor.createModel('', 'javascript', monaco.Uri.parse('inmemory:///translator.js'));
editor.setModel(model);
editor.updateOptions({
lineNumbers: num => num + _linesOfMetadata - 1,