mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-09 05:50:51 +00:00
ad3c66b36e
GitOrigin-RevId: cab09354cf4b325a1ea3814a8c4c49fac7c831be
22 lines
614 B
JavaScript
22 lines
614 B
JavaScript
import React from 'react'
|
|
import { ContextRoot } from '../../js/shared/context/root-context'
|
|
|
|
// Unfortunately, we cannot currently use decorators here, since we need to
|
|
// set a value on window, before the contexts are rendered.
|
|
// When using decorators, the contexts are rendered before the story, so we
|
|
// don't have the opportunity to set the window value first.
|
|
export function withContextRoot(Story, scope) {
|
|
const ide = {
|
|
...window._ide,
|
|
$scope: {
|
|
...window._ide.$scope,
|
|
...scope,
|
|
},
|
|
}
|
|
|
|
return (
|
|
<ContextRoot ide={ide} settings={{}}>
|
|
{Story}
|
|
</ContextRoot>
|
|
)
|
|
}
|