-
Notifications
You must be signed in to change notification settings - Fork 48
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
stabilize cursor over re-renderings #115
Comments
The heuristic that we're currently using is to stash the section & cursor offset within that section and then to try and apply that back again post-render which we've found to be "good enough" in most simple situations. If someone's added content in a previous section, then your cursor is kept in the same place in the section you're currently focused in. It doesn't handle the case of the current section having been edited before your cursor, as that ends up keeping your cursor at the same offset when you'd expect it to move if it were properly tracking the cursor (via OT/CRDTs etc…). There's much more we could probably do in future with proper cursor tracking & collaborative editing, but something like this could cover the low hanging fruit. I wonder if this is a job for ember-mobiledoc-editor or whether the code mobiledoc-kit should/could have stashCursor / applyCursor which the ember component hooks into. |
@rlivsey Thanks for explaining your approach. I've been in favor for a little while of making the (And yes, in the future a CRDT structure would be even more bullet-proof because it could handle repositioning the cursor even when the content before it was edited) |
A "dumber" |
It should be possible to use a heuristic to attempt to re-position the cursor at or near its position when the component's
mobiledoc
changes and the editor rerenders.See #112 (comment)
The text was updated successfully, but these errors were encountered: