strapi-plugin-bulk-editor 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/index.tsx +16 -15
- package/package.json +1 -1
package/admin/src/index.tsx
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { DesignSystemProvider } from '@strapi/design-system';
|
|
2
1
|
import { Pencil } from '@strapi/icons';
|
|
3
2
|
import { useFetchClient, useNotification } from '@strapi/strapi/admin';
|
|
4
|
-
import
|
|
3
|
+
import React from 'react';
|
|
5
4
|
import { ModalManager, openBulkEditModal } from './components/ModalManager';
|
|
6
5
|
|
|
6
|
+
// Global component that wraps the app
|
|
7
|
+
const BulkEditorProvider = ({ children }: { children: React.ReactNode }) => {
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
{children}
|
|
11
|
+
<ModalManager />
|
|
12
|
+
</>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
7
16
|
export default {
|
|
8
17
|
register(app: any) {
|
|
9
18
|
app.registerPlugin({
|
|
@@ -13,24 +22,17 @@ export default {
|
|
|
13
22
|
},
|
|
14
23
|
|
|
15
24
|
bootstrap(app: any) {
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const root = ReactDOM.createRoot(modalRoot);
|
|
22
|
-
root.render(
|
|
23
|
-
<DesignSystemProvider locale="en">
|
|
24
|
-
<ModalManager />
|
|
25
|
-
</DesignSystemProvider>
|
|
26
|
-
);
|
|
25
|
+
// Inject ModalManager into app layout
|
|
26
|
+
app.injectContentManagerComponent('editView', 'right-links', {
|
|
27
|
+
name: 'bulk-editor-modal',
|
|
28
|
+
Component: () => <ModalManager />,
|
|
29
|
+
});
|
|
27
30
|
|
|
28
31
|
const contentManager = app.getPlugin('content-manager');
|
|
29
32
|
|
|
30
33
|
if (contentManager && contentManager.apis) {
|
|
31
34
|
contentManager.apis.addBulkAction([
|
|
32
35
|
function BulkEditAction({ documents, model }: { documents: any[]; model: string }) {
|
|
33
|
-
// Access hooks here where we have proper context
|
|
34
36
|
const toggleNotification = useNotification();
|
|
35
37
|
const fetchClient = useFetchClient();
|
|
36
38
|
|
|
@@ -38,7 +40,6 @@ export default {
|
|
|
38
40
|
openBulkEditModal(documents, model, toggleNotification, fetchClient);
|
|
39
41
|
};
|
|
40
42
|
|
|
41
|
-
// Return props object that works
|
|
42
43
|
return {
|
|
43
44
|
label: 'Bulk Edit',
|
|
44
45
|
icon: <Pencil />,
|