Skip to main content

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

NewTextManager

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

ITextManager.canRedo

canUndo
Get Signature
get canUndo(): boolean;

Indicates if the action can be undone.

Returns

boolean

Indicates if the action can be undone.

Implementation of

ITextManager.canUndo

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

ITextManager.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.

Implementation of

ITextManager.actualizeStyleManager

addListItem()
addListItem(currentParagraphIndex, previousListItemIndex): void;

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

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

ITextManager.addListItem

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

Applies a list type to paragraphs by their indexes.

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

void

Implementation of

ITextManager.applyListType

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
ParameterTypeDescription
paragraphIndexnumberparagraph index.
bulletCharCodenumbercharacter 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
ParameterTypeDescription
paragraphIndexnumberparagraph index.
formatNumberingFormatTypenumbering format.
Returns

void

Implementation of

ITextManager.createNumberedListItem

decreaseListItemIndent()
decreaseListItemIndent(paragraphIndex): void;

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

Parameters
ParameterTypeDescription
paragraphIndexnumberparagraph index.
Returns

void

Implementation of

ITextManager.decreaseListItemIndent

deleteAllText()
deleteAllText(): void;

Deletes all text.

Returns

void

Implementation of

ITextManager.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.

Implementation of

ITextManager.deleteListItem

deleteTextByRange()
deleteTextByRange(textRange): IPositionInText;

Deletes text by range

Parameters
ParameterTypeDescription
textRangeITextRangetext range.
Returns

IPositionInText

Implementation of

ITextManager.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

Implementation of

ITextManager.deleteTextToDirection

detach()
detach(): void;
Returns

void

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).

Implementation of

ITextManager.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).

Implementation of

ITextManager.findItemToContinueNumberedList

getCharStyleForPosition()
getCharStyleForPosition(position): ICharStyle;

Returns the character style by position.

Parameters
ParameterTypeDescription
positionIPositionInTextposition in text.
Returns

ICharStyle

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

ICharStyle

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

IParagraphStyle

Implementation of

ITextManager.getCurrentParagraphStyle

getCurrentPosition()
getCurrentPosition(): IPositionInText;

Returns the current cursor position.

Returns

IPositionInText

Implementation of

ITextManager.getCurrentPosition

getFirstPosition()
getFirstPosition(): IPositionInText;

Returns the first position in the text.

Returns

IPositionInText

Implementation of

ITextManager.getFirstPosition

getFormattedText()
getFormattedText(): string;

Returns formatted text.

Returns

string

Implementation of

ITextManager.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.

Implementation of

ITextManager.getListItemStyle

getParagraphCount()
getParagraphCount(): number;

Returns paragraph count.

Returns

number

Implementation of

ITextManager.getParagraphCount

getParagraphLength()
getParagraphLength(index): number;
Parameters
ParameterType
indexnumber
Returns

number

getParagraphStyleByIndex()
getParagraphStyleByIndex(index): IParagraphStyle;

Returns the paragraph style by index.

Parameters
ParameterTypeDescription
indexnumberparagraph index (from 0).
Returns

IParagraphStyle

Implementation of

ITextManager.getParagraphStyleByIndex

getParagraphText()
getParagraphText(paragraphIndex): ITextRange;

Returns the text range of a paragraph by index.

Parameters
ParameterTypeDescription
paragraphIndexanyparagraph index (from 0).
Returns

ITextRange

Implementation of

ITextManager.getParagraphText

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

ITextRange

Implementation of

ITextManager.getSelectedTextRange

getTextLength()
getTextLength(): number;
Returns

number

getTextModel()
getTextModel(): Text;

Returns the text model.

Returns

Text

Implementation of

ITextManager.getTextModel

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

Returns the range of text by starting and ending position.

Parameters
ParameterTypeDescription
startPositionIPositionInTextstarting position.
endPositionIPositionInTextending position.
Returns

ITextRange

Implementation of

ITextManager.getTextRangeByPositions

increaseListItemIndent()
increaseListItemIndent(paragraphIndex): void;

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

Parameters
ParameterTypeDescription
paragraphIndexnumberparagraph index.
Returns

