@@ -15,6 +15,8 @@ import { WorkspaceLocation } from '../workspace/WorkspaceTypes';
15
15
import FileSystemViewContextMenu from './FileSystemViewContextMenu' ;
16
16
import FileSystemViewFileName from './FileSystemViewFileName' ;
17
17
import FileSystemViewIndentationPadding from './FileSystemViewIndentationPadding' ;
18
+ import { OverallState } from '../application/ApplicationTypes' ;
19
+ import { actions } from '../utils/ActionsHelper' ;
18
20
19
21
type Props = {
20
22
workspaceLocation : WorkspaceLocation ;
@@ -60,10 +62,12 @@ const FileSystemViewFileNode: React.FC<Props> = ({
60
62
61
63
const [ isEditing , setIsEditing ] = React . useState ( false ) ;
62
64
const dispatch = useDispatch ( ) ;
65
+ const store = useStore < OverallState > ( ) ;
63
66
64
67
const fullPath = path . join ( basePath , fileName ) ;
65
68
66
69
const handleOpenFile = ( ) => {
70
+ fileSystem . readFile ( fullPath , 'utf-8' , async ( err , fileContents ) => {
67
71
fileSystem . readFile ( fullPath , 'utf-8' , async ( err , fileContents ) => {
68
72
if ( err ) {
69
73
console . error ( err ) ;
@@ -72,6 +76,19 @@ const FileSystemViewFileNode: React.FC<Props> = ({
72
76
throw new Error ( 'File contents are undefined.' ) ;
73
77
}
74
78
dispatch ( addEditorTab ( workspaceLocation , fullPath , fileContents ) ) ;
79
+ const idx = store . getState ( ) . workspaces [ 'playground' ] . activeEditorTabIndex || 0 ;
80
+ const repoName = store . getState ( ) . playground . repoName || '' ;
81
+ const editorFilePath = store . getState ( ) . workspaces [ 'playground' ] . editorTabs [ idx ] . filePath || '' ;
82
+ console . log ( repoName ) ;
83
+ console . log ( editorFilePath ) ;
84
+ store . dispatch ( actions . updateEditorGithubSaveInfo (
85
+ 'playground' ,
86
+ idx ,
87
+ repoName ,
88
+ editorFilePath ,
89
+ new Date ( )
90
+ ) ) ;
91
+ console . log ( store . getState ( ) . workspaces [ 'playground' ] . editorTabs ) ;
75
92
} ) ;
76
93
} ;
77
94
0 commit comments