@hocuspocus/provider
Advanced tools
Comparing version 2.12.1-rc.0 to 2.12.2-rc.0
import type { AbstractType, YArrayEvent } from 'yjs'; | ||
import * as Y from 'yjs'; | ||
import { HocuspocusProvider, HocuspocusProviderConfiguration } from './HocuspocusProvider.js'; | ||
import { TiptapCollabProviderWebsocket } from './TiptapCollabProviderWebsocket.js'; | ||
import type { TCollabComment, TCollabThread, THistoryVersion } from './types.js'; | ||
export type TiptapCollabProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & (Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'websocketProvider'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>); | ||
export type TiptapCollabProviderConfiguration = Required<Pick<HocuspocusProviderConfiguration, 'name'>> & Partial<HocuspocusProviderConfiguration> & (Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'websocketProvider'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>> | Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>) & Pick<AdditionalTiptapCollabProviderConfiguration, 'user'>; | ||
export interface AdditionalTiptapCollabProviderConfiguration { | ||
@@ -16,5 +17,7 @@ /** | ||
websocketProvider?: TiptapCollabProviderWebsocket; | ||
user?: string; | ||
} | ||
export declare class TiptapCollabProvider extends HocuspocusProvider { | ||
tiptapCollabConfigurationPrefix: string; | ||
userData?: Y.PermanentUserData; | ||
constructor(configuration: TiptapCollabProviderConfiguration); | ||
@@ -21,0 +24,0 @@ /** |
{ | ||
"name": "@hocuspocus/provider", | ||
"version": "2.12.1-rc.0", | ||
"version": "2.12.2-rc.0", | ||
"description": "hocuspocus provider", | ||
@@ -32,3 +32,3 @@ "homepage": "https://hocuspocus.dev", | ||
"dependencies": { | ||
"@hocuspocus/common": "^2.12.1-rc.0", | ||
"@hocuspocus/common": "^2.12.2-rc.0", | ||
"@lifeomic/attempt": "^3.0.2", | ||
@@ -35,0 +35,0 @@ "lib0": "^0.2.87", |
@@ -19,3 +19,4 @@ import type { AbstractType, YArrayEvent } from 'yjs' | ||
Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'appId'>>| | ||
Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>) | ||
Required<Pick<AdditionalTiptapCollabProviderConfiguration, 'baseUrl'>>) & | ||
Pick<AdditionalTiptapCollabProviderConfiguration, 'user'> | ||
@@ -34,2 +35,4 @@ export interface AdditionalTiptapCollabProviderConfiguration { | ||
websocketProvider?: TiptapCollabProviderWebsocket | ||
user?: string | ||
} | ||
@@ -40,2 +43,4 @@ | ||
userData?: Y.PermanentUserData | ||
constructor(configuration: TiptapCollabProviderConfiguration) { | ||
@@ -51,2 +56,7 @@ if (!configuration.websocketProvider) { | ||
super(configuration as HocuspocusProviderConfiguration) | ||
if (configuration.user) { | ||
this.userData = new Y.PermanentUserData(this.document, this.document.getMap('__tiptapcollab__users')) | ||
this.userData.setUserMapping(this.document, this.document.clientID, configuration.user) | ||
} | ||
} | ||
@@ -53,0 +63,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
819787
9353