@@ -15,10 +15,16 @@ export interface EditorContext {
1515 learningContextId : string ;
1616 /** Is the so-called "Markdown" problem editor available in this learning context? */
1717 isMarkdownEditorEnabledForContext : boolean ;
18+ /** e.g. "http://studio.local.openedx.io:8001" */
19+ studioEndpointUrl ?: string | null ;
20+ /** e.g. "http://local.openedx.io:8000" */
21+ lmsEndpointUrl ?: string | null ;
1822}
1923
2024export type EditorContextInit = {
2125 learningContextId : string ;
26+ studioEndpointUrl ?: string | null ;
27+ lmsEndpointUrl ?: string | null ;
2228} ;
2329
2430const context = React . createContext < EditorContext | undefined > ( undefined ) ;
@@ -36,17 +42,23 @@ export function useEditorContext() {
3642export const EditorContextProvider : React . FC < { children : React . ReactNode ; } & EditorContextInit > = ( {
3743 children,
3844 learningContextId,
45+ studioEndpointUrl,
46+ lmsEndpointUrl,
3947} ) => {
4048 const courseIdIfCourse = isCourseKey ( learningContextId ) ? learningContextId : undefined ;
4149 const isMarkdownEditorEnabledForContext = useWaffleFlags ( courseIdIfCourse ) . useReactMarkdownEditor ;
4250
4351 const ctx : EditorContext = React . useMemo ( ( ) => ( {
4452 learningContextId,
4553 isMarkdownEditorEnabledForContext,
54+ studioEndpointUrl,
55+ lmsEndpointUrl,
4656 } ) , [
4757 // Dependencies - make sure we update the context object if any of these values change:
4858 learningContextId ,
4959 isMarkdownEditorEnabledForContext ,
60+ studioEndpointUrl ,
61+ lmsEndpointUrl ,
5062 ] ) ;
5163 return < context . Provider value = { ctx } > { children } </ context . Provider > ;
5264} ;
0 commit comments