|
|
@ -39,7 +39,7 @@ export const listenOnPluginEvents = (filePanelPlugin) => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const listenOnProviderEvents = (provider) => async (reducerDispatch: React.Dispatch<any>) => { |
|
|
|
export const listenOnProviderEvents = (provider) => (reducerDispatch: React.Dispatch<any>) => { |
|
|
|
dispatch = reducerDispatch |
|
|
|
dispatch = reducerDispatch |
|
|
|
|
|
|
|
|
|
|
|
provider.event.on('fileAdded', (filePath: string) => { |
|
|
|
provider.event.on('fileAdded', (filePath: string) => { |
|
|
@ -70,7 +70,7 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac |
|
|
|
}, 10) |
|
|
|
}, 10) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
provider.event.on('connected', async () => { |
|
|
|
provider.event.on('connected', () => { |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
plugin.fileManager.setMode('localhost') |
|
|
|
plugin.fileManager.setMode('localhost') |
|
|
|
dispatch(setMode('localhost')) |
|
|
|
dispatch(setMode('localhost')) |
|
|
@ -79,33 +79,33 @@ export const listenOnProviderEvents = (provider) => async (reducerDispatch: Reac |
|
|
|
}, 10) |
|
|
|
}, 10) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
provider.event.on('loadingLocalhost', async () => { |
|
|
|
provider.event.on('loadingLocalhost', () => { |
|
|
|
setTimeout(async () => { |
|
|
|
setTimeout(async () => { |
|
|
|
await switchToWorkspace(LOCALHOST) |
|
|
|
await switchToWorkspace(LOCALHOST) |
|
|
|
dispatch(loadLocalhostRequest()) |
|
|
|
dispatch(loadLocalhostRequest()) |
|
|
|
}, 10) |
|
|
|
}, 10) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
provider.event.on('fileExternallyChanged', async (path: string, file: { content: string }) => { |
|
|
|
provider.event.on('fileExternallyChanged', (path: string, content: string) => { |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
const config = plugin.registry.get('config').api |
|
|
|
const config = plugin.registry.get('config').api |
|
|
|
const editor = plugin.registry.get('editor').api |
|
|
|
const editor = plugin.registry.get('editor').api |
|
|
|
|
|
|
|
|
|
|
|
if (config.get('currentFile') === path && editor.currentContent() !== file.content) { |
|
|
|
if (config.get('currentFile') === path && editor.currentContent() !== content) { |
|
|
|
if (provider.isReadOnly(path)) return editor.setText(file.content) |
|
|
|
if (provider.isReadOnly(path)) return editor.setText(content) |
|
|
|
dispatch(displayNotification( |
|
|
|
dispatch(displayNotification( |
|
|
|
path + ' changed', |
|
|
|
path + ' changed', |
|
|
|
'This file has been changed outside of Remix IDE.', |
|
|
|
'This file has been changed outside of Remix IDE.', |
|
|
|
'Replace by the new content', 'Keep the content displayed in Remix', |
|
|
|
'Replace by the new content', 'Keep the content displayed in Remix', |
|
|
|
() => { |
|
|
|
() => { |
|
|
|
editor.setText(file.content) |
|
|
|
editor.setText(content) |
|
|
|
} |
|
|
|
} |
|
|
|
)) |
|
|
|
)) |
|
|
|
} |
|
|
|
} |
|
|
|
}, 10) |
|
|
|
}, 10) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
provider.event.on('fileRenamedError', async () => { |
|
|
|
provider.event.on('fileRenamedError', () => { |
|
|
|
setTimeout(() => dispatch(displayNotification('File Renamed Failed', '', 'Ok', 'Cancel')), 10) |
|
|
|
setTimeout(() => dispatch(displayNotification('File Renamed Failed', '', 'Ok', 'Cancel')), 10) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|