Merge branch 'master' into awaitasyncmodals

pull/1901/head
bunsenstraat 3 years ago committed by GitHub
commit fcef3f1d12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      libs/remix-ui/workspace/src/lib/actions/events.ts
  2. 7
      libs/remix-ui/workspace/src/lib/actions/payload.ts
  3. 9
      libs/remix-ui/workspace/src/lib/reducers/workspace.ts

@ -1,7 +1,7 @@
import { extractParentFromKey } from '@remix-ui/helper'
import React from 'react'
import { action } from '../types'
import { displayNotification, displayPopUp, fileAddedSuccess, fileRemovedSuccess, fileRenamedSuccess, folderAddedSuccess, loadLocalhostError, loadLocalhostRequest, loadLocalhostSuccess, removeContextMenuItem, rootFolderChangedSuccess, setContextMenuItem, setMode, setReadOnlyMode } from './payload'
import { displayNotification, displayPopUp, fileAddedSuccess, fileRemovedSuccess, fileRenamedSuccess, folderAddedSuccess, loadLocalhostError, loadLocalhostRequest, loadLocalhostSuccess, removeContextMenuItem, removeFocus, rootFolderChangedSuccess, setContextMenuItem, setMode, setReadOnlyMode } from './payload'
import { addInputField, createWorkspace, deleteWorkspace, fetchWorkspaceDirectory, renameWorkspace, switchToWorkspace, uploadFile } from './workspace'
const LOCALHOST = ' - connect to localhost - '
@ -45,6 +45,10 @@ export const listenOnPluginEvents = (filePanelPlugin) => {
plugin.on('fileManager', 'rootFolderChanged', async (path: string) => {
rootFolderChanged(path)
})
plugin.on('fileManager', 'fileClosed', async (file: string) => {
dispatch(removeFocus(file))
})
}
export const listenOnProviderEvents = (provider) => (reducerDispatch: React.Dispatch<any>) => {

@ -187,6 +187,13 @@ export const focusElement = (elements: { key: string, type: 'file' | 'folder' |
}
}
export const removeFocus = (name: string) => {
return {
type: 'REMOVE_FOCUS_ELEMENT',
payload: name
}
}
export const setContextMenuItem = (item: action) => {
return {
type: 'SET_CONTEXT_MENU_ITEM',

@ -497,6 +497,15 @@ export const browserReducer = (state = browserInitialState, action: Action) => {
}
}
case 'REMOVE_FOCUS_ELEMENT': {
const payload: string = action.payload
return {
...state,
focusElement: state.focusElement.filter(element => element.key !== payload)
}
}
case 'SET_CONTEXT_MENU_ITEM': {
const payload = action.payload as action

Loading…
Cancel
Save