File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
src/json-crdt-peritext-ui/dom/undo Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,6 @@ export class WebUndo implements UndoManager, UiLifeCycles {
11
11
private _push : boolean = false ;
12
12
/** The DOM element, which keeps text content for native undo/redo integration. */
13
13
protected el ! : HTMLElement ;
14
- /** The last known text contents length of the `el`. */
15
- protected tlen : number = 0 ;
16
14
/** Undo stack. */
17
15
public undo : UndoItem [ ] = [ ] ;
18
16
/** Redo stack. */
@@ -92,13 +90,10 @@ export class WebUndo implements UndoManager, UiLifeCycles {
92
90
} ;
93
91
94
92
public readonly onInput = ( ) => {
95
- const text = this . el . innerText ;
96
- if ( this . _push ) {
97
- this . tlen = text . length ;
98
- console . log ( this . tlen , this . undo . length ) ;
99
- } else {
100
- while ( this . undo . length && this . undo . length > text . length ) this . _undo ( ) ;
101
- while ( this . redo . length && this . undo . length < text . length ) this . _redo ( ) ;
93
+ const tlen = this . el . innerText . length ;
94
+ if ( ! this . _push ) {
95
+ while ( this . undo . length && this . undo . length > tlen ) this . _undo ( ) ;
96
+ while ( this . redo . length && this . undo . length < tlen ) this . _redo ( ) ;
102
97
}
103
98
} ;
104
99
}
You can’t perform that action at this time.
0 commit comments