项目
在 GitHub 查看
cudr/slate-collaborative
关于
slatejs collaborative plugin & microservice https://slate-collaborative.herokuapp.com/
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文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
探索相关项目
加载中…