1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-19 20:23:18 +03:00

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
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));
}