Compare commits
1 Commits
dependabot
...
kshitij/fu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eb47c7431 |
@@ -2,6 +2,7 @@ import {
|
||||
APP_INIT_ERROR, APP_READY, subscribe, initialize, mergeConfig, getConfig, getPath,
|
||||
} from '@edx/frontend-platform';
|
||||
import { AppProvider, ErrorPage } from '@edx/frontend-platform/react';
|
||||
import { AuthoringAppSlot } from 'CourseAuthoring/plugin-slots/AuthoringAppSlot';
|
||||
import React, { StrictMode, useEffect } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import {
|
||||
@@ -97,12 +98,14 @@ const App = () => {
|
||||
|
||||
return (
|
||||
<AppProvider store={initializeStore()} wrapWithRouter={false}>
|
||||
<ToastProvider>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Head />
|
||||
<RouterProvider router={router} />
|
||||
</QueryClientProvider>
|
||||
</ToastProvider>
|
||||
<AuthoringAppSlot>
|
||||
<ToastProvider>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Head />
|
||||
<RouterProvider router={router} />
|
||||
</QueryClientProvider>
|
||||
</ToastProvider>
|
||||
</AuthoringAppSlot>
|
||||
</AppProvider>
|
||||
);
|
||||
};
|
||||
|
||||
44
src/plugin-slots/AuthoringAppSlot/README.md
Normal file
44
src/plugin-slots/AuthoringAppSlot/README.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# AuthoringAppSlot
|
||||
|
||||
### Slot ID: `authoring_app_slot`
|
||||
|
||||
### Plugin Props:
|
||||
|
||||
NONE
|
||||
|
||||
## Description
|
||||
|
||||
The slot wraps the entire application. It can be used to add content before or
|
||||
after the application (such as cookie banners) or to wrap the entire
|
||||
application in a component. One possible use case of that is to wrap the entire
|
||||
application in a context manager that would allow communication between
|
||||
different slots injected on the page.
|
||||
|
||||
## Example
|
||||
|
||||

|
||||
|
||||
The following example configuration wraps the entire app in a dashed border as
|
||||
shown above.
|
||||
|
||||
```js
|
||||
import { PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
||||
|
||||
const config = {
|
||||
pluginSlots: {
|
||||
authoring_app_slot: {
|
||||
keepDefault: true,
|
||||
plugins: [
|
||||
{
|
||||
op: PLUGIN_OPERATIONS.Wrap,
|
||||
widgetId: 'default_contents',
|
||||
wrapper: ({ component }) => (
|
||||
<div style={{ border: 'thick dashed red' }}>{component}</div>
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
};
|
||||
export default config;
|
||||
```
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 117 KiB |
11
src/plugin-slots/AuthoringAppSlot/index.tsx
Normal file
11
src/plugin-slots/AuthoringAppSlot/index.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
||||
|
||||
export const AuthoringAppSlot = ({ children }:AuthoringAppSlotProps) => (
|
||||
<PluginSlot id="authoring_app_slot">
|
||||
{children}
|
||||
</PluginSlot>
|
||||
);
|
||||
|
||||
interface AuthoringAppSlotProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
Reference in New Issue
Block a user