Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TextUndoGroup

Grouping of text operations should be limited in size. For instance, if the user hits backspace to delete a whole sentence and then wants to undo this operation. It is better to undo it in chunks instead of reinserting the whole sentence. This class allows for limiting the length of such chunks.

Hierarchy

Index

Constructors

constructor

  • new TextUndoGroup(desc: string, editor: Editor, undoList: undo.UndoList, limit: number): TextUndoGroup
  • Parameters

    • desc: string

      The description of this group.

    • editor: Editor

      The editor for which this undo group is created.

    • undoList: undo.UndoList

      The list which will hold this group.

    • limit: number

      The maximum number of undo operations that this group should record.

    Returns TextUndoGroup

Properties

Protected _events

_events: Subject<UndoEvents> = new Subject()

desc

desc: string

events

events: Observable<UndoEvents> = this._events.asObservable()

Private limit

limit: number

The maximum number of undo operations that this group should record.

Protected list

list: Undo[] = []

Private undoList

undoList: undo.UndoList

The list which will hold this group.

Methods

end

  • end(): void

getDataCaretAsPath

  • getDataCaretAsPath(): Caret

performRedo

  • performRedo(): void

performUndo

  • performUndo(): void

record

  • record(undoToRecord: undo.Undo): void

recordCaretAfter

  • recordCaretAfter(): void
  • This method can be used to record the caret position after the acts recorded by this undo are performed. If the caret is recorded by means of this method, then end will not record the caret position again. This can be useful in cases for which it is not clear when an UndoGroup might end. TextUndoGroup is a case in point. This method can be called any number of times to update the caret position at the end of the group.

    Returns void

redo

  • redo(): void
  • Called when the operation must be redone.

    throws

    {Error} If an undo is attempted when an undo or redo is already in progress.

    Returns void

setDataCaretAsPath

  • setDataCaretAsPath(caret: Caret): void

toString

  • toString(): string

undo

  • undo(): void
  • Called when the operation must be undone.

    throws

    {Error} If an undo is attempted when an undo or redo is already in progress.

    Returns void

Generated using TypeDoc