Skip to content

API > @blocksuite/blocks > getCombinedFormatInTextSelection

Function: getCombinedFormatInTextSelection ​

getCombinedFormatInTextSelection( root, textSelection, loose = false): AffineTextAttributes

By default, it is in strict mode, which only returns the formats that all the text in the range share. formats with different values, such as different links, are considered different formats.

If the loose mode is enabled, any format that exists in the range will be returned. formats with different values will only return the last one.

Parameters ​

ParameterTypeDefault value
rootBlockSuiteRootundefined
textSelectionTextSelectionundefined
loosebooleanfalse

Returns ​

AffineTextAttributes

Defined In ​

packages/blocks/src/page-block/utils/selection.ts:141