Skip to content
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

Add Tree.move #638

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
04ac8b5
Define InternalOperation and InternalEditOperation
JOOHOJANG Aug 31, 2023
d1fd7f1
Make array util to find upperBound of array from given key and compar…
JOOHOJANG Aug 31, 2023
901265b
Define traverseInSubtree to traverse subtree of given root, left, and…
JOOHOJANG Aug 31, 2023
0da75ee
Define undo of Edit
JOOHOJANG Aug 31, 2023
b6b77f8
Define undo and do
JOOHOJANG Aug 31, 2023
2ae33e7
Change Edit to run undo => do => redo
JOOHOJANG Aug 31, 2023
74f9b1d
Make comments to unnecessary codes in future
JOOHOJANG Aug 31, 2023
4190eca
Define doStyle, undoStyle
JOOHOJANG Sep 8, 2023
955e56a
Merge branch 'main' of https://github.com/yorkie-team/yorkie-js-sdk i…
JOOHOJANG Sep 8, 2023
7dabc5c
Define move operation
JOOHOJANG Sep 11, 2023
4e41620
Define DoMove
JOOHOJANG Sep 11, 2023
0c2eb08
Define move
JOOHOJANG Sep 11, 2023
325ea93
Clean up unnecessary codes
JOOHOJANG Sep 11, 2023
56ef7db
Add unit test
JOOHOJANG Sep 13, 2023
d25095e
Add move to json/tree
JOOHOJANG Sep 13, 2023
6ad2693
Define TreeMoveRange to check range is separated or contained
JOOHOJANG Sep 13, 2023
6ead2ad
Let deepcopy to preserve node's insNextID / insPrevID
JOOHOJANG Sep 13, 2023
fb90600
Add moveByIndex to testing purpose
JOOHOJANG Sep 13, 2023
e01d81f
Let CRDTTree.move to use CRDTTreePos rather than number
JOOHOJANG Sep 13, 2023
43c70f1
Define doMove and undoMove
JOOHOJANG Sep 13, 2023
5c6f177
Restore style to use traverseInPosRange
JOOHOJANG Sep 13, 2023
8c74057
Add move operation to do/undo
JOOHOJANG Sep 13, 2023
9ba0aa4
Add traverseBetweenNodes
JOOHOJANG Sep 18, 2023
e5fac9a
Merge branch 'main' of https://github.com/yorkie-team/yorkie-js-sdk i…
JOOHOJANG Oct 13, 2023
4404702
change usage of latestCreatedAtMap when undo do redo ops
JOOHOJANG Oct 16, 2023
6c0ac19
remove unused method and add tc
JOOHOJANG Oct 16, 2023
a356923
add tc (move multiple nodes at once)
JOOHOJANG Oct 16, 2023
c4f0cbb
remove comments and fix test desc
JOOHOJANG Oct 16, 2023
68c21cd
Define trashNode to keep reference of tombstone nodes
JOOHOJANG Oct 18, 2023
d173d9a
Remove useless method
JOOHOJANG Oct 18, 2023
f1e5054
Redefine undo/redo to make latestCreatedAtMapFromUndo and use it
JOOHOJANG Oct 18, 2023
15c5435
Add TC for Tree.edit(merge)
JOOHOJANG Oct 25, 2023
c259720
Implement merge nodes
JOOHOJANG Oct 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions public/prosemirror.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ <h2>Yorkie.RGASplit</h2>
await client.activate();

// 01. Build yorkie.Text from ProseMirror doc.
const doc = new yorkie.Document('prosemirror');
const doc = new yorkie.Document('prosemirror01234567890123456789');
window.doc = doc;
await client.attach(doc);
doc.update((root) => {
Expand Down Expand Up @@ -352,13 +352,14 @@ <h2>Yorkie.RGASplit</h2>
gapFrom,
gapTo,
structure,
insert,
slice: { content, openStart, openEnd },
} = step;

// 02-1. Backspace: Level delete
// TODO(hackerwins): replaceAround replaces the given range with given gap.
if (stepType === 'replaceAround') {
root.tree.move(from, to, gapFrom, gapTo);
root.tree.move(from, to, gapFrom, gapTo, insert, ...content.content.map(content => docToTreeNode(content.toJSON())));
continue;
}

Expand Down
7 changes: 7 additions & 0 deletions src/document/crdt/rht.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ export class RHT {
return this.nodeMapByKey.has(key);
}

/**
* `delete` deletes the key
*/
public delete(key: string) {
return this.nodeMapByKey.delete(key);
}

/**
* `get` returns the value of the given key.
*/
Expand Down
Loading
Loading