Giter Site home page Giter Site logo

y-text's People

Contributors

alexruppert avatar dmonad avatar hkirat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

y-text's Issues

Awareness feature for deletion of characters

Hi Kevin,
Currently its not possible to find out which user deletes characters .
It would be nice to have the user id as property in the event object of the callback of the observe function.
It would be a nice feature for the activity list of SyncMeta.
Best
Mario

Running multiple instances of Codemirror/Ace runs into problems

Hi
I was trying to run multiple instances of editors for Codemirror/Ace.
The program doesn't seem to work as intended.

Here is what I observed.

  1. Using Ace
    Including multiple Ace editors in the same window makes them relay events amongst themselves.
    As a result, a change in any window is reflected in the other. They are all initialized to the same value as well.
    I have defined different editors and called the bind function separately on the two.
    vid

  2. Using Codemirror
    Something worse happens in this case. The control seems to be stuck among the functions

codeMirrorCallback

and

yCallback

They keep on calling each other and eventually the window crashes.

I am not sure if the code of y-text was written to handle multiple instances of Codemirror/Ace.
It seems though it should since the code consists of arrays

codeMirrorInstances

and

aceMirrorInstances

which suggests multiple instances should be handled

If not then this issue can be converted into a discussion on how to do that.

Running into some issues with Monaco v0.9.0 >=

Hi,

I'm running into some issues with Monaco:

errors.ts:84 Uncaught Error: TypeError: Cannot read property 'startLineNumber' of undefined

Error: TypeError: Cannot read property 'startLineNumber' of undefined
    at mutualExcluse (/Users/user/editor/node_modules/y-text/src/Text.js:101)
    at monacoCallback (/Users/user/editor/node_modules/y-text/src/Text.js:109)
    at CallbackList.invoke (callbackList.ts:63)
    at Emitter.fire (event.ts:123)
    at commonCodeEditor.ts:883
    at safeInvoke1Arg (eventEmitter.ts:295)
    at OrderGuaranteeEventEmitter._emitEvents (eventEmitter.ts:279)
    at OrderGuaranteeEventEmitter.EventEmitter._emitCollected (eventEmitter.ts:232)
    at OrderGuaranteeEventEmitter.EventEmitter.endDeferredEmit (eventEmitter.ts:211)
    at Model.EditableTextModel.pushEditOperations (editableTextModel.ts:98)
    at mutualExcluse (/Users/user/editor/node_modules/y-text/src/Text.js:101)
    at monacoCallback (/Users/user/editor/node_modules/y-text/src/Text.js:109)
    at CallbackList.invoke (callbackList.ts:63)
    at Emitter.fire (event.ts:123)
    at commonCodeEditor.ts:883
    at safeInvoke1Arg (eventEmitter.ts:295)
    at OrderGuaranteeEventEmitter._emitEvents (eventEmitter.ts:279)
    at OrderGuaranteeEventEmitter.EventEmitter._emitCollected (eventEmitter.ts:232)
    at OrderGuaranteeEventEmitter.EventEmitter.endDeferredEmit (eventEmitter.ts:211)
    at Model.EditableTextModel.pushEditOperations (editableTextModel.ts:98)
    at errors.ts:84

This occurs if I type anything into Monaco. I encounter errors with Monaco versions 0.13.1 to 0.9.0. Monaco version 0.8.3 works fine, however.

What algorithm is y-text using?

Sorry, I can not figure that out from the code.
What algorithm y-text is using?
I see offsets, but I see no transforms. Is it OT, CRDT or something else?

y-text returns \n on single line html-input fields

Hi Kevin,
if i type enter (\n) in a html-input field binded to a ytext and retrieve the value usingytext.toString() the String consits of "\n".
It's not a big problem i can filter it out with ytext.toString().replace(/\n/g,''), but for a single line input field I think "\n" shouldn't occur there.

I tested in older SyncMeta version which uses y-text 9.0.1 and yjs 11.2.6 and the newest which uses the latest versions(yjs 12.0.4 and y-text 9.0.2).
Best,
Mario

yText doesn't work properly with Monaco v0.10.0

There are at couple issues with the current version of Monaco and the current version of Y-JS. I finally had an opportunity to test this out and integrate it; and it doesn't work. ;-(

First The new version of Monaco changed the onDidChangeModelContent it now sends you an array of changes. So in monacoCallback, made a small change so that it would loop through the changes

function monacoCallback (orgEvent) { 
...
 for (var j=0;j<orgEvent.changes.length;j++) {
                  var event = orgEvent.changes[j];
...

No more exceptions Yay. (I think this fixes the obvious compatible issue)

I tested initially on a TextArea which works great with the following design:

  1. Server creates a new Workspace with Share.files = Map. (i.e. ymap)
  2. Client gets a message to attach to the Workspace, and connects (and waits for it).
  3. Client asks to open a file
  4. Server creates new YText's inside the files Map.
  5. Client gets a message to attach to a file in the editor and uses:
  • Removed any existing binding and creates a new Monaco Model, and attaches it as the current monaco model. The text is transferred in the inital attach message (outside of YJS), because Y can sometimes be slow... Then it proceeds to do:
    yWorkspace.connector.whenSynced which works about 33% of the time to have the file YText is ready, but if it fails here; I waits for the y.share.files.observe add event and then attempts the same code path above with the whenSynced and catches the rest of the times. At this point I am able to get the files YText properly. And then I bind it to the actual editor. So far everything seems good. If I type I see events occur on the server, clients, etc. BUT the attached editors never change their content. ;-(

If I use a pure TextArea, this seems to work fine. If I create a demo Monaco project using the "Monaco" as the share; it partially works; one browser will update the other browser; but the other browser will NOT updated the other one. So it posts updates through the exact same server process...

So in summary:

  1. Using YMap -> Multiple YTexts; does NOT update any browsers on changes, but attaching to the events, I see update and sync messages; so it "appears" that it is sending things between the browser, just not updating Monaco.
  2. Using YText directly, appears to keep one Monaco instance in one browser updated; the other browser does not update.
  3. Using YText or YMap->YText in textarea seems to work great.

I based this off the default YSocket examples; other than the changes to make it used Map's.
All sides are using the YMemory storage. I was really hoping to present this project on the 19th; but at this point I'm not going to be able to use YJS to sync things as much as I would love to.. If you have any thoughts, I'll be watching this issue religiously. :)

Cursor not following the inserted text if the text is longer than the width of the input field

In Chrome 51 if i bind a html-input field to y-text and insert text. If i reach the right border of the input field the cursor is not following the inserted text like it should. Basically i write out of the visible region and the cursor is not following.
I just binded a input-html field to y.text as is the examples of Yjs:
y.share.text.bind(document.getElementById('test'));

In Firefox its is working.

Error when typing (adding) text

Hello,
I get an error when im typing text. Mostly after the second character:

image

Grtz Dennis

PS. Problem get something todo with Y.Array ;)

Should y-text work with multiple ace EditSession?

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 */

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.