(props: {})
| 62 | public vscode: VsCode; |
| 63 | |
| 64 | constructor(props: {}) { |
| 65 | super(props); |
| 66 | |
| 67 | this.vscode = acquireVsCodeApi(); |
| 68 | |
| 69 | this.state = { |
| 70 | compactUI: false, |
| 71 | darkTheme: null, |
| 72 | }; |
| 73 | this.viewerOptions = getViewerOptions(this.state.darkTheme); |
| 74 | |
| 75 | this.handlers = { |
| 76 | message: event => { |
| 77 | // Handle the message inside the webview |
| 78 | const message = event.data as Message; |
| 79 | |
| 80 | switch (message.command) { |
| 81 | case 'gotFileContent': |
| 82 | if (this.explorer) { |
| 83 | this.explorer.load(message.dataFile); |
| 84 | this.setState({ compactUI: message.compactUI }); |
| 85 | } |
| 86 | |
| 87 | //TODO: hydrate state |
| 88 | break; |
| 89 | } |
| 90 | }, |
| 91 | resize: e => { |
| 92 | this.explorer && this.explorer.resize(); |
| 93 | }, |
| 94 | keyup: e => { |
| 95 | //look for CTRL Z or CTRL SHIFT Z |
| 96 | if (e.ctrlKey && (e.keyCode === z || e.keyCode === Z)) { |
| 97 | if (e.shiftKey) { |
| 98 | this.explorer.redo(); |
| 99 | } else { |
| 100 | this.explorer.undo(); |
| 101 | } |
| 102 | } |
| 103 | }, |
| 104 | }; |
| 105 | } |
| 106 | |
| 107 | private wireEventHandlers(add: boolean) { |
| 108 | for (const key in this.handlers) { |
nothing calls this directly
no test coverage detected