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
| Parameter | Type |
|---|---|
tw | ITextWhizzHolder |
colorPreviewService | IColorPreviewService |
Returns
Accessors
colorPalette
Get Signature
get colorPalette(): IColorPalette;
Returns
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
| Parameter | Type | Description |
|---|---|---|
textRange | ITextRange | text range. |
Returns
void
Implementation of
IStyleHandler.clearFormatForRange
getCharStyleForCurrentPosition()
getCharStyleForCurrentPosition(): ICharStyle;
Returns the character style for the current cursor position.
Returns
Implementation of
IStyleHandler.getCharStyleForCurrentPosition
getCharStyleForPosition()
getCharStyleForPosition(position): ICharStyle;
Returns the character style by position.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | IPositionInText | position in text. |
Returns
Implementation of
IStyleHandler.getCharStyleForPosition
getCharStyleForRange()
getCharStyleForRange(range): ICharStyle;
Returns the character style for a text range.
Parameters
| Parameter | Type | Description |
|---|---|---|
range | ITextRange | text range. |
Returns
Implementation of
IStyleHandler.getCharStyleForRange
getDefaultCharStyle()
getDefaultCharStyle(): ICharStyle;
Returns the default character style.
Returns
Implementation of
IStyleHandler.getDefaultCharStyle
getDefaultParagraphStyle()
getDefaultParagraphStyle(): IParagraphStyle;
Returns the default paragraph style.
Returns
Implementation of
IStyleHandler.getDefaultParagraphStyle
getParagraphStyleByIndex()
getParagraphStyleByIndex(index): IParagraphStyle;
Returns the paragraph style by index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | paragraph index (from 0). |
Returns
Implementation of
IStyleHandler.getParagraphStyleByIndex
getParagraphStyleForCurrentPosition()
getParagraphStyleForCurrentPosition(): IParagraphStyle;
Returns the paragraph style for the current cursor position.
Returns
Implementation of
IStyleHandler.getParagraphStyleForCurrentPosition
getParagraphStyleForRange()
getParagraphStyleForRange(range): IParagraphStyle;
Returns the paragraph style for a text range.
Parameters
| Parameter | Type | Description |
|---|---|---|
range | ITextRange | text range. |
Returns
Implementation of
IStyleHandler.getParagraphStyleForRange
initialize()
initialize(colorPalette): void;
Parameters
| Parameter | Type |
|---|---|
colorPalette | Collection<IColorData> |
Returns
void
setCharStyleForCurrentPosition()
setCharStyleForCurrentPosition(style): void;
Sets the character style for the current cursor position (patch).
Parameters
| Parameter | Type | Description |
|---|---|---|
style | ICharStyle | expected 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
| Parameter | Type | Description |
|---|---|---|
position | IPositionInText | position in text. |
style | ICharStyle | character 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
| Parameter | Type | Description |
|---|---|---|
style | ICharStyle | character style. |
range | ITextRange | text 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
| Parameter | Type | Description |
|---|---|---|
style | ICharStyle | character style. |
Returns
void
Implementation of
IStyleHandler.setDefaultCharStyle
setDefaultParagraphStyle()
setDefaultParagraphStyle(style): void;
Sets the default paragraph style.
Parameters
| Parameter | Type | Description |
|---|---|---|
style | IParagraphStyle | paragraph style. |
Returns
void
Implementation of
IStyleHandler.setDefaultParagraphStyle
setParagraphStyleByIndex()
setParagraphStyleByIndex(index, style): void;
Sets the paragraph style for the current cursor position (patch).
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | paragraph index (from 0). |
style | IParagraphStyle | expected paragraph style. |
Returns
void
Implementation of
IStyleHandler.setParagraphStyleByIndex
setParagraphStyleForCurrentPosition()
setParagraphStyleForCurrentPosition(style): void;
Sets the paragraph style for the current cursor position (patch).
Parameters
| Parameter | Type | Description |
|---|---|---|
style | IParagraphStyle | expected 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
| Parameter | Type | Description |
|---|---|---|
style | IParagraphStyle | paragraph style. |
range | ITextRange | text range. |
Returns
void
Remarks
Only those properties that are specified in expected style are set.