facebook / facebook/lexical

Feature: make CreateRangeSelection meaningful

Open
#5,457 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 16h
Merged PRs (30d)
61

Description

Currently, the `$createRangeSelection` function trivially select the first position [see here](https://github.com/facebook/lexical/blob/14554bf94d20405d27efcfe4dcaf457a3db4457f/packages/lexical/src/LexicalSelection.ts#L2250). If it is the intended behavior, I suggest the naming to be changed to `$selectFirstPosition`.
To me, I believe `$createRangeSelection` should accept couple of options that specifies the key, type and offset for both anchor and focus, to make it more flexible and useful.

If there's another way to create a rangeSelection, please kindly instruct me. Thank you.

Contributor guide

Open the contributing guide

Research direction

Start at packages/lexical/src/LexicalSelection.ts around line 2250 and inspect $createRangeSelection. Clarify whether the intended change is renaming it to $selectFirstPosition or adding key, type, and offset options for both anchor and focus. Done requires an agreed API and defined behavior for creating both positions.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.