From fe7a925df564c09fe3e7194f41536bcf831f4d03 Mon Sep 17 00:00:00 2001 From: Jan Thurau Date: Sun, 8 Sep 2024 14:31:45 +0200 Subject: [PATCH] adds setAutoversioningInterval helper --- packages/provider/src/TiptapCollabProvider.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/provider/src/TiptapCollabProvider.ts b/packages/provider/src/TiptapCollabProvider.ts index 464b695a..bd87ee49 100644 --- a/packages/provider/src/TiptapCollabProvider.ts +++ b/packages/provider/src/TiptapCollabProvider.ts @@ -318,4 +318,13 @@ export class TiptapCollabProvider extends HocuspocusProvider { this.getYThreads().unobserveDeep(callback) } + private getCollabConfig() { + return this.configuration.document.getMap('__tiptapcollab__config') + } + + setAutoversioningInterval(seconds: number) { + if (this.getCollabConfig().get('intervalSeconds') !== seconds) { + this.getCollabConfig().set('intervalSeconds', seconds) + } + } }