Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
@lexical/selection
Advanced tools
This package contains utilities and helpers for handling Lexical selection.
@lexical/selection
This package contains selection helpers for Lexical.
getStyleObjectFromCSS
Given a CSS string, returns an object from the style cache.
export function getStyleObjectFromCSS(css: string): {
[key: string]: string;
} | null;
$patchStyleText
Applies the provided styles to the TextNodes in the provided Selection. Key names in the patch argument should be the valid CSS properties (i.e., kebab-case).
export function $patchStyleText(
selection: RangeSelection | GridSelection,
patch: {
[key: string]: string;
},
): void;
$getSelectionStyleValueForProperty
Given a selection and a valid CSS property name, returns the current value of that property for TextNodes in the Selection, if set. If not set, it returns the defaultValue. If all TextNodes do not have the same value, it returns an empty string.
export function $getSelectionStyleValueForProperty(
selection: RangeSelection,
styleProperty: string,
defaultValue: string,
): string;
$moveCaretSelection
Moves the selection according to the arguments.
export function $moveCaretSelection(
selection: RangeSelection,
isHoldingShift: boolean,
isBackward: boolean,
granularity: 'character' | 'word' | 'lineboundary',
): void;
$isParentElementRTL
Returns true if the parent of the Selection anchor node is in Right-To-Left mode, false if not.
export function $isParentElementRTL(selection: RangeSelection): boolean;
$moveCharacter
Wraps $moveCaretSelection, using character granularity and accounting for RTL mode.
export function $moveCharacter(
selection: RangeSelection,
isHoldingShift: boolean,
isBackward: boolean,
): void;
$selectAll
Expands the current Selection to cover all of the content in the editor.
export function $selectAll(selection: RangeSelection): void;
$setBlocksType
Converts all nodes in the selection that are of one block type to another specified by parameter
export function $setBlocksType(
selection: RangeSelection,
createElement: () => ElementNode,
): void;
$isAtNodeEnd
Returns true if the provided point offset is in the last possible position.
export function $isAtNodeEnd(point: Point): boolean;
$shouldOverrideDefaultCharacterSelection
Returns true if default character selection should be overridden, false if not. Used with DecoratorNodes
export function $shouldOverrideDefaultCharacterSelection(
selection: RangeSelection,
isBackward: boolean,
): boolean;
v0.11.3 (2023-07-18)
FAQs
This package contains utilities and helpers for handling Lexical selection.
The npm package @lexical/selection receives a total of 545,772 weekly downloads. As such, @lexical/selection popularity was classified as popular.
We found that @lexical/selection demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.