fix all tabs closing
pull/2388/head^2
yann300 3 years ago committed by GitHub
commit ed6287c5d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      apps/remix-ide/src/app/editor/editor.js
  2. 4
      apps/remix-ide/src/app/panels/tab-proxy.js
  3. 2
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx

@ -143,6 +143,7 @@ class Editor extends Plugin {
this.on('fileManager', 'fileClosed', (name) => {
if (name === this.currentFile) {
this.currentFile = null
this.renderComponent()
}
})
this.on('theme', 'themeLoaded', (theme) => {

@ -153,6 +153,10 @@ export class TabProxy extends Plugin {
displayName,
() => this.emit('switchApp', name),
() => {
if (name === 'home' && this.loadedTabs.length === 1 && this.loadedTabs[0].id === "home") {
const files = Object.keys(this.editor.sessions)
files.forEach(filepath => this.editor.discard(filepath))
}
this.emit('closeApp', name)
this.call('manager', 'deactivatePlugin', name)
},

@ -228,7 +228,7 @@ export const EditorUI = (props: EditorUIProps) => {
useEffect(() => {
if (!editorRef.current) return
if (!editorRef.current || !props.currentFile) return
currentFileRef.current = props.currentFile
const file = editorModelsState[props.currentFile]
editorRef.current.setModel(file.model)

Loading…
Cancel
Save