(event: JQuery.ChangeEvent)
| 206 | } |
| 207 | |
| 208 | private onLocalFile(event: JQuery.ChangeEvent) { |
| 209 | const files = event.target.files; |
| 210 | if (files.length !== 0) { |
| 211 | const file = files[0]; |
| 212 | const reader = new FileReader(); |
| 213 | reader.onload = () => { |
| 214 | let result: string; |
| 215 | if (reader.result instanceof ArrayBuffer) { |
| 216 | result = LoadSave.ab2str(reader.result); |
| 217 | } else { |
| 218 | result = reader.result ?? ''; |
| 219 | } |
| 220 | this.onLoad(result, file.name); |
| 221 | }; |
| 222 | reader.readAsText(file); |
| 223 | } |
| 224 | if (this.modal) { |
| 225 | BootstrapUtils.hideModal(this.modal); |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | public run(onLoad, editorText, currentLanguage: Language) { |
| 230 | this.initializeIfNeeded(); |
no test coverage detected