UBER-1150 Expose collaborative provider loaded state (#3934)

Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2023-11-03 14:23:07 +07:00 committed by GitHub
parent 273ecb42ce
commit 136b9cb7e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -96,14 +96,7 @@
})
let loading = true
if (contextProvider === undefined) {
provider?.on('synced', () => {
loading = false
})
} else {
loading = false
}
provider.loaded.then(() => (loading = false))
const currentUser = getCurrentAccount()

View File

@ -19,8 +19,14 @@ export type TiptapCollabProviderConfiguration = HocuspocusProviderConfiguration
Required<Pick<HocuspocusProviderConfiguration, 'token'>>
export class TiptapCollabProvider extends HocuspocusProvider {
loaded: Promise<void>
constructor (configuration: TiptapCollabProviderConfiguration) {
super(configuration as HocuspocusProviderConfiguration)
this.loaded = new Promise((resolve) => {
this.on('synced', resolve)
})
}
copyContent (sourceId: string, targetId: string): void {