Skip to content

cupertino-files / ParagraphHandle

Class: ParagraphHandle

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

Constructors

Constructor

new ParagraphHandle(storage, index): ParagraphHandle

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

Parameters

storage

TextStorage

index

number

Returns

ParagraphHandle

Properties

index

readonly index: number

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


storage

readonly storage: TextStorage

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

Accessors

direction

Get Signature

get direction(): "ltr" | "rtl" | "natural"

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

Base writing direction — where "natural" resolves from the text.

Returns

"ltr" | "rtl" | "natural"


hasDirectFormatting

Get Signature

get hasDirectFormatting(): boolean

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

True when the paragraph carries direct formatting: its style object is the anonymous child format creates, rather than the named style itself. styleName still names the style it inherits.

Returns

boolean


listStyleId

Get Signature

get listStyleId(): bigint | undefined

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

Returns

bigint | undefined


listStyleName

Get Signature

get listStyleName(): string | undefined

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

Returns

string | undefined


styleId

Get Signature

get styleId(): bigint | undefined

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

Returns

bigint | undefined


styleName

Get Signature

get styleName(): string | undefined

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

The named style this paragraph reads as — resolved through the parent chain, so direct formatting does not hide it. This is the name a table of contents collects by.

Returns

string | undefined


text

Get Signature

get text(): string

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

Returns

string

Set Signature

set text(value): void

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

Parameters
value

string

Returns

void

Methods

delete()

delete(): void

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

Delete the paragraph including its terminator.

Returns

void


format()

format(formatting, character?): this

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

Apply direct paragraph formatting: create an anonymous paragraph style parented on the one currently in effect, and assign it to this paragraph alone. Prefer editing a named style when the change should apply everywhere that style is used.

Parameters

formatting

ParagraphFormatting

character?

CharacterFormatting

Returns

this


insertAfter()

insertAfter(text, style?): ParagraphHandle

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

Insert a new paragraph after this one; returns its handle.

Parameters

text

string

style?

string | bigint

Returns

ParagraphHandle


range()

range(): TextRange

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

Range covering the paragraph's text (excluding the terminator).

Returns

TextRange


setDirection()

setDirection(direction): this

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

Flip the paragraph's base direction, as the app's ⇄ control does.

Parameters

direction

"ltr" | "rtl" | "natural"

Returns

this


setListStyle()

setListStyle(style): this

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

Parameters

style

string | bigint

Returns

this


setStyle()

setStyle(style): this

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

Parameters

style

string | bigint

Returns

this

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