Skip to content

Commit

Permalink
Migrate history to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Aug 15, 2022
1 parent 92d9514 commit 114d7b7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/quill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ class Quill {
);
}
setSelection(range: Range | null, source?: EmitterSource): void;
setSelection(index: number, length: number, source?: EmitterSource): void;
setSelection(index: number, length?: number, source?: EmitterSource): void;
setSelection(
index: Range | null | number,
length?: EmitterSource | number,
Expand Down
20 changes: 17 additions & 3 deletions modules/history.js → modules/history.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import { Scope } from 'parchment';
import Quill from '../core/quill';
import Delta from 'quill-delta';
import Module from '../core/module';
import Quill from '../core/quill';

interface HistoryOptions {
userOnly: boolean;
delay: number;
maxStack: number;
}

class History extends Module<HistoryOptions> {
lastRecorded: number;
ignoreChange: boolean;
stack: {
undo: Delta[];
redo: Delta[];
};

class History extends Module {
constructor(quill, options) {
constructor(quill: Quill, options: Partial<HistoryOptions>) {
super(quill, options);
this.lastRecorded = 0;
this.ignoreChange = false;
Expand Down

0 comments on commit 114d7b7

Please sign in to comment.