void

Implementation of

ITextManager.increaseListItemIndent

initialize()
initialize(initData): void;
Parameters
ParameterType
initDataTextManagerInitData
Returns

void

insertFormattedText()
insertFormattedText(text): void;

Inserts formatted text relative to the current cursor position.

Parameters
ParameterTypeDescription
textstringtext 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

ITextManager.insertNewLine

insertPlainText()
insertPlainText(text): void;

Inserts plain text relative to the current cursor position.

Parameters
ParameterTypeDescription
textstringtext to insert.
Returns

void

Implementation of

ITextManager.insertPlainText

isCaretOnEndOfParagraph()
isCaretOnEndOfParagraph(): boolean;
Returns

boolean

isCaretOnTheBeginingOfParagraph()
isCaretOnTheBeginingOfParagraph(): boolean;
Returns

boolean

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.

Implementation of

ITextManager.isParagraphAListItem

isParagraphsTheSameList()
isParagraphsTheSameList(paragraphIndexes): boolean;

Indicates if the paragraphs are the same list.

Parameters
ParameterTypeDescription
paragraphIndexesnumber[]paragraph indexes.
Returns

boolean

Implementation of

ITextManager.isParagraphsTheSameList

isSelectionCollapsed()
isSelectionCollapsed(): boolean;
Returns

boolean

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

Measures text.

Parameters
ParameterTypeDefault valueDescription
scalenumberundefinedscale.
isExtendToBlackBoxbooleanfalseindicates if extend to black box.
Returns

RectangleF

Implementation of

ITextManager.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

Implementation of

ITextManager.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

Implementation of

ITextManager.moveCursorToDirection

pauseUndoRedo()
pauseUndoRedo(): void;

Pauses saving actions.

Returns

void

Remarks

can be used to combine multiple actions into one.

Implementation of

ITextManager.pauseUndoRedo

redo()
redo(): void;

Redoes an action.

Returns

void

Implementation of

ITextManager.redo

resetSelection()
resetSelection(): void;

Resets text selection.

Returns

void

Implementation of

ITextManager.resetSelection

resumeUndoRedo()
resumeUndoRedo(): void;

Resumes saving actions.

Returns

void

Remarks

can be used to combine multiple actions into one.

Implementation of

ITextManager.resumeUndoRedo

selectAllText()
selectAllText(): void;

Selects all text.

Returns

void

Implementation of

ITextManager.selectAllText

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
ParameterTypeDescription
positionIPositionInTextposition in text.
styleICharStyleexpected 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
ParameterTypeDescription
styleICharStyleexpected 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
ParameterTypeDescription
styleIParagraphStyleexpected 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
ParameterTypeDescription
pointIPointthe expected point.
Returns

void

Implementation of

ITextManager.setCursorToPoint

setCursorToPosition()
setCursorToPosition(position): void;

Sets the cursor at a position in the text.

Parameters
ParameterTypeDescription
positionIPositionInTextthe expected position in the text.
Returns

void

Implementation of

ITextManager.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.

Implementation of

ITextManager.setParagraphStyleByIndex

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

Sets the selection of text by starting and ending points.

Parameters
ParameterTypeDescription
startPointIPointstarting point.
endPointIPointending point.
Returns

void

Implementation of

ITextManager.setSelection

setTextModel()
setTextModel(model): void;

Sets the text model.

Parameters
ParameterTypeDescription
modelTexttext model.
Returns

void

Implementation of

ITextManager.setTextModel

setWrappingPath()
setWrappingPath(data): void;

Sets the wrapping path.

Parameters
ParameterTypeDescription
dataIWrappingPathDatawrapping path data.
Returns

void

Implementation of

ITextManager.setWrappingPath

undo()
undo(): void;

Undoes an action.

Returns

void

Implementation of

ITextManager.undo


TextManagerInitData

Constructors

Constructor
new TextManagerInitData(): TextManagerInitData;
Returns

TextManagerInitData

Properties

listStyleSheetManager
listStyleSheetManager: IListStyleSheetManager;
textEngineWrapper
textEngineWrapper: ITextEngineWrapper;
Was this page helpful?