mirror of
https://github.com/cudr/slate-collaborative.git
synced 2024-10-27 20:34:06 +00:00
fix: cleanup createConnection logic
This commit is contained in:
parent
e8ad6fe205
commit
ce563a2514
@ -35,8 +35,6 @@ const withAutomerge = <T extends Editor>(
|
|||||||
e.docSet = new Automerge.DocSet()
|
e.docSet = new Automerge.DocSet()
|
||||||
|
|
||||||
const createConnection = () => {
|
const createConnection = () => {
|
||||||
if (e.connection) e.connection.close()
|
|
||||||
|
|
||||||
e.connection = AutomergeEditor.createConnection(e, (data: CollabAction) =>
|
e.connection = AutomergeEditor.createConnection(e, (data: CollabAction) =>
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
e.send(data)
|
e.send(data)
|
||||||
@ -97,8 +95,6 @@ const withAutomerge = <T extends Editor>(
|
|||||||
|
|
||||||
e.receiveDocument = data => {
|
e.receiveDocument = data => {
|
||||||
AutomergeEditor.receiveDocument(e, docId, data)
|
AutomergeEditor.receiveDocument(e, docId, data)
|
||||||
|
|
||||||
createConnection()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user