Preserve Autoscroll and Timestamp states

Signed-off-by: jbicker <jan.bicker@typefox.io>
This commit is contained in:
jbicker
2019-08-16 14:47:08 +02:00
parent 459e55a69a
commit 7f33b62e0b
2 changed files with 29 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
import { ReactWidget, Message, Widget } from "@theia/core/lib/browser";
import { ReactWidget, Message, Widget, StatefulWidget } from "@theia/core/lib/browser";
import { postConstruct, injectable, inject } from "inversify";
import * as React from 'react';
import Select, { components } from 'react-select';
@@ -107,7 +107,7 @@ export interface SelectOption {
}
@injectable()
export class MonitorWidget extends ReactWidget {
export class MonitorWidget extends ReactWidget implements StatefulWidget {
static readonly ID = 'serial-monitor';
@@ -169,6 +169,14 @@ export class MonitorWidget extends ReactWidget {
this.update();
}
storeState(): MonitorModel.Data {
return this.model.store();
}
restoreState(oldState: MonitorModel.Data): void {
this.model.restore(oldState);
}
protected onAfterAttach(msg: Message) {
super.onAfterAttach(msg);
this.clear();