marshall-y-slate
Version:
Yjs bindings for Slate.
40 lines (22 loc) • 713 B
Markdown
# slate-yjs
### 感谢slate-yjs,@worktile/y-slate
## 使用
```
npm i marshall-y-slate
```
使用方法同[slate-yjs-example](https://github.com/BitPhinix/slate-yjs-example)
> 代码片段
```
import { toSharedType, useCursors, withCursor, withYjs, withUndoManager } from 'marshall-y-slate';
withReact(withCursor(withUndoManager(withYjs(createEditor(), sharedType)), provider.awareness))
```
源:
* [@worktile/y-slate](https://github.com/worktile/y-slate)
* [slate-yjs main分支](https://github.com/BitPhinix/slate-yjs/tree/main)
修改部分:
* `/model/index.ts`
```
isCaret: boolean;
```
* `/plugin/use-cursors.ts`
使用`slate-yjs`中的`useCursors.ts`并做部分修改