File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -214,21 +214,30 @@ export default Base.extend({
214214 new Promise ( ( resolve ) => provider . on ( "synced" , resolve , { once : true } ) ) ;
215215 await synced ( ) ;
216216
217+ // Attempt 1: Only if the y_doc is the same as the document on the provider object,
218+ // which I believe should be returned from the hocuspocus server.
219+ // The problem here is, that also for the second connection with another browser
220+ // returns true for the following if clause.
221+ if ( y_doc === provider . document ) {
222+ // Initialize the tiptap editor later with some initial content.
223+ config [ "content" ] = getText ( ) ;
224+ }
225+
226+ // Attempt 2: Only for the first connecting user.
227+ // The problem here is that I apparently do not reliably get the number of connected users.
228+ // With two browsers connecting, one time I get 0 users, one time 1 user, another time 2.
217229 const connected_users = [ ...provider . awareness . states . values ( ) ] . map (
218230 ( it ) => it . user
219231 ) ;
220-
221232 if ( connected_users . length === 1 ) {
222- // it's only me .
233+ // Initialize the tiptap editor later with some initial content .
223234 config [ "content" ] = getText ( ) ;
224235 log . info ( `
225236 This is the main instance and gets text from textfield.
226237 Other connected user will get their text from the collaboration server.
227238 ` ) ;
228239 }
229240
230- debugger ;
231-
232241 console . log ( "provider" ) ;
233242 console . log ( provider ) ;
234243
You can’t perform that action at this time.
0 commit comments