You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Go to file
George fee0098c3d
Merge pull request #6 from cudr/refactoring_types
5 years ago
packages feat: handle annotations 5 years ago
.gitignore initial commit 5 years ago
.prettierrc initial commit 5 years ago
.travis.yml feat: clear depts 5 years ago
README.md Update README.md 5 years ago
lerna.json initial commit 5 years ago
package.json feat: clear depts 5 years ago
tsconfig.base.json feat: clear depts 5 years ago
tslint.json initial commit 5 years ago

README.md

slate-collaborative. Check Demo

slatejs collaborative plugin & microservice

screencast2019-10-2820-06-10

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

check example

import ColaborativeClient from '@slate-collaborative/client'

const plugins = [ColaborativeClient(options)]

options:

{
  url?: string // url to open connection
  connectOpts?: SocketIOClient.ConnectOpts // socket.io-client options
  cursorAnnotationType?: string // type string for cursor annotations
  annotationDataMixin?: Data // any data passed to cursor annotation
  renderPreloader?: () => ReactNode // optional preloader render
  renderCursor?: (data: Data) => ReactNode | any // custom cursor render
  onConnect?: (connection: Connection) => void // connect callback
  onDisconnect?: (connection: Connection) => void // disconnect callback
}

Backend

const CollaborativeBackend = require('@slate-collaborative/backend')

const connection = new CollaborativeBackend(options)

options:

{
  entry: number | Server // port or Server for listen io connection
  connectOpts?: SocketIO.ServerOptions
  defaultValue?: ValueJSON // default value
  saveTreshold?: number // theshold of onDocumentSave callback execution
  cursorAnnotationType?: string // type string for cursor annotations
  onAuthRequest?: ( // auth callback
    query: Object,
    socket?: SocketIO.Socket
  ) => Promise<boolean> | boolean
  onDocumentLoad?: ( // request slatejs document callback
    pathname: string,
    query?: Object
  ) => ValueJSON | null | false | undefined
  onDocumentSave?: (pathname: string, json: ValueJSON) => Promise<void> | void // save document callback 
}

Contribute

You welcome to contribute!

start it ease:

yarn
yarn dev