Synchronized editor for multiple files

This commit is contained in:
kiragrammel
2023-09-03 22:47:20 +02:00
committed by Sebastian Serth
parent 7df37078f4
commit 23a95d315d
2 changed files with 7 additions and 6 deletions

View File

@ -24,12 +24,12 @@ $(document).on('turbolinks:load', function () {
received(data) {
// Called when there's incoming data on the websocket for this channel
if (current_user_id !== data['current_user_id']) {
CodeOceanEditor.applyChanges(data['delta']['data']);
CodeOceanEditor.applyChanges(data['delta']['data'], data['active_file']);
}
},
send_changes(delta) {
const delta_with_user_id = {current_user_id: current_user_id, delta: delta}
send_changes(delta, active_file) {
const delta_with_user_id = {current_user_id: current_user_id, active_file: active_file, delta: delta}
this.perform('send_changes', {delta_with_user_id: delta_with_user_id});
}
});