From 4d1efaa23b9fdbe5ca727aa0b3ab94801385a7d7 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Thu, 19 Jan 2023 18:42:41 +0200 Subject: [PATCH] temp --- .../src/YjsService/YjsService.js | 61 ++++++++----------- 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/wax-prosemirror-services/src/YjsService/YjsService.js b/wax-prosemirror-services/src/YjsService/YjsService.js index f4372aa5a..ae66931b4 100644 --- a/wax-prosemirror-services/src/YjsService/YjsService.js +++ b/wax-prosemirror-services/src/YjsService/YjsService.js @@ -1,40 +1,33 @@ import { Service } from 'wax-prosemirror-core'; -import { yCursorPlugin, ySyncPlugin, yUndoPlugin } from 'y-prosemirror'; -import { WebsocketProvider } from 'y-websocket'; -import * as Y from 'yjs'; -import './yjs.css'; +// import { yCursorPlugin, ySyncPlugin, yUndoPlugin } from 'y-prosemirror'; +// import { WebsocketProvider } from 'y-websocket'; +// import * as Y from 'yjs'; +// import './yjs.css'; class YjsService extends Service { - name = 'YjsService'; - boot() { - const { connectionUrl, docIdentifier } = this.config; - const ydoc = new Y.Doc(); - - // const provider = new WebsocketProvider('wss://demos.yjs.dev', 'prosemirror-demo', ydoc) - const provider = new WebsocketProvider(connectionUrl, docIdentifier, ydoc); - - provider.on('sync', args => { - console.log({ sync: args }); - }); - - provider.on('status', args => { - console.log({ status: args }); - }); - - provider.on('connection-close', args => { - console.log({ connectioClose: args }); - }); - - provider.on('connection-error', args => { - console.log({ connectioError: args }); - }); - - const type = ydoc.getXmlFragment('prosemirror'); - - this.app.PmPlugins.add('ySyncPlugin', ySyncPlugin(type)); - this.app.PmPlugins.add('yCursorPlugin', yCursorPlugin(provider.awareness)); - this.app.PmPlugins.add('yUndoPlugin', yUndoPlugin()); - } + // name = 'YjsService'; + // boot() { + // const { connectionUrl, docIdentifier } = this.config; + // const ydoc = new Y.Doc(); + // // const provider = new WebsocketProvider('wss://demos.yjs.dev', 'prosemirror-demo', ydoc) + // const provider = new WebsocketProvider(connectionUrl, docIdentifier, ydoc); + // provider.on('sync', args => { + // console.log({ sync: args }); + // }); + // provider.on('status', args => { + // console.log({ status: args }); + // }); + // provider.on('connection-close', args => { + // console.log({ connectioClose: args }); + // }); + // provider.on('connection-error', args => { + // console.log({ connectioError: args }); + // }); + // const type = ydoc.getXmlFragment('prosemirror'); + // this.app.PmPlugins.add('ySyncPlugin', ySyncPlugin(type)); + // this.app.PmPlugins.add('yCursorPlugin', yCursorPlugin(provider.awareness)); + // this.app.PmPlugins.add('yUndoPlugin', yUndoPlugin()); + // } } export default YjsService; -- GitLab