From 105bead60e2123cfac724cdbea3391be6b5e94d9 Mon Sep 17 00:00:00 2001 From: gyuwonMoon <78714820+MoonGyu1@users.noreply.github.com> Date: Fri, 25 Aug 2023 15:59:15 +0900 Subject: [PATCH] Add path example --- design/concurrent-tree-editing.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/design/concurrent-tree-editing.md b/design/concurrent-tree-editing.md index 82b0698be..f9b473532 100644 --- a/design/concurrent-tree-editing.md +++ b/design/concurrent-tree-editing.md @@ -27,17 +27,19 @@ In yorkie, a JSON-like `Tree` is used to represent the document model of a tree- This tree-based document model resembles XML tree and consists of element nodes and text nodes. element nodes can have attributes, and text nodes contain a string as their value. For example: - + **Operation** -The JSON-like `Tree` provides specialized operations tailored for text editing rather than typical operations of a general tree. To specify the operation's range, an `index` is used. For example: +The JSON-like `Tree` provides specialized operations tailored for text editing rather than typical operations of a general tree. To specify the operation's range, an `index` or `path` is used. For example: - + These `index`es are assigned in order at positions where the user's cursor can reach. These `index`es draw inspiration from ProseMirror's index and share a similar structural concept. +In the case of a `path`, it contains `offset`s of each node from the root node as elements except the last. The last element of the `path` represents the position in the parent node. For example, the `path` of the position between '`k`' and '`i`' is `[1, 4]`. The first element of the `path` is the `offset` of the `` in `
` and the second element represents the position between '`k`' and '`i`' in ``. + 1. `Tree.Edit` Users can use the `Edit` operation to insert or delete nodes within the `Tree`. @@ -119,7 +121,7 @@ In the case of local editing, the given `index`es are converted to `CRDTTree.Tre **Coverage** - + Using conditions such as range type, node type, and edit type, 27 possible cases of concurrent editing can be represented.