-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into rpenido/fal-3876-add-library-content-to-a-…
…course
- Loading branch information
Showing
85 changed files
with
1,893 additions
and
1,546 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
|
||
/** | ||
* Shared context that's used by all our editors. | ||
* | ||
* Note: we're in the process of moving things from redux into this. | ||
*/ | ||
export interface EditorContext { | ||
learningContextId: string; | ||
/** | ||
* When editing components in the libraries part of the Authoring MFE, we show | ||
* the editors in a modal (fullScreen = false). This is the preferred approach | ||
* so that authors can see context behind the modal. | ||
* However, when making edits from the legacy course view, we display the | ||
* editors in a fullscreen view. This approach is deprecated. | ||
*/ | ||
fullScreen: boolean; | ||
} | ||
|
||
const context = React.createContext<EditorContext | undefined>(undefined); | ||
|
||
/** Hook to get the editor context (shared context) */ | ||
export function useEditorContext() { | ||
const ctx = React.useContext(context); | ||
if (ctx === undefined) { | ||
/* istanbul ignore next */ | ||
throw new Error('This component needs to be wrapped in <EditorContextProvider>'); | ||
} | ||
return ctx; | ||
} | ||
|
||
export const EditorContextProvider: React.FC<{ | ||
children: React.ReactNode, | ||
learningContextId: string; | ||
fullScreen: boolean; | ||
}> = ({ children, ...contextData }) => { | ||
const ctx: EditorContext = React.useMemo(() => ({ ...contextData }), []); | ||
return <context.Provider value={ctx}>{children}</context.Provider>; | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.