import { Editor , Operation } from 'slate' ; import * as Y from 'yjs' ; import { translateYTextEvent } from './textEvent' ; param sharedType param op export function translateYjsEvent ( sharedRoot , editor , event ) { if ( event instanceof Y . YTextEvent ) { return translateYTextEvent ( sharedRoot , editor , event ) ; } throw new Error ( 'Unexpected Y event type' ) ; } param sharedRoot param editor param events export function applyYjsEvents ( sharedRoot , editor , events ) { Editor . withoutNormalizing ( editor , ( ) => { events . forEach ( ( event ) => { translateYjsEvent ( sharedRoot , editor , event ) . forEach ( ( op ) => { editor . apply ( op ) ; } ) ; } ) ; } ) ; }