mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 13:30:23 -05:00
537673cdf6
IDE scope store and emitter with fixed PDF URLs GitOrigin-RevId: 9d33bad8a006bb55714878332f78932538dd8921
25 lines
878 B
TypeScript
25 lines
878 B
TypeScript
import { FC, useState } from 'react'
|
|
import { AngularScopeValueStore } from '@/features/ide-react/scope-value-store/angular-scope-value-store'
|
|
import { AngularScopeEventEmitter } from '@/features/ide-react/scope-event-emitter/angular-scope-event-emitter'
|
|
import { Ide, IdeProvider } from '@/shared/context/ide-context'
|
|
import { getMockIde } from '@/shared/context/mock/mock-ide'
|
|
|
|
export const IdeAngularProvider: FC<{ ide?: Ide }> = ({ ide, children }) => {
|
|
const [ideValue] = useState(() => ide || getMockIde())
|
|
const [scopeStore] = useState(
|
|
() => new AngularScopeValueStore(ideValue.$scope)
|
|
)
|
|
const [scopeEventEmitter] = useState(
|
|
() => new AngularScopeEventEmitter(ideValue.$scope)
|
|
)
|
|
|
|
return (
|
|
<IdeProvider
|
|
ide={ideValue}
|
|
scopeStore={scopeStore}
|
|
scopeEventEmitter={scopeEventEmitter}
|
|
>
|
|
{children}
|
|
</IdeProvider>
|
|
)
|
|
}
|