Explorar el Código

use .molx and .molj for file input

Alexander Rose hace 5 años
padre
commit
7921c05d55
Se han modificado 1 ficheros con 6 adiciones y 3 borrados
  1. 6 3
      src/mol-plugin-ui/state/snapshots.tsx

+ 6 - 3
src/mol-plugin-ui/state/snapshots.tsx

@@ -44,9 +44,12 @@ export class StateExportImportControls extends PluginUIComponent {
     }
 
     open = (e: React.ChangeEvent<HTMLInputElement>) => {
-        if (!e.target.files || !e.target.files![0]) return;
+        if (!e.target.files || !e.target.files[0]) {
+            this.plugin.log.error('No state file selected');
+            return;
+        }
 
-        PluginCommands.State.Snapshots.OpenFile(this.plugin, { file: e.target.files![0] });
+        PluginCommands.State.Snapshots.OpenFile(this.plugin, { file: e.target.files[0] });
     }
 
     render() {
@@ -58,7 +61,7 @@ export class StateExportImportControls extends PluginUIComponent {
                 Full
             </Button>
             <div className='msp-btn msp-btn-block msp-btn-action msp-loader-msp-btn-file'>
-                <Icon svg={OpenInBrowser} inline /> Open <input onChange={this.open} type='file' multiple={false} accept='.json,.zip' />
+                <Icon svg={OpenInBrowser} inline /> Open <input onChange={this.open} type='file' multiple={false} accept='.molx,.molj' />
             </div>
         </div>;
     }