-
Notifications
You must be signed in to change notification settings - Fork 64
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
Adding presence to ot-json0 #25
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool!
The package name changed here.
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "ot-json0", | |||
"version": "1.1.0", | |||
"name": "@houshuang/ot-json0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems out of place for this PR.
lib/json0.js
Outdated
// of the same subtype, not sure if this is a given. | ||
// We're only concerned about the first level of object/array, | ||
// not sure if the spec allows nesting of subtypes. | ||
json.transformPresence = function(presence, op, isOwn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thrilled to see this development!
It would be awesome if these functions were covered by tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The next step would be to handle transformation of nested structures recursively.
Also, it would be interesting to implement presence for text0, since it's embedded within json0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it would be interesting to implement presence for text0, since it's embedded within json0.
In fact, that PR was submitted in error - I was trying to submit against a different upstream :) I thought I closed it, but I guess I didn't. Anyway we are absolutely happy to share this work, just not quite done yet (but feedback welcome!). Here's a quick demo video with Quill and presence/shared cursors. https://www.youtube.com/watch?v=CVjH56Q18cU I'll probably not handle nested subtypes right now, but would love to see someone tackle that. I will however work on text0, and also a very simple approach to registering presence in a field (with no transformations). I guess it makes no sense to submit PR to this repo unless they merge the main presence PR to sharedb core... Unfortunately ot-json0 is hard-coded into sharedb, which I want to try to change, because we would prefer to use @Teamwork fork (or main sharedb if presence gets merged), however right now that's impossible with a different ot-json0 implementation. (It complains "Wrong basic type" or something like that). Also want to add tests. Need to see what already exists, and what I can add. |
@houshuang Thanks for your response! It is indeed unfortunate that I'm leaning towards using the @Teamwork fork as well, mainly for its presence implementation. I'm thrilled to hear you're interested in working on I stumbled on this, which may be interesting: Interesting Cursor Transform Work by Robert Lord #27 |
Here's the code that errors out:
```
if (types.map[message.type] !== types.defaultType) {
err = new ShareDBError(4020, 'Invalid default type');
return this.emit('error', err);
```
(lib/client/connection.js:198)
We can either remove that (I did, and it worked), or instead of this line
in lib/types.js:
```
exports.defaultType = require('ot-json0').type;
```
instead have the user pass in an ot-json0 library as an option when
instantiating ShareDB...
…On Tue, Apr 9, 2019 at 3:08 PM Curran Kelleher ***@***.***> wrote:
@houshuang <https://github.com/houshuang> Thanks for your response!
It is indeed unfortunate that ot-json0 is hard-coded into ShareDB. My gut
feeling is that ShareDB should be able to handle a different type as the
base type for documents, but I've never tried it.
I'm leaning towards using the @Teamwork <https://github.com/Teamwork>
fork as well, mainly for its presence implementation.
I'm thrilled to hear you're interested in working on text0. I will be
following this work closely and perhaps we can collaborate on it, as I'm
keen to implement presence text0 strings that are deeply nested within
json0 documents.
I stumbled on this, which may be interesting: *Interesting Cursor
Transform Work by Robert Lord* #27
<#27>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#25 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AADwh8hddK1tJb2mkpd_4-LhKs2_cY0rks5vfJDRgaJpZM4ccpLb>
.
--
http://reganmian.net/blog -- Random Stuff that Matters
|
I started continuing this work on presence over here datavis-tech#2 |
@houshuang That error might make a good issue on the ShareDB repo. My gut feeling is that, in principle, you should be able to set the default OT type. |
Superseded by #31 |
No description provided.