Skip to main content

StyleHandler

Classes

StyleHandler

Handler for performing simple operations with paragraph and character styles.

Remarks

the TextWhizz is used as a text engine.

Implements

Constructors

Constructor
new StyleHandler(tw, colorPreviewService): StyleHandler;
Parameters
ParameterType
twITextWhizzHolder
colorPreviewServiceIColorPreviewService
Returns

StyleHandler

Accessors

colorPalette
Get Signature
get colorPalette(): IColorPalette;
Returns

IColorPalette

isInitialized
Get Signature
get isInitialized(): boolean;
Returns

boolean

styleChangeEvent
Get Signature
get styleChangeEvent(): EventObject<void>;

Character or paragraph style change event.

Returns

EventObject<void>

Character or paragraph style change event.

Implementation of

IStyleHandler.styleChangeEvent

Methods

clearFormatForCurrentPosition()
clearFormatForCurrentPosition(): void;

Clears the character style for the current cursor position.

Returns

void

Implementation of

IStyleHandler.clearFormatForCurrentPosition

clearFormatForRange()
clearFormatForRange(textRange): void;

Clears the character style for the text range.

Parameters
ParameterTypeDescription
textRangeITextRangetext range.
Returns

void

Implementation of

IStyleHandler.clearFormatForRange

getCharStyleForCurrentPosition()
getCharStyleForCurrentPosition(): ICharStyle;

Returns the character style for the current cursor position.

Returns

ICharStyle

Implementation of

IStyleHandler.getCharStyleForCurrentPosition

getCharStyleForPosition()
getCharStyleForPosition(position): ICharStyle;

Returns the character style by position.

Parameters
ParameterTypeDescription
positionIPositionInTextposition in text.
Returns

ICharStyle

Implementation of

IStyleHandler.getCharStyleForPosition

getCharStyleForRange()
getCharStyleForRange(range): ICharStyle;

Returns the character style for a text range.

Parameters
ParameterTypeDescription
rangeITextRangetext range.
Returns

ICharStyle

Implementation of

IStyleHandler.getCharStyleForRange

getDefaultCharStyle()
getDefaultCharStyle(): ICharStyle;

Returns the default character style.

Returns

ICharStyle

Implementation of

IStyleHandler.getDefaultCharStyle

getDefaultParagraphStyle()
getDefaultParagraphStyle(): IParagraphStyle;

Returns the default paragraph style.

Returns

IParagraphStyle

Implementation of

IStyleHandler.getDefaultParagraphStyle

getParagraphStyleByIndex()
getParagraphStyleByIndex(index): IParagraphStyle;

Returns the paragraph style by index.

Parameters
ParameterTypeDescription
indexnumberparagraph index (from 0).
Returns

IParagraphStyle

Implementation of

IStyleHandler.getParagraphStyleByIndex

getParagraphStyleForCurrentPosition()
getParagraphStyleForCurrentPosition(): IParagraphStyle;

Returns the paragraph style for the current cursor position.

Returns

IParagraphStyle

Implementation of

IStyleHandler.getParagraphStyleForCurrentPosition

getParagraphStyleForRange()
getParagraphStyleForRange(range): IParagraphStyle;

Returns the paragraph style for a text range.

Parameters
ParameterTypeDescription
rangeITextRangetext range.
Returns

IParagraphStyle

Implementation of

IStyleHandler.getParagraphStyleForRange

initialize()
initialize(colorPalette): void;
Parameters
ParameterType
colorPaletteCollection<IColorData>
Returns

void

setCharStyleForCurrentPosition()
setCharStyleForCurrentPosition(style): void;

Sets the character style for the current cursor position (patch).

Parameters
ParameterTypeDescription
styleICharStyleexpected character style.
Returns

void

Remarks

Only those properties that are specified in expected style are set.

Implementation of

IStyleHandler.setCharStyleForCurrentPosition

setCharStyleForPosition()
setCharStyleForPosition(position, style): void;

Sets the character style by position.

Parameters
ParameterTypeDescription
positionIPositionInTextposition in text.
styleICharStylecharacter style.
Returns

void

Remarks

Only those properties that are specified in expected style are set.

Implementation of

IStyleHandler.setCharStyleForPosition

setCharStyleForRange()
setCharStyleForRange(style, range): void;

Sets the character style for a text range (patch).

Parameters
ParameterTypeDescription
styleICharStylecharacter style.
rangeITextRangetext range.
Returns

void

Remarks

Only those properties that are specified in expected style are set.

Implementation of

IStyleHandler.setCharStyleForRange

setDefaultCharStyle()
setDefaultCharStyle(style): void;

Sets the default character style.

Parameters
ParameterTypeDescription
styleICharStylecharacter style.
Returns

void

Implementation of

IStyleHandler.setDefaultCharStyle

setDefaultParagraphStyle()
setDefaultParagraphStyle(style): void;

Sets the default paragraph style.

Parameters
ParameterTypeDescription
styleIParagraphStyleparagraph style.
Returns

void

Implementation of

IStyleHandler.setDefaultParagraphStyle

setParagraphStyleByIndex()
setParagraphStyleByIndex(index, style): void;

Sets the paragraph style for the current cursor position (patch).

Parameters
ParameterTypeDescription
indexnumberparagraph index (from 0).
styleIParagraphStyleexpected paragraph style.
Returns

void

Implementation of

IStyleHandler.setParagraphStyleByIndex

setParagraphStyleForCurrentPosition()
setParagraphStyleForCurrentPosition(style): void;

Sets the paragraph style for the current cursor position (patch).

Parameters
ParameterTypeDescription
styleIParagraphStyleexpected paragraph style.
Returns

void

Remarks

Only those properties that are specified in expected style are set.

Implementation of

IStyleHandler.setParagraphStyleForCurrentPosition

setParagraphStyleForRange()
setParagraphStyleForRange(style, range): void;

Sets the paragraph style for a text range (patch).

Parameters
ParameterTypeDescription
styleIParagraphStyleparagraph style.
rangeITextRangetext range.
Returns

void

Remarks

Only those properties that are specified in expected style are set.

Implementation of

IStyleHandler.setParagraphStyleForRange

Was this page helpful?