Skip to main content

ITextManager

Interfaces

ITextManager

Manager for performing basic operations with text.

Extends

Properties

canRedo
canRedo: boolean;

Indicates if the action can be redone.

Inherited from

IUndoRedoService.canRedo

canUndo
canUndo: boolean;

Indicates if the action can be undone.

Inherited from

IUndoRedoService.canUndo

cursorChangedEvent
cursorChangedEvent: EventObject<IPositionInText>;

Cursor change event.

Remarks

Reports the current cursor position.

Inherited from

ICursorService.cursorChangedEvent

selectionChangedEvent
selectionChangedEvent: EventObject<ITextRange>;

Text selection change event.

Remarks

reports the currently selected text.

Inherited from

ISelectionService.selectionChangedEvent

styleChangedEvent
styleChangedEvent: EventObject<void>;

Character or paragraph style change event.

Inherited from

IStyleService.styleChangedEvent

textChangedEvent
textChangedEvent: EventObject<void>;

Text content change event.

Inherited from

ITextService.textChangedEvent

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.

Inherited from

IListService.actualizeStyleManager

addListItem()
addListItem(newListItemIndex, existingListItemIndex): void;

Adds a new list item to an existing list by the paragraph index.

Parameters
ParameterTypeDescription
newListItemIndexnumberindex of the new list item.
existingListItemIndexnumberthe 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.

Inherited from

IListService.addListItem

applyListType()
applyListType(paragraphIndexes, listType): void;

Applies a list type to paragraphs by their indexes.

Parameters
ParameterTypeDescription
paragraphIndexesnumber[]paragraph indexes.
listTypeListTypelist type.
Returns

void

Inherited from

IListService.applyListType

clearCurrentFormatting()
clearCurrentFormatting(): void;

Clears formatting (character style) for the current cursor position or selected text.

Returns

void

Inherited from

IStyleService.clearCurrentFormatting

createBulletedListItem()
createBulletedListItem(paragraphIndex, bulletCharCode): void;

Creates a new top-level bulleted list item.

Parameters
ParameterTypeDescription
paragraphIndexnumberparagraph index.
bulletCharCodenumbercharacter code used as 'bullet' (e.g., code 8225 used for “‡“).
Returns

void

Inherited from

IListService.createBulletedListItem

createNumberedListItem()
createNumberedListItem(paragraphIndex, format): void;

Creates a new top-level numbered list item.

Parameters
ParameterTypeDescription
paragraphIndexnumberparagraph index.
formatNumberingFormatTypenumbering format.
Returns

void

Inherited from

IListService.createNumberedListItem

decreaseListItemIndent()
decreaseListItemIndent(paragraphIndex): void;

Decreases the nesting level of the list item by the paragraph index.

Parameters
ParameterTypeDescription
paragraphIndexnumberparagraph index.
Returns

void

Inherited from

IListService.decreaseListItemIndent

deleteAllText()
deleteAllText(): void;

Deletes all text.

Returns

void

Inherited from

ITextService.deleteAllText

deleteListItem()
deleteListItem(paragraphIndex): void;

Removes the existing list item by the paragraph index.

Parameters
ParameterTypeDescription
paragraphIndexnumberthe paragraph index of the list item to remove.
Returns

void

Remarks

only list item is removed, paragraph text is not removed.

Inherited from

IListService.deleteListItem

deleteTextByRange()
deleteTextByRange(textRange): IPositionInText;

Deletes text by range

Parameters
ParameterTypeDescription
textRangeITextRangetext range.
Returns

IPositionInText

Inherited from

ITextService.deleteTextByRange

deleteTextToDirection()
deleteTextToDirection(direction): void;

Deletes the selected text or character relative to the current cursor position.

Parameters
ParameterTypeDescription
directionMoveDirectionTypedirection of text deletion.
Returns

void

Inherited from

ITextService.deleteTextToDirection

findItemToContinueBulletedList()
findItemToContinueBulletedList(paragraphIndex, bulletCharCode): number;

Finds the previous list item to continue bulleted list.

Parameters
ParameterTypeDescription
paragraphIndexnumberindex of the current paragraph.
bulletCharCodenumbercharacter code used as 'bullet' (e.g., code 8225 used for “‡“).
Returns

number

the paragraph index of the found list item (if it was found).

Inherited from

IListService.findItemToContinueBulletedList

findItemToContinueNumberedList()
findItemToContinueNumberedList(
paragraphIndex,
format,
itemNumber): number;

Finds the previous list item to continue bulleted list.

Parameters
ParameterTypeDescription
paragraphIndexnumberindex of the current paragraph.
formatNumberingFormatTypenumbering format.
itemNumbernumberlist item number (from 1).
Returns

number

