@fileverse-dev/ddoc 2.0.3-patch-6 → 2.0.3-sync-patch-2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ import { Extension } from '@tiptap/core';
2
+
3
+ type CollaborationCursorStorage = {
4
+ users: {
5
+ clientId: number;
6
+ [key: string]: any;
7
+ }[];
8
+ };
9
+ export interface CollaborationCursorOptions {
10
+ provider: any;
11
+ user: Record<string, any>;
12
+ render(user: Record<string, any>): HTMLElement;
13
+ selectionRender(user: Record<string, any>): any;
14
+ onUpdate: (users: {
15
+ clientId: number;
16
+ [key: string]: any;
17
+ }[]) => null;
18
+ }
19
+ declare module '@tiptap/core' {
20
+ interface Commands<ReturnType> {
21
+ collaborationCursor: {
22
+ updateUser: (attributes: Record<string, any>) => ReturnType;
23
+ user: (attributes: Record<string, any>) => ReturnType;
24
+ };
25
+ }
26
+ }
27
+ export declare const SyncCursor: Extension<CollaborationCursorOptions, CollaborationCursorStorage>;
28
+ export {};
@@ -30,6 +30,7 @@ export interface DdocProps {
30
30
  onError?: (error: string) => void;
31
31
  setCharacterCount?: React.Dispatch<SetStateAction<number>>;
32
32
  setWordCount?: React.Dispatch<SetStateAction<number>>;
33
+ collaborationKey?: string;
33
34
  }
34
35
  export interface IEditorSelectionData {
35
36
  from: number;
@@ -1,10 +1,9 @@
1
1
  import { DdocProps } from './types';
2
2
 
3
- import * as Y from 'yjs';
4
- export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, onTextSelection, ensResolutionUrl, onError, setCharacterCount, setWordCount, }: Partial<DdocProps>) => {
3
+ export declare const useDdocEditor: ({ isPreviewMode, initialContent, enableCollaboration, collaborationId, walletAddress, username, onChange, onCollaboratorChange, onCommentInteraction, onTextSelection, ensResolutionUrl, onError, setCharacterCount, setWordCount, collaborationKey, }: Partial<DdocProps>) => {
5
4
  editor: import('@tiptap/core').Editor | null;
6
5
  isContentLoading: boolean;
7
6
  ref: import('react').RefObject<HTMLDivElement>;
8
- connect: (username: string | null | undefined, isEns?: boolean) => () => void;
9
- ydoc: Y.Doc;
7
+ connect: (username: string | null | undefined, isEns?: boolean) => void;
8
+ ydoc: import('yjs').Doc;
10
9
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/ddoc",
3
3
  "private": false,
4
4
  "description": "DDoc",
5
- "version": "2.0.3-patch-6",
5
+ "version": "2.0.3-sync-patch-2",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {
@@ -28,6 +28,7 @@
28
28
  "dependencies": {
29
29
  "@_ueberdosis/prosemirror-tables": "^1.1.3",
30
30
  "@aarkue/tiptap-math-extension": "^1.3.3",
31
+ "@fileverse-dev/sync": "^0.0.7",
31
32
  "@fileverse/ui": "^4.1.1-patch-8",
32
33
  "@radix-ui/react-focus-scope": "^1.1.0",
33
34
  "@radix-ui/react-popover": "^1.0.7",
@@ -79,10 +80,7 @@
79
80
  "turndown": "^7.2.0",
80
81
  "usehooks-ts": "^3.1.0",
81
82
  "vaul": "^0.9.1",
82
- "vite-plugin-dts": "^3.6.3",
83
- "y-prosemirror": "^1.2.5",
84
- "y-webrtc": "^10.3.0",
85
- "yjs": "^13.6.15"
83
+ "vite-plugin-dts": "^3.6.3"
86
84
  },
87
85
  "devDependencies": {
88
86
  "@types/dompurify": "^3.0.5",