Hi everyone. Im new to codemirror and sorry for asking such a simple question. Coming from monaco editor where you would listen to editor updates using
editor.onDidChangeModelContent((event) => {
console.log(event);
});
where event.changes
is an array of changes that looks like
{
"range": {
"startLineNumber": 1,
"startColumn": 7,
"endLineNumber": 1,
"endColumn": 7
},
"rangeLength": 0,
"text": "abcd",
"rangeOffset": 6,
"forceMoveMarkers": false
}
]
If the text propery has a string then its insertion update otherwise deletion. You also get the range of change is a nice format.
The closest that I’ve got in codemirror is by making an extension like this.
EditorView.updateListener.of((update: ViewUpdate) => {
console.log(update.changes);
}
But the change property doesnt say where the change was made (row and coloumn) and of what type. Sorry If im missing something here.
(Im implementing a multiplayer code editor so I want to broarcast these delta changes to every socket inside a rooom.)