fix all tabs closing
pull/5370/head
yann300 3 years ago committed by GitHub
commit 4455ea944a
  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