rte: remove logging and fix new history

This commit is contained in:
Aviral Dasgupta 2017-03-10 21:10:27 +05:30
parent 6004f6d610
commit 8dc7f8efe2
No known key found for this signature in database
GPG key ID: 5FD1E9F4FFD3DA80
3 changed files with 8 additions and 6 deletions

View file

@ -44,14 +44,20 @@ export default class ComposerHistoryManager {
// TODO: Performance issues?
for(; sessionStorage.getItem(`${this.prefix}[${this.lastIndex}]`); this.lastIndex++, this.currentIndex++) {
history.push(JSON.parse(sessionStorage.getItem(`${this.prefix}[${this.lastIndex}]`)));
this.history.push(
Object.assign(
new HistoryItem(),
JSON.parse(sessionStorage.getItem(`${this.prefix}[${this.lastIndex}]`)),
),
);
}
this.currentIndex--;
}
addItem(message: string, format: MessageFormat) {
const item = new HistoryItem(message, format);
this.history.push(item);
this.currentIndex = this.lastIndex;
this.currentIndex = this.lastIndex + 1;
sessionStorage.setItem(`${this.prefix}[${this.lastIndex++}]`, JSON.stringify(item));
}