[WIP] cross-page scope cut-copy-paste #184
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: Don't merge, this is a draft for tests and ideas
Usage:
like
codeNode
, click on the button, Ctrl-v to paste, click on pane to confirm, Esc-v to cancel. Others could see nothing until the new nodes are placed.qq20221226201103_YAKQ7k4D.mp4
The key challenge here is how to handle condition/data races almost everywhere (DB <->
store.pods
<-> localnodes
<-> yjs nodesMap, all updates propagate in bi-directions and with different unstable delay) when manipulating a bunch of pods at once, which make the entire thing horrible, for examples:getNode(id)
andnodesMap(id)
may give different results when creating formal nodes due to the sync speed between front-end and yjs server. (mitigation: use different kits of node id for original pods, temporary pods and formal pods, though they are all the same data, usepasteNode
to first updatestore.pods
, and thengenerateNodes
to push nodes to yjs server according tostore.pods
, DFS in pre-order to make sure the parentNode created as early as possible)nodesMap
ornodes
, we may regard it as a target scope (Mitigation: ad-hoc rules to avoid dropping into any hidden/transparent scopes)Tests and feedback are welcome. I will improve the code and performance these days.