-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement splitLevel of Tree.Edit (#705)
When a user positions the cursor within a paragraph and hits the enter key, the paragraph is divided into two separate paragraphs: - Original: `<p>a|b</p>` - Result: `<p>a</p><p>b</p>` In this commit, `splitLevel` is introduced to support this scenario. ```ts doc.update((root) => { root.tree.edit([0,0], {type:'p',children:[{type:'text', value: 'ab'}]}); root.tree.edit([2,2], undefined, 1); // split the paragraph }); ``` This commit does not cover all test cases that may arise due to the split operation. This is because we need to verify the interface first. we need to add test cases in the simultaneous editing situation to verify the algorithm later.
- Loading branch information
1 parent
12e86a2
commit 8ede955
Showing
15 changed files
with
1,104 additions
and
732 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,7 +117,7 @@ func TestConverter(t *testing.T) { | |
Type: "text", | ||
Value: "Hello world", | ||
}}, | ||
}) | ||
}, 0) | ||
|
||
return nil | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.