Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Nigel Gilbert
    @micrology
    Interesting idea, but I checked by inserting a debug message inside wsProvider.on('sync', () => {, which confirmed that at the time of the sync event, the remote data had indeed been loaded.
    CRIMX
    @crimx
    Hi I'd like to make a custom provider, but the docs seem unfinished. What should the interface be for a provider?
    Mezriss
    @Mezriss
    Hi, is there an easy way to add access control to yjs documents? I.e. certain fields can be modified only by certain users, other users can only read them.
    Sudhanshu Gautam
    @sudhanshu16
    Hey, I am using yjs with quill over websockets. I noticed that yjs is ignoring the initial content from Quill and overwriting it with <p><br/></p>, anybody know how to get around this?
    1 reply
    Reyhan Sofian
    @reyhansofian
    hi everyone. I'm using yjs for realtime dashboard using y-websocket. I've been hitting an issue whenever a client refreshes their page, the yjs server will send the last state before the page refresh. is there a way I can avoid this?
    Timo Ylikännö
    @tianyl
    Hi all! How come y.js generates massive amount of events while synchronizing data? I'm using yarray and while another changes there are hundreds of observe events. All have same content.
    war1644
    @war1644
    Hi all. How to delete all records of ydoc, and then write new records?
    Flávio Carvalho
    @flaviouk

    Hi, is there a way to delete a root type? Can't find a way to do it..

    Essentially the same as:

    const info = ydoc.getMap('info')
    const value = new Y.Array()
    value.insert(0, [1,2,3])
    info.set('foo', value)
    info.delete('foo')

    But using a root type:

    const foo = ydoc.getArray('info/foo')
    foo.insert(0, [1,2,3])
    // How to delete when I don't need this array anymore?
    Viktor Qvarfordt
    @ViktorQvarfordt
    @ygnoh, did you find a good way for working with input or textarea?
    Jeffrey Schaefer
    @schwayne:matrix.org
    [m]
    hello all! can anyone tell me the idiomatic way to deep clone an xmlelement?
    Jeffrey Schaefer
    @jephree
    to clarify, i have tried using .clone, and reattaching to the current yjs doc, but i only find the top level element. i have tried this with yjs fragments as well and it does not seem to work (although the tests indicate it does, so i must be doing something wrong)
    marek-baranowski
    @marek-baranowski
    hey folks, how can I implement (in Prosemirror) conditional rendering of text based on provided data, is there already some plugin doing that? Precisely did it very nicely, looking for something similar. if there is no plugin for that, how to approach it best? screenshot1 screenshoot2
    JS Console App
    @jsconsole-app
    Hi, am using codemirror and y-webrtc, the editor works fine with newly created document. But when editing an already saved document, the content gets duplicated double times, is there a way i can set initial data for the new document?
    Yonggoo Noh
    @ygnoh
    @ViktorQvarfordt NO :(
    Viktor Qvarfordt
    @ViktorQvarfordt
    @ygnoh I have some updates for you here https://discuss.yjs.dev/t/yjs-redux-binding/755/2 :)
    Does anyone understand the example here https://docs.yjs.dev/api/shared-types/y.array? My problem is that there is no yarray.set but the example does this
    justfo890
    @justfo890
    Hello all! I am using quill with y-websocket, and the backend is nestjs with ws library. Does anyone know if I need the room name of WebsocketProvider to be a document id, then how do I handle it with nestjs WebSocketGateway? Thank you!
    Janis Jendraß
    @rgby_gitlab
    I have to thank you all for your work and this amazing library. Over the last weeks I've been busy creating a collaborative note graphing application which I plan to release as open source after I cleaned everything up and added the features I'd like to see. If you want to have a look at it, check it out at https://lity.cc It's still buggy and some features need to implemented but maybe your eyes of expertise could see some problems I might not have in mind yet. Thanks and have good time!
    justfo890
    @justfo890
    kapil verma
    @kapv89
    @justfo890 you'd probably be better off with a separate node.js server handling the y-websocket connections ... check out this repo https://github.com/kapv89/yjs-scalable-ws-backend .. you can easily switch the interaction with db using knex to interaction with an api
    1 reply
    Linh Nguyen
    @LinhNguyen28
    Hi, I'm using yJS to make a collaborative application to create graphs/flowcharts and want to display different users' cursors with separate colors. I think yjs does offer bindings for text editors like Quill and Monaco but not sure if there is any built in tools that I can use for cursor tracking in collaborative graphing/drawing application? Thank you!
    2 replies
    Nigel Gilbert
    @micrology
    PRSM, a collaborative system mapping tool, has users' cursors with separate colours. You'll find the code for this at https://github.com/micrology/prsm/blob/master/js/prsm.js, line 3697 onwards. I hope it helps.
    1 reply
    YarnBall
    @yarnball
    Hi all, can someone point me to a current/good example of how to setup persistence on a server? I cant seem to find a recent oen
    Joshua Fontany
    @joshuafontany
    Hi. Is there anything in the Yjs libraries that would allow me to generate a quill-delta-diff of two texts? I need it for my wiki-(editor)-binding.
    Namit Chadha
    @nc
    @yarnball have you seen? https://github.com/yjs/y-redis
    Stefan de Konink
    @skinkie

    I am completely new to Yjs (and to npm etc.) I notice when I try to install y-array and y-text those have dependency issues. Could not resolve dependency: peer yjs@">= 12.3.1 < 13.0.0" from y-array@10.1.4

    Is this a known issue?

    Namit Chadha
    @nc
    @skinkie i think you just install 'yjs', does that not work?
    YarnBall
    @yarnball
    @nc I have seen that before, but I didnt know redis could/should be used as storage
    I was thinking more like something SQL right? This will be for large strings? Or is that not generally how it is used
    Will Heslam
    @willheslam

    Hello everyone :)
    I've had some trouble getting the subdocs example code to work
    https://docs.yjs.dev/api/subdocuments

    and I suspect it's due to this line:

    It is up to the providers to sync subdocuments.

    as I'm trying to manually sync the two root docs using
    Y.applyUpdateV2(rootDoc2, Y.encodeStateAsUpdateV2(rootDoc1))

    I'm assuming then that I need to use a fully fledged provider that can sync subdocuments properly.
    Looking at the provider list, there doesn't seem to be anything useful for local testing - some kind of in-memory provider (beyond the manual application of updates as in my example above). Is this something that exists, and what have people used instead?
    Would I have to implement it myself, similar to the code at the bottom of the subdocs docs page?
    e.g. doc.on('subdocs', ...
    Am I barking up the wrong tree here and overcomplicating it for myself?

    1 reply
    kapil verma
    @kapv89

    Hi all, can someone point me to a current/good example of how to setup persistence on a server? I cant seem to find a recent oen

    @yarnball you can check out this repo - https://github.com/kapv89/yjs-scalable-ws-backend

    dalperin
    @dalperin:matrix.org
    [m]
    Hey all, I don't know if this will be helpful to anyone else but I've open sourced my version of y-websocket with subdocument support. I'll update the example server implementation to make use of the subdoc protocol I added later on but for now a working version is here: https://github.com/DAlperin/y-websocket/blob/master/src/y-websocket.js
    1 reply
    Chance
    @chanced

    i'm curious if the benefits of the current way of encoding/decoding data (lib0) are significant enough to warrant the added cost in complexity and resistance to adoption in other languages?

    For example, readVarUint:

    numbers < 2^7 is stored in one bytlength
    numbers < 2^14 is stored in two bylength

    That pretty much eliminates using the standard buffer.readUInt8, for example, right?

    so in order for me to safety read the messageType, for example, I have to instantiate a decoder?
    Chance
    @chanced
    why not just work with buffers, utilizing the standard methods? with something like https://github.com/feross/buffer for the browser?

    i'm trying to understand the reasoning and whether or not a port to go would be feasible.

    uint8 would be a bad example.

    Kevin Jahns
    @dmonad

    There are few libraries that do variable-length encoding. buffer.readUint8 still uses 8 bytes for each integer. Furthermore, lib0/encoding also supports other types of efficient encoding and includes a library for RLE encoding. Node libraries are super bloated and have thousands of dependencies from questionable sources. And another thing: lib0 is much more performant than any other alternative. In some cases, lib0 is 1000x faster than alternatives.

    If you are interested in writing a Go binding for Yjs, then I recommend to have a look at the yjs/y-crdt project that already includes some language bindings to other languages. I recommend to join the next Y Community meeting if you have any questions.

    Chance
    @chanced
    @dmonad thats fair, thank you for the response
    Chance
    @chanced
    gotta say, you've done awesome work with yjs man.
    Kevin Jahns
    @dmonad
    Thanks @chanced
    Philip Aarseth
    @philipaarseth
    What is the best approach to clearing a yMap? seems there is no .clear() function so is looping through really the only alternative?
    wanuj
    @wanuj
    @dmonad is it possible for you to export some functions from Item.js , specially redoItem, followRedone, findIndexCleanStart, splitItem. I tried importing them directly from src/internals but i realised I cant make it work since you have placed lots of instanceof Item checks on these functions. The item instances are different for a doc created from the.mjs file and providers and y-prosemirror depend on that mjs file as well, so creating Doc from 'internals.js' does not work. I have re-included the functions thatredoItem and followRedone depend on to fork out just the undomanager. And I dont want to fork yjs repo completely. So if you could export them, that would be great.
    Kevin Jahns
    @dmonad
    @wanuj Exporting them means that I'd need to keep compatibility in future releases - and I can't guarantee that. Maybe you can import yjs/src/index instead (use a patch override in your module bundler)?
    @philipaarseth That is correct.
    Nigel Gilbert
    @micrology

    if I specify an origin for a Y.doc.transact, e.g.

    const ydoc = new Y.Doc();
    const ymap = ydoc.getMap('mymap');
    ydoc.transact(() => {ymap.set('foo', 'bar')}, 'myOrigin')

    and, using a WebSocket provider, use ymap.observe(event) on another client, the value of event.transaction.origin is not the expected myOrigin, but WebsocketProvider {....}. How can I get the origin I provided to ydoc.transact to appear in the second client as the origin of the transaction?

    Joshua Fontany
    @joshuafontany
    The origin of the incoming transaction would the the WebSocket provider on that side of the connection.
    Blake Miner
    @compwiz737:matrix.org
    [m]
    Is it possible for a Y.js node to be more authoritative, perhaps like a central server in some regard? More specifically, if Node A wants to send updates to Node B for document D, can Node B tell Node A to undo some of his changes to document D? The use case is an authoritative node that works to perform data validation on the document. Other nodes might place more trust in an authoritative node for this purpose.
    Blake Miner
    @compwiz737:matrix.org
    [m]
    Blake Miner
    @compwiz737:matrix.org
    [m]
    Now that I think about this more, this appears to be a fundamental limitation right now. One-way sync, read-only sync... it feels like fine-grained permissions / authorization, as well.
    Martin Ellern Bilgrau
    @ellern
    I'm trying to set up a SignalR connector - I've found a Typescript version inside the Ycs repo - but can't figure out how to get it transpiled to JS so I can use it in my non-typescript webpack config. I have no experience with React, so I'm a bit lost here. Any advise?