0.7.30 • Published 4 years ago
@hiveteams/collab-client v0.7.30
slate-collaborative. Check demo
slatejs collaborative plugin & microservice
A little experiment for co-editing.
Based on idea of https://github.com/humandx/slate-automerge
API
Client
Use it as a simple slatejs plugin
import { withIOCollaboration } from '@slate-collaborative/client'
const collaborationEditor = withIOCollaboration(editor, options)
Check detailed example
Options:
{
docId?: // document id
url?: string // url to open connection
connectOpts?: SocketIOClient.ConnectOpts // socket.io-client options
cursorData?: any // any data passed to cursor
onConnect?: () => void // connect callback
onDisconnect?: () => void // disconnect callback
onError?: (reason: string) => void // error callback
preserveExternalHistory?: boolean // preserve slate-history operations form other clients
}
You need to attach the useCursor decorator to provide custom cursor data in renderLeaf function
import { useCursor } from '@slate-collaborative/client'
const decorator = useCursor(editor)
Backend
const { SocketIOConnection } = require('@slate-collaborative/backend')
const connection = new SocketIOConnection(options)
options:
{
entry: Server // or specify port to start io server
defaultValue: Node[] // default value
saveFrequency: number // frequency of onDocumentSave callback execution in ms
onAuthRequest: ( // auth callback
query: Object,
socket?: SocketIO.Socket
) => Promise<boolean> | boolean
onDocumentLoad: ( // request slate document callback
pathname: string,
query?: Object
) => Promise<Node[]> | Node[]
onDocumentSave: (pathname: string, doc: Node[]) => Promise<void> | void // save document callback
}
Contribute
You welcome to contribute!
start it ease:
yarn
yarn dev
0.7.30
4 years ago
0.7.29
4 years ago
0.7.28
4 years ago
0.7.27
4 years ago
0.7.26
4 years ago
0.7.25
4 years ago
0.7.24
4 years ago
0.7.22
4 years ago
0.7.23
4 years ago
0.7.21
4 years ago
0.7.20
4 years ago
0.7.20-alpha.1
4 years ago
0.7.19
4 years ago
0.7.20-alpha.0
4 years ago
0.7.17
4 years ago
0.7.15
4 years ago
0.7.14
4 years ago
0.7.16
4 years ago
0.7.13
4 years ago
0.7.11
4 years ago
0.7.10
4 years ago
0.7.9
4 years ago
0.7.12
4 years ago
0.7.8
4 years ago
0.7.7
4 years ago
0.7.6
4 years ago
0.7.5
4 years ago
0.7.4
4 years ago
0.7.3
4 years ago
0.7.2
4 years ago
0.7.1
4 years ago