@@ -62,7 +62,7 @@ export async function createMonaco(textarea, filename, editorOpts) {
62
62
const monaco = await import ( /* webpackChunkName: "monaco" */ 'monaco-editor' ) ;
63
63
64
64
initLanguages ( monaco ) ;
65
- let { language, eol , ...other } = editorOpts ;
65
+ let { language, ...other } = editorOpts ;
66
66
if ( ! language ) language = getLanguage ( filename ) ;
67
67
68
68
const container = document . createElement ( 'div' ) ;
@@ -105,28 +105,14 @@ export async function createMonaco(textarea, filename, editorOpts) {
105
105
monaco . languages . register ( { id : 'vs.editor.nullLanguage' } ) ;
106
106
monaco . languages . setLanguageConfiguration ( 'vs.editor.nullLanguage' , { } ) ;
107
107
108
- // We encode the initial value in JSON on the backend to prevent browsers from
109
- // discarding the \r during HTML parsing:
110
- // https://html.spec.whatwg.org/multipage/parsing.html#preprocessing-the-input-stream
111
- const value = JSON . parse ( textarea . getAttribute ( 'data-initial-value' ) || '""' ) ;
112
- textarea . value = value ;
113
- textarea . removeAttribute ( 'data-initial-value' ) ;
114
-
115
108
const editor = monaco . editor . create ( container , {
116
- value,
109
+ value : textarea . value ,
117
110
theme : 'gitea' ,
118
111
language,
119
112
...other ,
120
113
} ) ;
121
114
122
115
const model = editor . getModel ( ) ;
123
-
124
- // Monaco performs auto-detection of dominant EOL in the file, biased towards LF for
125
- // empty files. If there is an editorconfig value, override this detected value.
126
- if ( eol in monaco . editor . EndOfLineSequence ) {
127
- model . setEOL ( monaco . editor . EndOfLineSequence [ eol ] ) ;
128
- }
129
-
130
116
model . onDidChangeContent ( ( ) => {
131
117
textarea . value = editor . getValue ( ) ;
132
118
textarea . dispatchEvent ( new Event ( 'change' ) ) ; // seems to be needed for jquery-are-you-sure
@@ -201,6 +187,5 @@ function getEditorConfigOptions(ec) {
201
187
opts . trimAutoWhitespace = ec . trim_trailing_whitespace === true ;
202
188
opts . insertSpaces = ec . indent_style === 'space' ;
203
189
opts . useTabStops = ec . indent_style === 'tab' ;
204
- opts . eol = ec . end_of_line ?. toUpperCase ( ) ;
205
190
return opts ;
206
191
}
0 commit comments