mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
24bd557485
Remove rootFolder from EditorContext GitOrigin-RevId: 827b046046265ad2418eb91d5a69eae02aa8b5a4
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
import FileTreeContext from '../../../../../frontend/js/features/file-tree/components/file-tree-context'
|
|
import { renderWithEditorContext } from '../../../helpers/render-with-context'
|
|
|
|
export default (children, options = {}) => {
|
|
let { contextProps = {}, ...renderOptions } = options
|
|
contextProps = {
|
|
projectId: '123abc',
|
|
rootFolder: [
|
|
{
|
|
_id: 'root-folder-id',
|
|
name: 'rootFolder',
|
|
docs: [],
|
|
fileRefs: [],
|
|
folders: [],
|
|
},
|
|
],
|
|
refProviders: {},
|
|
reindexReferences: () => {
|
|
console.log('reindex references')
|
|
},
|
|
setRefProviderEnabled: provider => {
|
|
console.log(`ref provider ${provider} enabled`)
|
|
},
|
|
setStartedFreeTrial: () => {
|
|
console.log('started free trial')
|
|
},
|
|
onSelect: () => {},
|
|
...contextProps,
|
|
}
|
|
const {
|
|
refProviders,
|
|
reindexReferences,
|
|
setRefProviderEnabled,
|
|
setStartedFreeTrial,
|
|
onSelect,
|
|
...editorContextProps
|
|
} = contextProps
|
|
return renderWithEditorContext(
|
|
<FileTreeContext
|
|
refProviders={refProviders}
|
|
reindexReferences={reindexReferences}
|
|
setRefProviderEnabled={setRefProviderEnabled}
|
|
setStartedFreeTrial={setStartedFreeTrial}
|
|
onSelect={onSelect}
|
|
>
|
|
{children}
|
|
</FileTreeContext>,
|
|
editorContextProps,
|
|
renderOptions
|
|
)
|
|
}
|