@@ -59,7 +59,7 @@ function getPluginName(src: string): string {
59
59
* A mixin adding a `history` property to any `LitElement`, in which
60
60
* incoming [[`LogEvent`]]s are logged.
61
61
*
62
- * For [[`EditorAction`]] entries, also sets `currentAction ` to the index of
62
+ * For [[`EditorAction`]] entries, also sets `editCount ` to the index of
63
63
* the committed action, allowing the user to go to `previousAction` with
64
64
* `undo()` if `canUndo` and to go to `nextAction` with `redo()` if `canRedo`.
65
65
*
@@ -75,7 +75,7 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
75
75
history : LogEntry [ ] = [ ] ;
76
76
/** Index of the last [[`EditorAction`]] applied. */
77
77
@property ( { type : Number } )
78
- currentAction = - 1 ;
78
+ editCount = - 1 ;
79
79
@property ( )
80
80
diagnoses = new Map < string , IssueDetail [ ] > ( ) ;
81
81
@internalProperty ( )
@@ -89,7 +89,7 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
89
89
@query ( '#issue' ) issueUI ! : Snackbar ;
90
90
91
91
get canUndo ( ) : boolean {
92
- return this . currentAction >= 0 ;
92
+ return this . editCount >= 0 ;
93
93
}
94
94
get canRedo ( ) : boolean {
95
95
return this . nextAction >= 0 ;
@@ -98,15 +98,15 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
98
98
get previousAction ( ) : number {
99
99
if ( ! this . canUndo ) return - 1 ;
100
100
return this . history
101
- . slice ( 0 , this . currentAction )
101
+ . slice ( 0 , this . editCount )
102
102
. map ( entry => ( entry . kind == 'action' ? true : false ) )
103
103
. lastIndexOf ( true ) ;
104
104
}
105
105
get nextAction ( ) : number {
106
106
let index = this . history
107
- . slice ( this . currentAction + 1 )
107
+ . slice ( this . editCount + 1 )
108
108
. findIndex ( entry => entry . kind == 'action' ) ;
109
- if ( index >= 0 ) index += this . currentAction + 1 ;
109
+ if ( index >= 0 ) index += this . editCount + 1 ;
110
110
return index ;
111
111
}
112
112
@@ -125,25 +125,25 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
125
125
if ( ! this . canUndo ) return false ;
126
126
this . dispatchEvent (
127
127
newActionEvent (
128
- invert ( ( < CommitEntry > this . history [ this . currentAction ] ) . action )
128
+ invert ( ( < CommitEntry > this . history [ this . editCount ] ) . action )
129
129
)
130
130
) ;
131
- this . currentAction = this . previousAction ;
131
+ this . editCount = this . previousAction ;
132
132
return true ;
133
133
}
134
134
redo ( ) : boolean {
135
135
if ( ! this . canRedo ) return false ;
136
136
this . dispatchEvent (
137
137
newActionEvent ( ( < CommitEntry > this . history [ this . nextAction ] ) . action )
138
138
) ;
139
- this . currentAction = this . nextAction ;
139
+ this . editCount = this . nextAction ;
140
140
return true ;
141
141
}
142
142
143
143
private onLog ( le : LogEvent ) : void {
144
144
if ( le . detail . kind === 'reset' ) {
145
145
this . history = [ ] ;
146
- this . currentAction = - 1 ;
146
+ this . editCount = - 1 ;
147
147
return ;
148
148
}
149
149
@@ -156,7 +156,7 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
156
156
if ( entry . action . derived ) return ;
157
157
entry . action . derived = true ;
158
158
if ( this . nextAction !== - 1 ) this . history . splice ( this . nextAction ) ;
159
- this . currentAction = this . history . length ;
159
+ this . editCount = this . history . length ;
160
160
}
161
161
162
162
this . history . push ( entry ) ;
@@ -206,7 +206,7 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
206
206
class ="${ entry . kind } "
207
207
graphic ="icon "
208
208
?twoline =${ ! ! entry . message }
209
- ?activated =${ this . currentAction == history . length - index - 1 }
209
+ ?activated =${ this . editCount == history . length - index - 1 }
210
210
>
211
211
< span >
212
212
<!-- FIXME: replace tt with mwc-chip asap -->
0 commit comments