diff --git a/src/undo_manager/config.ts b/src/undo_manager/config.ts new file mode 100644 index 000000000..7be4ecf74 --- /dev/null +++ b/src/undo_manager/config.ts @@ -0,0 +1,19 @@ +export interface UndoManagerConfig { + /** + * Maximum number of undo items. + * @default 500 + */ + maximumStackLength?: number; + /** + * Track component selection. + * @default true + */ + trackSelection?: boolean; +} + +const config: UndoManagerConfig = { + maximumStackLength: 500, + trackSelection: true, +}; + +export default config; diff --git a/src/undo_manager/index.ts b/src/undo_manager/index.ts index f23a3aa8f..2d588574a 100644 --- a/src/undo_manager/index.ts +++ b/src/undo_manager/index.ts @@ -28,11 +28,7 @@ import UndoManager from 'backbone-undo'; import { isArray, isBoolean, isEmpty, unique, times } from 'underscore'; import { Module } from '../abstract'; import EditorModel from '../editor/model/Editor'; - -export interface UndoManagerConfig { - maximumStackLength?: number; - trackSelection?: boolean; -} +import defaults, { UndoManagerConfig } from './config'; export interface UndoGroup { index: number; @@ -40,11 +36,6 @@ export interface UndoGroup { labels: string[]; } -const defaults: UndoManagerConfig = { - maximumStackLength: 500, - trackSelection: true, -}; - const hasSkip = (opts: any) => opts.avoidStore || opts.noUndo; const getChanged = (obj: any) => Object.keys(obj.changedAttributes());