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

feat(ui, dom-adapters): cross-input selection #118

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

neSpecc
Copy link
Contributor

@neSpecc neSpecc commented Apr 12, 2025

  1. UI blocks wrapper now contenteditable which enables cross-input selection (CIS)
  2. BlockToolAdapter (all of them for each input) delegates ui:before-input to all affected inputs. To find them, it checks current range and compare its start/end with input position.
  3. Delete handler updated: now it has 4 cases:
  • when CIS starts in inout
  • when CIS ends in input
  • when input in-between CIS
  • when range is inside the input
  1. Enter (Split) logic improved: it is being applied only for cases:
  • when CIS starts in inout
  • when range is inside the input
  1. On any inputType we first remove selected range of CIS
  2. CaretAdapter now stores this.#blocks instead of this.#inputs. Thus, we won't care about managing input indexes (with block index) on block removing/moving.

Copy link

github-actions bot commented Apr 12, 2025

Coverage report for ./packages/dom-adapters

St.
Category Percentage Covered / Total
🟢 Statements 100% 0/0
🟢 Branches 100% 0/0
🟢 Functions 100% 0/0
🟢 Lines 100% 0/0

Test suite run success

1 tests passing in 1 suite.

Report generated by 🧪jest coverage report action from b6d8022

Copy link

github-actions bot commented Apr 12, 2025

Coverage report for ./packages/model

St.
Category Percentage Covered / Total
🟢 Statements
99.65% (+0% 🔼)
853/856
🟢 Branches 98.7% 228/231
🟢 Functions 98.1% 207/211
🟢 Lines
99.64% (+0% 🔼)
820/823

Test suite run success

441 tests passing in 25 suites.

Report generated by 🧪jest coverage report action from b6d8022

Copy link

github-actions bot commented Apr 12, 2025

Coverage report for ./packages/ot-server

St.
Category Percentage Covered / Total
🟡 Statements 70.97% 22/31
🔴 Branches 20% 1/5
🟡 Functions 75% 6/8
🟡 Lines 68.97% 20/29

Test suite run success

4 tests passing in 1 suite.

Report generated by 🧪jest coverage report action from b6d8022

Copy link

github-actions bot commented Apr 12, 2025

Coverage report for ./packages/collaboration-manager

St.
Category Percentage Covered / Total
🟡 Statements 67.51% 160/237
🟢 Branches 80% 60/75
🔴 Functions 57.14% 20/35
🟡 Lines 67.52% 158/234

Test suite run success

67 tests passing in 4 suites.

Report generated by 🧪jest coverage report action from b6d8022

Copy link

github-actions bot commented Apr 12, 2025

⏭️ No files to mutate for ./packages/model

Copy link

github-actions bot commented Apr 12, 2025

⏭️ No files to mutate for ./packages/dom-adapters

public detachBlock(index: Index): void {
const block = this.getBlock(index);

if (block) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverse to reduce nesting

public getBlock(index?: Index): BlockToolAdapter | undefined {
if (index === undefined) {
if (this.#currentUserCaret.index === null) {
throw new Error('[CaretManager] No index provided and no user caret index found');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just return null?

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.

3 participants