Using the editor.setValue() method, I successfully rendered a string to the editor and the result in the render view was as expected.
However, upon using editor.getValue() again and printing the length of the resulting string, I encountered an unexpected outcome.
Below is the code snippet:
var value = `asfdasfsa\n\nasdfasdfasdfal;k l;'k \r\n \r\n \r\n k 'a\r\n skd \r\n a\r\n d \r\n \r\n sas\r\n dffa\r\n sd\r\n fsd\r\n f\r\n sfasfdasfasfdasdffasfaf\n\n fa ljjflkajl\n\n false\n\n\r\n\n A\r\n jpakfafafafaffaffaffafafewfwe\n `;
console.log(value.length); // 280
var editor = monaco.editor.create(document.getElementById('container'), {
value: value,
language: 'javascript',
lineNumbers: 'off',
roundedSelection: false,
scrollBeyondLastLine: false,
readOnly: false,
theme: 'vs-dark'
});
console.log(editor.getValue().length) // 290
This issue has been puzzling me for quite some time, and I am still searching for a resolution.
If anyone could provide some insights or solutions to this problem, I would greatly appreciate it. Thank you!~~