the paragraph index of the found list item (if it was found).

Inherited from

IListService.findItemToContinueNumberedList

getCharStyleForPosition()
getCharStyleForPosition(position): ICharStyle;

Returns the character style by position.

Parameters
ParameterTypeDescription
positionIPositionInTextposition in text.
Returns

ICharStyle

Inherited from

IStyleService.getCharStyleForPosition

getCurrentCharStyle()
getCurrentCharStyle(): ICharStyle;

Returns the character style for the current cursor position or the starting position of the selected text.

Returns

ICharStyle

Inherited from

IStyleService.getCurrentCharStyle

getCurrentParagraphIndex()
getCurrentParagraphIndex(): number;

Returns the current index of the paragraph (from 0).

Returns

number

Inherited from

ICursorService.getCurrentParagraphIndex

getCurrentParagraphStyle()
getCurrentParagraphStyle(): IParagraphStyle;

Returns the paragraph style for the current cursor position or the first paragraph of the selected text.

Returns

IParagraphStyle

Inherited from

IStyleService.getCurrentParagraphStyle

getCurrentPosition()
getCurrentPosition(): IPositionInText;

Returns the current cursor position.

Returns

IPositionInText

Inherited from

ICursorService.getCurrentPosition

getFirstPosition()
getFirstPosition(): IPositionInText;

Returns the first position in the text.

Returns

IPositionInText

Inherited from

ICursorService.getFirstPosition

getFormattedText()
getFormattedText(): string;

Returns formatted text.

Returns

string

Inherited from

ITextService.getFormattedText

getListItemStyle()
getListItemStyle(paragraphIndex): IListStyle;

Returns the style of the list item by the paragraph index.

Parameters
ParameterTypeDescription
paragraphIndexnumberparagraph index.
Returns

IListStyle

Remarks

if the list item is not found, null is returned.

Inherited from

IListService.getListItemStyle

getParagraphCount()
getParagraphCount(): number;

Returns paragraph count.

Returns

number

Inherited from

ITextService.getParagraphCount

getParagraphStyleByIndex()
getParagraphStyleByIndex(index): IParagraphStyle;

Returns the paragraph style by index.

Parameters
ParameterTypeDescription
indexnumberparagraph index (from 0).
Returns

IParagraphStyle

Inherited from

IStyleService.getParagraphStyleByIndex

getParagraphText()
getParagraphText(paragraphIndex): ITextRange;

Returns the text range of a paragraph by index.

Parameters
ParameterTypeDescription
paragraphIndexanyparagraph index (from 0).
Returns

ITextRange

Inherited from

ITextService.getParagraphText

getSelectedParagraphIndexes()
getSelectedParagraphIndexes(): number[];

Returns the currently selected paragraphs indexes (by selection or cursor position).

Returns

number[]

Inherited from

ISelectionService.getSelectedParagraphIndexes

getSelectedTextRange()
getSelectedTextRange(): ITextRange;

Returns the currently selected text range.

Returns

ITextRange

Inherited from

ISelectionService.getSelectedTextRange

getTextModel()
getTextModel(): Text;

Returns the text model.

Returns

Text

Inherited from

ITextService.getTextModel

getTextRangeByPositions()
getTextRangeByPositions(startPosition, endPosition): ITextRange;

Returns the range of text by starting and ending position.

Parameters
ParameterTypeDescription
startPositionIPositionInTextstarting position.
endPositionIPositionInTextending position.
Returns

ITextRange

Inherited from

ITextService.getTextRangeByPositions

increaseListItemIndent()
increaseListItemIndent(paragraphIndex): void;

Increases the nesting level of the list item by the paragraph index.

Parameters
ParameterTypeDescription
paragraphIndexnumberparagraph index.
Returns

void

Inherited from

IListService.increaseListItemIndent

insertFormattedText()
insertFormattedText(text): void;

Inserts formatted text relative to the current cursor position.

Parameters
ParameterTypeDescription
textstringtext to insert.
Returns

void

Inherited from

ITextService.insertFormattedText

insertNewLine()
insertNewLine(): void;

Inserts a new line relative to the current cursor position.

Returns

void

Inherited from

ITextService.insertNewLine

insertPlainText()
insertPlainText(text): void;

Inserts plain text relative to the current cursor position.

Parameters
ParameterTypeDescription
textstringtext to insert.
Returns

void

Inherited from

ITextService.insertPlainText

isParagraphAListItem()
isParagraphAListItem(paragraphIndex): boolean;

Indicates if a paragraph is a list item.

Parameters
ParameterTypeDescription
paragraphIndexnumberparagraph index.
Returns

boolean

returns true if the paragraph is a list item, false otherwise.

Inherited from

IListService.isParagraphAListItem

