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

Implement merge elements in Tree.Edit #659

Merged
merged 5 commits into from
Nov 3, 2023
Merged

Implement merge elements in Tree.Edit #659

merged 5 commits into from
Nov 3, 2023

Conversation

hackerwins
Copy link
Member

@hackerwins hackerwins commented Nov 3, 2023

What this PR does / why we need it:

Implement merge feature in Tree.Edit

In a text-based editor, when you have a selection that spans two paragraphs, if you press the delete key, removes the second paragraph and merges its children into the first paragraph.

For example:

  • Before: <p>a|b</p><p>c|d</p>
  • After: <p>ad</p>

This commit implements the merge to Tree.Edit.

Which issue(s) this PR fixes:

Address #662

Special notes for your reviewer:

// TODO(hackerwins): Define more clearly mergeable rules between fromParent
// and toParent. For now, if fromParent and toParent are the same
// type, then we can merge them.

Does this PR introduce a user-facing change?:


Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@f922afc). Click here to learn what that means.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #659   +/-   ##
=======================================
  Coverage        ?   48.96%           
=======================================
  Files           ?       69           
  Lines           ?    10090           
  Branches        ?        0           
=======================================
  Hits            ?     4941           
  Misses          ?     4631           
  Partials        ?      518           
Files Coverage Δ
pkg/document/crdt/text.go 61.90% <100.00%> (ø)
pkg/index/tree.go 56.30% <100.00%> (ø)
server/backend/database/mongo/client.go 39.58% <100.00%> (ø)
server/backend/sync/memory/coordinator.go 31.25% <ø> (ø)
server/backend/database/memory/database.go 48.09% <66.66%> (ø)
server/backend/sync/memory/locker.go 0.00% <0.00%> (ø)
pkg/document/crdt/tree.go 52.92% <75.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hackerwins hackerwins merged commit 79b5012 into main Nov 3, 2023
2 checks passed
@hackerwins hackerwins deleted the tree-merge-split branch November 3, 2023 10:28
hackerwins added a commit that referenced this pull request Nov 3, 2023
In a text-based editor, when you have a selection that spans two
paragraphs, if you press the delete key, removes the second paragraph
and merges its children into the first paragraph.

For example:

Before: `<p>a|b</p><p>c|d</p>`
After: `<p>ad</p>`

This commit implements the merge to Tree.Edit.
hackerwins added a commit that referenced this pull request Nov 3, 2023
In a text-based editor, when you have a selection that spans two
paragraphs, if you press the delete key, removes the second paragraph
and merges its children into the first paragraph.

For example:

Before: `<p>a|b</p><p>c|d</p>`
After: `<p>ad</p>`

This commit implements the merge to Tree.Edit.
hackerwins added a commit that referenced this pull request Nov 4, 2023
In a text-based editor, when you have a selection that spans two
paragraphs, if you press the delete key, removes the second paragraph
and merges its children into the first paragraph.

For example:

Before: `<p>a|b</p><p>c|d</p>`
After: `<p>ad</p>`

This commit implements the merge to Tree.Edit.
hackerwins added a commit that referenced this pull request Nov 4, 2023
In a text-based editor, when you have a selection that spans two
paragraphs, if you press the delete key, removes the second paragraph
and merges its children into the first paragraph.

For example:

Before: `<p>a|b</p><p>c|d</p>`
After: `<p>ad</p>`

This commit implements the merge to Tree.Edit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant