strapi-plugin-bulk-editor 0.1.4 → 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.
Files changed (2) hide show
  1. package/admin/src/index.tsx +16 -15
  2. package/package.json +4 -2
@@ -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 ReactDOM from 'react-dom/client';
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
- // Create a div for the modal manager and render it once
17
- const modalRoot = document.createElement('div');
18
- modalRoot.id = 'bulk-editor-modal-root';
19
- document.body.appendChild(modalRoot);
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 />,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-bulk-editor",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Bulk edit Strapi entries in a spreadsheet-like interface",
5
5
  "license": "MIT",
6
6
  "author": "John Chedeville <hi@jchd.me>",
@@ -45,6 +45,8 @@
45
45
  ],
46
46
  "dependencies": {},
47
47
  "peerDependencies": {
48
- "@strapi/strapi": "^5.0.0"
48
+ "@strapi/strapi": "^5.0.0",
49
+ "react": "^18.0.0",
50
+ "react-dom": "^18.0.0"
49
51
  }
50
52
  }