Custom node with ace/monaco editor is removing newlines from content

Hi, I'm creating a new node that has a RED.editor in it set to ace/mode/html mode.

I copied the code from the core template node but annoyingly, while everything is otherwise working, the resulting saved code keeps removing newlines.

Does anyone know what I've done wrong?

This is where the editor is created:

const stateId = RED.editor.generateViewStateId('node', node, '')
node.editor = RED.editor.createEditor({
    id: 'node-input-editor',
    mode: 'ace/mode/html',
    stateId: stateId,
    value: node.html
})

And this is the oneditsave function:

function onEditSave(node) {
    const html = node.editor.getValue()
    $('#node-input-html').val(html)

    updateTab(html)

    node.editor.destroy()
    delete node.editor
}

Everything works correctly except for the HTML code being flattened each time. :frowning:

In case it matters, I'm using Monaco for the editor.

Never mind, answering my own question! :slight_smile:

The hidden input to hold the html was marked as type="text". Changing to type="hidden" fixed the issue.