Get edited value

Hey, so I’m importing the default value from a file like this:

$.get('resources/config', (data) => {
                    let editor = CodeMirror(document.getElementById('editor'), {
                    mode: 'yaml',
                    styleActiveLine: true,
                    lineNumbers: true,
                    foldGutter: true,
                    gutters: [
                        "CodeMirror-linenumbers", "CodeMirror-foldgutter"
                    theme: 'material',
                    value: data

and now I wanna save the changes a user did to the config (basically overwrite using fs).

I tried editor.getValue();, but thats just the default value loaded from the file and not the updated one.

What do I use instead?

getValue is, in fact, the updated document that the user is editing.

But if I log it (after editing), it still shows the default value from when it was first loaded