Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should y-text work with multiple ace EditSession? #10

Open
davidmball opened this issue Aug 8, 2017 · 1 comment
Open

Should y-text work with multiple ace EditSession? #10

davidmball opened this issue Aug 8, 2017 · 1 comment

Comments

@davidmball
Copy link

When I use

EditSession = ace.require("ace/edit_session").EditSession;

And then setup the sessions I can't get the code sharing between browsers to work. I get this error:

Text.js:277 Uncaught Error: Error: This position exceeds the range of the array!
    at n (Text.js:277)
    at Array.r (Text.js:285)
    at b.r._signal (ace.js:1)
    at b.onDocumentChange (ace.js:1)
    at p.r._signal (ace.js:1)
    at p.onChange (ace.js:1)
    at a.r._signal (ace.js:1)
    at applyDelta (ace.js:1)
    at a.insertMergedLines (ace.js:1)
    at a.insert (ace.js:1)

Should yjs work with multiple ace edit sessions?

I'm setting it up as follows:

Y({
  db: {
    name: 'memory'
  },
  connector: {
    name: 'websockets-client',
    room: 'ace-example',
    url: 'http://localhost:1234'
  },
  sourceDir: '/bower_components',
  share: {
    ace: 'Text' // y.share.textarea is of type Y.Text
  }
}).then(function (y) {
  editor = ace.edit("editor");
  editor.setTheme("ace/theme/chrome");
  y.share.ace.bindAce(editor);
  EditSession = ace.require("ace/edit_session").EditSession;
/* And then code that sets up all the sessions and calls SetValue to set the initial code */
@davidmball
Copy link
Author

I solved this problem for myself by creating a new ace editor for each source file to edit. That means one Yjs room per source file. This seems to be working but it would still be great if Yjs supported editsessions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant