How to use the yjs/dist/y.es6 function in yjs

To help you get started, we’ve selected a few yjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FujitsuLaboratories / cattaz / src / AppEnabledWikiEditorCodeMirror.jsx View on Github external
async componentDidMount() {
    window.addEventListener('resize', this.handleResize);
    this.updateHeight();
    this.updateWidth();
    const { roomName } = this.props;
    if (roomName) {
      this.socket = io(`http://${window.location.hostname}:${process.env.PORT_WEBSOCKET || '1234'}`);
      this.socket.on('activeUser', this.handleActiveUser);
      this.y = await Y({
        db: {
          name: 'memory',
        },
        connector: {
          name: 'websockets-client',
          socket: this.socket,
          // TODO: Will be solved in future https://github.com/y-js/y-websockets-server/commit/2c8588904a334631cb6f15d8434bb97064b59583#diff-e6a5b42b2f7a26c840607370aed5301a
          room: encodeURIComponent(roomName),
        },
        share: {
          textarea: 'Text',
        },
      });
      this.y.share.textarea.bindCodeMirror(this.refEditor.current.editor);
      this.socket.on('clientCursor', this.handleClientCursor);
    }
github FujitsuLaboratories / cattaz / src / AppEnabledWikiEditorAce.jsx View on Github external
componentDidMount() {
    if (this.props.roomName) {
      Y({
        db: {
          name: 'memory',
        },
        connector: {
          name: 'websockets-client',
          url: `http://${window.location.hostname}:1234`,
          room: encodeURIComponent(this.props.roomName),
        },
        share: {
          textarea: 'Text',
        },
      }).then((y) => {
        this.y = y;
        y.share.textarea.bindAce(this.editor.editor, { aceRequire });
      });
    }