Socket
Socket
Sign inDemoInstall

@lexical/selection

Package Overview
Dependencies
1
Maintainers
7
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @lexical/selection

This package contains utilities and helpers for handling Lexical selection.


Version published
Weekly downloads
374K
decreased by-3.04%
Maintainers
7
Created
Weekly downloads
 

Changelog

Source

v0.8.1 (2023-02-22)

  • Clone objects from the CSS cache before mutating them (#3945) Brian Birtles
  • added docsfeature-button in lexical playground issue#3918 (#3935) Mohan Sai Potla
  • fix: change from to (#3942) Asim Kattum Thazha
  • Added Chinese character support for native webkit (#3846) Annabelle Almås
  • Fix autocapitalization (#3881) Gerard Rovira
  • Expand the actionable empty playground editor text area via flex (#3883) Brandon
  • Fix toggling styles on collapsed selections with (#3922) Brian Birtles
  • Remove condition for history merge on null prev selection (#3914) Acy Watson
  • fix: change tablecell return type for TableCellNode (#3925) Sebastien Ahkrin
  • Align types for createEditor APIs (#3928) Acy Watson
  • Remove instanceof type checks against HTMLElement and subtypes (#3913) Acy Watson
  • Fix small lint error breaking main (#3924) John Flockton
  • Update plugins.md (#3926) dimitarbikov
  • Added support for Java & C++ (#3884) Vignesh gupta
  • Add fixme annotation to flaky collab tests (#3916) Acy Watson
  • Playground: fix issue with floating link editor plugin not closing (#3904) Rich
  • Further tweaks to format/style selection (#3895) Dominic Gannaway
  • Add KEY_DOWN_COMMAND (#3878) Dominic Gannaway
  • Remove draggable block plugin on mobile devices (#3875) John Flockton
  • Close color pickers on select (#3874) John Flockton
  • Fix ContentEditable types for internal use (#3868) John Flockton
  • Fix v0.8.9 typo in changelog, should be v0.8.0 (#3869) Joel Besada

Readme

Source

@lexical/selection

This package contains selection helpers for Lexical.

Methods

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_experimental

Converts all nodes in the selection that are of one block type to another specified by parameter

export function $setBlocksType_experimental(
  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;

Keywords

FAQs

Last updated on 23 Feb 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc