typing/utils/getlasttextline
module
Type Definitions
module:typing/utils/getlasttextline~LastTextLineData
Functions
getLastTextLine( range, model ) → LastTextLineDatamodule:typing/utils/getlasttextline~getLastTextLineReturns the last text line from the given range.
"The last text line" is understood as text (from one or more text nodes) which is limited either by a parent block or by inline elements (e.g.
<softBreak>).const rangeToCheck = model.createRange( model.createPositionAt( paragraph, 0 ), model.createPositionAt( paragraph, 'end' ) ); const { text, range } = getLastTextLine( rangeToCheck, model );Copy codeFor model below, the returned
textwill be "Foo bar baz" andrangewill be set on whole<paragraph>content:<paragraph>Foo bar baz<paragraph>Copy codeHowever, in below case,
textwill be set to "baz" andrangewill be set only on "baz".<paragraph>Foo<softBreak></softBreak>bar<softBreak></softBreak>baz<paragraph>Copy codeParameters
range : ModelRangemodel : Model
Returns