isParagraphsTheSameList()
isParagraphsTheSameList(paragraphIndexes): boolean;

Indicates if the paragraphs are the same list.

Parameters
ParameterTypeDescription
paragraphIndexesnumber[]paragraph indexes.
Returns

boolean

Inherited from

IListService.isParagraphsTheSameList

measureText()
measureText(scale, isExtendToBlackBox?): RectangleF;

Measures text.

Parameters
ParameterTypeDescription
scalenumberscale.
isExtendToBlackBox?booleanindicates if extend to black box.
Returns

RectangleF

Inherited from

ITextService.measureText

measureTextFrames()
measureTextFrames(useActiveText): RectangleF;

Measures the text frame.

Parameters
ParameterTypeDescription
useActiveTextbooleantrue if you want to use the currently active text, false if the item's original text.
Returns

RectangleF

Inherited from

ITextService.measureTextFrames

moveCursorToDirection()
moveCursorToDirection(direction, withSelection?): void;

Moves the current cursor position in the specified direction.

Parameters
ParameterTypeDescription
directionMoveDirectionTypedirection of cursor movement.
withSelection?booleanindicates whether the cursor moves with text selection (the default value is false).
Returns

void

Inherited from

ICursorService.moveCursorToDirection

pauseUndoRedo()
pauseUndoRedo(): void;

Pauses saving actions.

Returns

void

Remarks

can be used to combine multiple actions into one.

Inherited from

IUndoRedoService.pauseUndoRedo

redo()
redo(): void;

Redoes an action.

Returns

void

Inherited from

IUndoRedoService.redo

resetSelection()
resetSelection(): void;

Resets text selection.

Returns

void

Inherited from

ISelectionService.resetSelection

resumeUndoRedo()
resumeUndoRedo(): void;

Resumes saving actions.

Returns

void

Remarks

can be used to combine multiple actions into one.

Inherited from

IUndoRedoService.resumeUndoRedo

selectAllText()
selectAllText(): void;

Selects all text.

Returns

void

Inherited from

ISelectionService.selectAllText

selectCurrentParagraph()
selectCurrentParagraph(): void;

Selects a paragraph relative to the current cursor position.

Returns

void

Inherited from

ISelectionService.selectCurrentParagraph

selectCurrentWord()
selectCurrentWord(): void;

Selects a word relative to the current cursor position.

Returns

void

Inherited from

ISelectionService.selectCurrentWord

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

Sets the character style by position.

Parameters
ParameterTypeDescription
positionIPositionInTextposition in text.
styleICharStyleexpected character style.
Returns

void

Inherited from

IStyleService.setCharStyleForPosition

setCurrentCharStyle()
setCurrentCharStyle(style): void;

Sets the character style for the current cursor position or selected text.

Parameters
ParameterTypeDescription
styleICharStyleexpected character style.
Returns

void

Remarks

only properties specified in the expected style are set.

Inherited from

IStyleService.setCurrentCharStyle

setCurrentParagraphStyle()
setCurrentParagraphStyle(style): void;

Sets the paragraph style for the current cursor position or selected text.

Parameters
ParameterTypeDescription
styleIParagraphStyleexpected paragraph style.
Returns

void

Remarks

only properties specified in the expected style are set.

Inherited from

IStyleService.setCurrentParagraphStyle

setCursorToPoint()
setCursorToPoint(point): void;

Sets the cursor to a point in the text.

Parameters
ParameterTypeDescription
pointIPointthe expected point.
Returns

void

Inherited from

ICursorService.setCursorToPoint

setCursorToPosition()
setCursorToPosition(position): void;

Sets the cursor at a position in the text.

Parameters
ParameterTypeDescription
positionIPositionInTextthe expected position in the text.
Returns

void

Inherited from

ICursorService.setCursorToPosition

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

Sets the paragraph style by index.

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

void

Remarks

only properties specified in the expected style are set.

Inherited from

IStyleService.setParagraphStyleByIndex

setSelection()
setSelection(startPoint, endPoint): void;

Sets the selection of text by starting and ending points.

Parameters
ParameterTypeDescription
startPointIPointstarting point.
endPointIPointending point.
Returns

void

Inherited from

ISelectionService.setSelection

setTextModel()
setTextModel(model): void;

Sets the text model.

Parameters
ParameterTypeDescription
modelTexttext model.
Returns

void

Inherited from

ITextService.setTextModel

setWrappingPath()
setWrappingPath(data): void;

Sets the wrapping path.

Parameters
ParameterTypeDescription
dataIWrappingPathDatawrapping path data.
Returns

void

Inherited from

ITextService.setWrappingPath

undo()
undo(): void;

Undoes an action.

Returns

void

Inherited from

IUndoRedoService.undo

Was this page helpful?