UNPKG

devexpress-richedit

Version:

DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.

47 lines (46 loc) 1.17 kB
import { Errors } from '@devexpress/utils/lib/errors'; export class HistoryItem { modelManipulator; uniqueId = -1; canBeMerged() { return false; } constructor(modelManipulator) { this.modelManipulator = modelManipulator; } changeModified() { return true; } } export class CompositionHistoryItem extends HistoryItem { historyItems = []; canBeMerged() { return true; } constructor() { super(null); } changeModified() { var item; for (var i = 0; item = this.historyItems[i]; i++) { if (item.changeModified()) return true; } return false; } redo() { var item; for (var i = 0; item = this.historyItems[i]; i++) item.redo(); } undo() { var item; for (var i = this.historyItems.length - 1; item = this.historyItems[i]; i--) item.undo(); } add(historyItem) { if (historyItem == null) throw new Error(Errors.ValueCannotBeNull); this.historyItems.push(historyItem); } }