NewTextManager
Classes
NewTextManager
Manager for performing basic operations with text.
Remarks
The text manager works with the text engine only through the wrapper.
Implements
Constructors
Constructor
new NewTextManager(): NewTextManager;
Returns
Properties
s
s: any;
Accessors
canRedo
Get Signature
get canRedo(): boolean;
Indicates if the action can be redone.
Returns
boolean
Indicates if the action can be redone.
Implementation of
canUndo
Get Signature
get canUndo(): boolean;
Indicates if the action can be undone.
Returns
boolean
Indicates if the action can be undone.
Implementation of
cursorChangedEvent
Get Signature
get cursorChangedEvent(): EventObject<IPositionInText>;
Cursor change event.
Remarks
Reports the current cursor position.
Returns
EventObject<IPositionInText>
Cursor change event.
Remarks
Reports the current cursor position.
Implementation of
ITextManager.cursorChangedEvent
isInitialized
Get Signature
get isInitialized(): boolean;
Returns
boolean
selectionChangedEvent
Get Signature
get selectionChangedEvent(): EventObject<ITextRange>;
Text selection change event.
Remarks
reports the currently selected text.
Returns
EventObject<ITextRange>
Text selection change event.
Remarks
reports the currently selected text.
Implementation of
ITextManager.selectionChangedEvent
styleChangedEvent
Get Signature
get styleChangedEvent(): EventObject<void>;
Character or paragraph style change event.
Returns
EventObject<void>
Character or paragraph style change event.
Implementation of
ITextManager.styleChangedEvent
textChangedEvent
Get Signature
get textChangedEvent(): EventObject<void>;
Text content change event.
Returns
EventObject<void>
Text content change event.
Implementation of
Methods
actualizeStyleManager()
actualizeStyleManager(): void;
Actualize all list styles (by name) in the style sheet manager.
Returns
void
Remarks
The actual list styles are the styles in TextWhizz.
Implementation of
ITextManager.actualizeStyleManager
addListItem()
addListItem(currentParagraphIndex, previousListItemIndex): void;
Adds a new list item to an existing list by the paragraph index.
Parameters
| Parameter | Type | Description |
|---|---|---|
currentParagraphIndex | number | index of the new list item. |
previousListItemIndex | number | the index of the existing (previous) list item. |
Returns
void
Remarks
there must be no other items of the same list between the current index and the index of the previous list item.
Implementation of
applyListType()
applyListType(paragraphIndexes, listType): void;
Applies a list type to paragraphs by their indexes.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndexes | number[] | paragraph indexes. |
listType | ListType | list type. |
Returns
void
Implementation of
clearCurrentFormatting()
clearCurrentFormatting(): void;
Clears formatting (character style) for the current cursor position or selected text.
Returns
void
Implementation of
ITextManager.clearCurrentFormatting
createBulletedListItem()
createBulletedListItem(paragraphIndex, bulletCharCode): void;
Creates a new top-level bulleted list item.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndex | number | paragraph index. |
bulletCharCode | number | character code used as 'bullet' (e.g., code 8225 used for “‡“). |
Returns
void
Implementation of
ITextManager.createBulletedListItem
createNumberedListItem()
createNumberedListItem(paragraphIndex, format): void;
Creates a new top-level numbered list item.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndex | number | paragraph index. |
format | NumberingFormatType | numbering format. |
Returns
void
Implementation of
ITextManager.createNumberedListItem
decreaseListItemIndent()
decreaseListItemIndent(paragraphIndex): void;
Decreases the nesting level of the list item by the paragraph index.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndex | number | paragraph index. |
Returns
void
Implementation of
ITextManager.decreaseListItemIndent
deleteAllText()
deleteAllText(): void;
Deletes all text.
Returns
void
Implementation of
deleteListItem()
deleteListItem(paragraphIndex): void;
Removes the existing list item by the paragraph index.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndex | number | the paragraph index of the list item to remove. |
Returns
void
Remarks
only list item is removed, paragraph text is not removed.
Implementation of
deleteTextByRange()
deleteTextByRange(textRange): IPositionInText;
Deletes text by range
Parameters
| Parameter | Type | Description |
|---|---|---|
textRange | ITextRange | text range. |
Returns
Implementation of
ITextManager.deleteTextByRange
deleteTextToDirection()
deleteTextToDirection(direction): void;
Deletes the selected text or character relative to the current cursor position.
Parameters
| Parameter | Type | Description |
|---|---|---|
direction | MoveDirectionType | direction of text deletion. |
Returns
void
Implementation of
ITextManager.deleteTextToDirection
detach()
detach(): void;
Returns
void
findItemToContinueBulletedList()
findItemToContinueBulletedList(paragraphIndex, bulletCharCode): number;
Finds the previous list item to continue bulleted list.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndex | number | index of the current paragraph. |
bulletCharCode | number | character code used as 'bullet' (e.g., code 8225 used for “‡“). |
Returns
number
the paragraph index of the found list item (if it was found).
Implementation of
ITextManager.findItemToContinueBulletedList
findItemToContinueNumberedList()
findItemToContinueNumberedList(
paragraphIndex,
format,
itemNumber): number;
Finds the previous list item to continue bulleted list.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndex | number | index of the current paragraph. |
format | NumberingFormatType | numbering format. |
itemNumber | number | list item number (from 1). |
Returns
number
the paragraph index of the found list item (if it was found).
Implementation of
ITextManager.findItemToContinueNumberedList
getCharStyleForPosition()
getCharStyleForPosition(position): ICharStyle;
Returns the character style by position.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | IPositionInText | position in text. |
Returns
Implementation of
ITextManager.getCharStyleForPosition
getCurrentCharStyle()
getCurrentCharStyle(): ICharStyle;
Returns the character style for the current cursor position or the starting position of the selected text.
Returns
Implementation of
ITextManager.getCurrentCharStyle
getCurrentParagraphIndex()
getCurrentParagraphIndex(): number;
Returns the current index of the paragraph (from 0).
Returns
number
Implementation of
ITextManager.getCurrentParagraphIndex
getCurrentParagraphLength()
getCurrentParagraphLength(): number;
Returns
number
getCurrentParagraphStyle()
getCurrentParagraphStyle(): IParagraphStyle;
Returns the paragraph style for the current cursor position or the first paragraph of the selected text.
Returns
Implementation of
ITextManager.getCurrentParagraphStyle
getCurrentPosition()
getCurrentPosition(): IPositionInText;
Returns the current cursor position.
Returns
Implementation of
ITextManager.getCurrentPosition
getFirstPosition()
getFirstPosition(): IPositionInText;
Returns the first position in the text.
Returns
Implementation of
getFormattedText()
getFormattedText(): string;
Returns formatted text.
Returns
string
Implementation of
getListItemStyle()
getListItemStyle(paragraphIndex): IListStyle;
Returns the style of the list item by the paragraph index.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndex | number | paragraph index. |
Returns
Remarks
if the list item is not found, null is returned.
Implementation of
getParagraphCount()
getParagraphCount(): number;
Returns paragraph count.
Returns
number
Implementation of
ITextManager.getParagraphCount
getParagraphLength()
getParagraphLength(index): number;
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
number
getParagraphStyleByIndex()
getParagraphStyleByIndex(index): IParagraphStyle;
Returns the paragraph style by index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | paragraph index (from 0). |
Returns
Implementation of
ITextManager.getParagraphStyleByIndex
getParagraphText()
getParagraphText(paragraphIndex): ITextRange;
Returns the text range of a paragraph by index.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndex | any | paragraph index (from 0). |
Returns
Implementation of
getSelectedParagraphIndexes()
getSelectedParagraphIndexes(): number[];
Returns the currently selected paragraphs indexes (by selection or cursor position).
Returns
number[]
Implementation of
ITextManager.getSelectedParagraphIndexes
getSelectedTextRange()
getSelectedTextRange(): ITextRange;
Returns the currently selected text range.
Returns
Implementation of
ITextManager.getSelectedTextRange
getTextLength()
getTextLength(): number;
Returns
number
getTextModel()
getTextModel(): Text;
Returns the text model.
Returns
Implementation of
getTextRangeByPositions()
getTextRangeByPositions(startPosition, endPosition): ITextRange;
Returns the range of text by starting and ending position.
Parameters
| Parameter | Type | Description |
|---|---|---|
startPosition | IPositionInText | starting position. |
endPosition | IPositionInText | ending position. |
Returns
Implementation of
ITextManager.getTextRangeByPositions
increaseListItemIndent()
increaseListItemIndent(paragraphIndex): void;
Increases the nesting level of the list item by the paragraph index.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndex | number | paragraph index. |
Returns
void
Implementation of
ITextManager.increaseListItemIndent
initialize()
initialize(initData): void;
Parameters
| Parameter | Type |
|---|---|
initData | TextManagerInitData |
Returns
void
insertFormattedText()
insertFormattedText(text): void;
Inserts formatted text relative to the current cursor position.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | text to insert. |
Returns
void
Implementation of
ITextManager.insertFormattedText
insertNewLine()
insertNewLine(): void;
Inserts a new line relative to the current cursor position.
Returns
void
Implementation of
insertPlainText()
insertPlainText(text): void;
Inserts plain text relative to the current cursor position.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | text to insert. |
Returns
void
Implementation of
isCaretOnEndOfParagraph()
isCaretOnEndOfParagraph(): boolean;
Returns
boolean
isCaretOnTheBeginingOfParagraph()
isCaretOnTheBeginingOfParagraph(): boolean;
Returns
boolean
isParagraphAListItem()
isParagraphAListItem(paragraphIndex): boolean;
Indicates if a paragraph is a list item.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndex | number | paragraph index. |
Returns
boolean
returns true if the paragraph is a list item, false otherwise.
Implementation of
ITextManager.isParagraphAListItem
isParagraphsTheSameList()
isParagraphsTheSameList(paragraphIndexes): boolean;
Indicates if the paragraphs are the same list.
Parameters
| Parameter | Type | Description |
|---|---|---|
paragraphIndexes | number[] | paragraph indexes. |
Returns
boolean
Implementation of
ITextManager.isParagraphsTheSameList
isSelectionCollapsed()
isSelectionCollapsed(): boolean;
Returns
boolean
measureText()
measureText(scale, isExtendToBlackBox?): RectangleF;
Measures text.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
scale | number | undefined | scale. |
isExtendToBlackBox | boolean | false | indicates if extend to black box. |
Returns
RectangleF
Implementation of
measureTextFrames()
measureTextFrames(useActiveText): RectangleF;
Measures the text frame.
Parameters
| Parameter | Type | Description |
|---|---|---|
useActiveText | boolean | true if you want to use the currently active text, false if the item's original text. |
Returns
RectangleF
Implementation of
ITextManager.measureTextFrames
moveCursorToDirection()
moveCursorToDirection(direction, withSelection?): void;
Moves the current cursor position in the specified direction.
Parameters
| Parameter | Type | Description |
|---|---|---|
direction | MoveDirectionType | direction of cursor movement. |
withSelection? | boolean | indicates whether the cursor moves with text selection (the default value is false). |
Returns
void
Implementation of
ITextManager.moveCursorToDirection
pauseUndoRedo()
pauseUndoRedo(): void;
Pauses saving actions.
Returns
void
Remarks
can be used to combine multiple actions into one.
Implementation of
redo()
redo(): void;
Redoes an action.
Returns
void
Implementation of
resetSelection()
resetSelection(): void;
Resets text selection.
Returns
void
Implementation of
resumeUndoRedo()
resumeUndoRedo(): void;
Resumes saving actions.
Returns
void
Remarks
can be used to combine multiple actions into one.
Implementation of
selectAllText()
selectAllText(): void;
Selects all text.
Returns
void
Implementation of
selectCurrentParagraph()
selectCurrentParagraph(): void;
Selects a paragraph relative to the current cursor position.
Returns
void
Implementation of
ITextManager.selectCurrentParagraph
selectCurrentWord()
selectCurrentWord(): void;
Selects a word relative to the current cursor position.
Returns
void
Implementation of
ITextManager.selectCurrentWord
setCharStyleForPosition()
setCharStyleForPosition(position, style): void;
Sets the character style by position.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | IPositionInText | position in text. |
style | ICharStyle | expected character style. |
Returns
void
Implementation of
ITextManager.setCharStyleForPosition
setCurrentCharStyle()
setCurrentCharStyle(style): void;
Sets the character style for the current cursor position or selected text.
Parameters
| Parameter | Type | Description |
|---|---|---|
style | ICharStyle | expected character style. |
Returns
void
Remarks
only properties specified in the expected style are set.
Implementation of
ITextManager.setCurrentCharStyle
setCurrentParagraphStyle()
setCurrentParagraphStyle(style): void;
Sets the paragraph style for the current cursor position or selected text.
Parameters
| Parameter | Type | Description |
|---|---|---|
style | IParagraphStyle | expected paragraph style. |
Returns
void
Remarks
only properties specified in the expected style are set.
Implementation of
ITextManager.setCurrentParagraphStyle
setCursorToPoint()
setCursorToPoint(point): void;
Sets the cursor to a point in the text.
Parameters
| Parameter | Type | Description |
|---|---|---|
point | IPoint | the expected point. |
Returns
void
Implementation of
setCursorToPosition()
setCursorToPosition(position): void;
Sets the cursor at a position in the text.
Parameters
| Parameter | Type | Description |
|---|---|---|
position | IPositionInText | the expected position in the text. |
Returns
void
Implementation of
ITextManager.setCursorToPosition
setParagraphStyleByIndex()
setParagraphStyleByIndex(index, style): void;
Sets the paragraph style by index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | paragraph index (from 0). |
style | IParagraphStyle | expected paragraph style. |
Returns
void
Remarks
only properties specified in the expected style are set.
Implementation of
ITextManager.setParagraphStyleByIndex
setSelection()
setSelection(startPoint, endPoint): void;
Sets the selection of text by starting and ending points.
Parameters
| Parameter | Type | Description |
|---|---|---|
startPoint | IPoint | starting point. |
endPoint | IPoint | ending point. |
Returns
void
Implementation of
setTextModel()
setTextModel(model): void;
Sets the text model.
Parameters
| Parameter | Type | Description |
|---|---|---|
model | Text | text model. |
Returns
void
Implementation of
setWrappingPath()
setWrappingPath(data): void;
Sets the wrapping path.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | IWrappingPathData | wrapping path data. |
Returns
void
Implementation of
undo()
undo(): void;
Undoes an action.
Returns
void
Implementation of
TextManagerInitData
Constructors
Constructor
new TextManagerInitData(): TextManagerInitData;
Returns
Properties
listStyleSheetManager
listStyleSheetManager: IListStyleSheetManager;
textEngineWrapper
textEngineWrapper: ITextEngineWrapper;