Skip to content

cupertino-files / TextRange

Class: TextRange

Defined in: src/tswp/range.ts:18

Constructors

Constructor

new TextRange(storage, start, end): TextRange

Defined in: src/tswp/range.ts:25

Parameters

storage

TextStorage

start

number

end

number

Returns

TextRange

Properties

end

readonly end: number

Defined in: src/tswp/range.ts:21


start

readonly start: number

Defined in: src/tswp/range.ts:20


storage

readonly storage: TextStorage

Defined in: src/tswp/range.ts:19

Accessors

text

Get Signature

get text(): string

Defined in: src/tswp/range.ts:53

Returns

string

Methods

applyCharacterStyle()

applyCharacterStyle(style): this

Defined in: src/tswp/range.ts:134

Apply a character style by name or id (undefined restores paragraph style).

Parameters

style

string | bigint | undefined

Returns

this


applyListStyle()

applyListStyle(style): this

Defined in: src/tswp/range.ts:153

Apply a list style (e.g. "Bullet", "Numbered", "None") to intersecting paragraphs.

Parameters

style

string | bigint

Returns

this


applyParagraphStyle()

applyParagraphStyle(style): this

Defined in: src/tswp/range.ts:145

Apply a paragraph style to every paragraph intersecting this range.

Parameters

style

string | bigint

Returns

this


asPlaceholder()

asPlaceholder(): this

Defined in: src/tswp/range.ts:168

Mark this range as template placeholder text (tap to replace).

Returns

this


bold()

bold(value?): this

Defined in: src/tswp/range.ts:86

Parameters

value?

boolean = true

Returns

this


color()

color(r, g, b, a?): this

Defined in: src/tswp/range.ts:106

Parameters

r

number

g

number

b

number

a?

number = 1

Returns

this


delete()

delete(): void

Defined in: src/tswp/range.ts:65

Returns

void


fontName()

fontName(postScriptName): this

Defined in: src/tswp/range.ts:102

Parameters

postScriptName

string

Returns

this


fontSize()

fontSize(points): this

Defined in: src/tswp/range.ts:98

Parameters

points

number

Returns

this


format()

format(formatting): this

Defined in: src/tswp/range.ts:76

Apply direct character formatting (one anonymous character style over the range, parented on the style in effect at start). Prefer a single call with all properties over chaining sugar methods — each call creates one style object.

Parameters

formatting

CharacterFormatting

Returns

this


formatParagraphs()

formatParagraphs(formatting): this

Defined in: src/tswp/range.ts:128

Apply direct paragraph formatting to every paragraph in this range.

Parameters

formatting

ParagraphFormatting

Returns

this


highlight()

highlight(color): this

Defined in: src/tswp/range.ts:111

Highlight colour drawn behind the glyphs.

Parameters

color

Color | undefined

Returns

this


italic()

italic(value?): this

Defined in: src/tswp/range.ts:90

Parameters

value?

boolean = true

Returns

this


link(url): this

Defined in: src/tswp/range.ts:161

Make this range a hyperlink.

Parameters

url

string

Returns

this


paragraphIndexes()

paragraphIndexes(): number[]

Defined in: src/tswp/range.ts:181

Returns

number[]


paragraphs()

paragraphs(): ParagraphHandle[]

Defined in: src/tswp/range.ts:195

Returns

ParagraphHandle[]


replaceWith()

replaceWith(text): TextRange

Defined in: src/tswp/range.ts:59

Replace this range's text; returns the range covering the replacement.

Parameters

text

string

Returns

TextRange


strikethrough()

strikethrough(value?): this

Defined in: src/tswp/range.ts:115

Parameters

value?

boolean = true

Returns

this


subscript()

subscript(): this

Defined in: src/tswp/range.ts:123

Returns

this


superscript()

superscript(): this

Defined in: src/tswp/range.ts:119

Returns

this


underline()

underline(value?): this

Defined in: src/tswp/range.ts:94

Parameters

value?

boolean = true

Returns

this


unlink(): this

Defined in: src/tswp/range.ts:175

Remove hyperlinks overlapping this range.

Returns

this

MIT licensed. Independently made — not by Apple in California. Not affiliated with or endorsed by Apple Inc.