@strapi/content-manager 5.12.4 → 5.12.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 (36) hide show
  1. package/dist/admin/components/Widgets.js +161 -0
  2. package/dist/admin/components/Widgets.js.map +1 -0
  3. package/dist/admin/components/Widgets.mjs +158 -0
  4. package/dist/admin/components/Widgets.mjs.map +1 -0
  5. package/dist/admin/index.js +41 -2
  6. package/dist/admin/index.js.map +1 -1
  7. package/dist/admin/index.mjs +42 -3
  8. package/dist/admin/index.mjs.map +1 -1
  9. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js +7 -12
  10. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js.map +1 -1
  11. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs +8 -13
  12. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs.map +1 -1
  13. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/EditorLayout.js +46 -95
  14. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/EditorLayout.js.map +1 -1
  15. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/EditorLayout.mjs +48 -78
  16. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/EditorLayout.mjs.map +1 -1
  17. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.js +50 -97
  18. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.js.map +1 -1
  19. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs +51 -79
  20. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs.map +1 -1
  21. package/dist/admin/preview/components/PreviewHeader.js +1 -1
  22. package/dist/admin/preview/components/PreviewHeader.js.map +1 -1
  23. package/dist/admin/preview/components/PreviewHeader.mjs +1 -1
  24. package/dist/admin/preview/components/PreviewHeader.mjs.map +1 -1
  25. package/dist/admin/services/homepage.js +26 -0
  26. package/dist/admin/services/homepage.js.map +1 -0
  27. package/dist/admin/services/homepage.mjs +24 -0
  28. package/dist/admin/services/homepage.mjs.map +1 -0
  29. package/dist/admin/src/components/Widgets.d.ts +3 -0
  30. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/EditorLayout.d.ts +2 -2
  31. package/dist/admin/src/services/homepage.d.ts +5 -0
  32. package/dist/server/src/services/homepage.d.ts +11 -0
  33. package/dist/server/src/services/homepage.d.ts.map +1 -0
  34. package/dist/shared/contracts/homepage.d.ts +25 -0
  35. package/dist/shared/contracts/homepage.d.ts.map +1 -0
  36. package/package.json +7 -7
@@ -0,0 +1,161 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var strapiAdmin = require('@strapi/admin/strapi-admin');
5
+ var designSystem = require('@strapi/design-system');
6
+ var Icons = require('@strapi/icons');
7
+ var reactIntl = require('react-intl');
8
+ var reactRouterDom = require('react-router-dom');
9
+ var styledComponents = require('styled-components');
10
+ var DocumentStatus = require('../pages/EditView/components/DocumentStatus.js');
11
+ var homepage = require('../services/homepage.js');
12
+ var RelativeTime = require('./RelativeTime.js');
13
+
14
+ const CellTypography = styledComponents.styled(designSystem.Typography).attrs({
15
+ maxWidth: '14.4rem',
16
+ display: 'block'
17
+ })`
18
+ overflow: hidden;
19
+ text-overflow: ellipsis;
20
+ white-space: nowrap;
21
+ `;
22
+ const RecentDocumentsTable = ({ documents })=>{
23
+ const { formatMessage } = reactIntl.useIntl();
24
+ const { trackUsage } = strapiAdmin.useTracking();
25
+ const navigate = reactRouterDom.useNavigate();
26
+ const getEditViewLink = (document)=>{
27
+ const isSingleType = document.kind === 'singleType';
28
+ const kindPath = isSingleType ? 'single-types' : 'collection-types';
29
+ const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';
30
+ return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;
31
+ };
32
+ const handleRowClick = (document)=>()=>{
33
+ trackUsage('willEditEntryFromHome');
34
+ const link = getEditViewLink(document);
35
+ navigate(link);
36
+ };
37
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Table, {
38
+ colCount: 5,
39
+ rowCount: documents?.length ?? 0,
40
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tbody, {
41
+ children: documents?.map((document)=>/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
42
+ onClick: handleRowClick(document),
43
+ cursor: "pointer",
44
+ children: [
45
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
46
+ children: /*#__PURE__*/ jsxRuntime.jsx(CellTypography, {
47
+ title: document.title,
48
+ variant: "omega",
49
+ textColor: "neutral800",
50
+ children: document.title
51
+ })
52
+ }),
53
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
54
+ children: /*#__PURE__*/ jsxRuntime.jsx(CellTypography, {
55
+ variant: "omega",
56
+ textColor: "neutral600",
57
+ children: document.kind === 'singleType' ? formatMessage({
58
+ id: 'content-manager.widget.last-edited.single-type',
59
+ defaultMessage: 'Single-Type'
60
+ }) : formatMessage({
61
+ id: document.contentTypeDisplayName,
62
+ defaultMessage: document.contentTypeDisplayName
63
+ })
64
+ })
65
+ }),
66
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
67
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
68
+ display: "inline-block",
69
+ children: document.status ? /*#__PURE__*/ jsxRuntime.jsx(DocumentStatus.DocumentStatus, {
70
+ status: document.status
71
+ }) : /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
72
+ textColor: "neutral600",
73
+ "aria-hidden": true,
74
+ children: "-"
75
+ })
76
+ })
77
+ }),
78
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
79
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
80
+ textColor: "neutral600",
81
+ children: /*#__PURE__*/ jsxRuntime.jsx(RelativeTime.RelativeTime, {
82
+ timestamp: new Date(document.updatedAt)
83
+ })
84
+ })
85
+ }),
86
+ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
87
+ onClick: (e)=>e.stopPropagation(),
88
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
89
+ display: "inline-block",
90
+ children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
91
+ tag: reactRouterDom.Link,
92
+ to: getEditViewLink(document),
93
+ onClick: ()=>trackUsage('willEditEntryFromHome'),
94
+ label: formatMessage({
95
+ id: 'content-manager.actions.edit.label',
96
+ defaultMessage: 'Edit'
97
+ }),
98
+ variant: "ghost",
99
+ children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Pencil, {})
100
+ })
101
+ })
102
+ })
103
+ ]
104
+ }, document.documentId))
105
+ })
106
+ });
107
+ };
108
+ /* -------------------------------------------------------------------------------------------------
109
+ * LastEditedWidget
110
+ * -----------------------------------------------------------------------------------------------*/ const LastEditedWidget = ()=>{
111
+ const { formatMessage } = reactIntl.useIntl();
112
+ const { data, isLoading, error } = homepage.useGetRecentDocumentsQuery({
113
+ action: 'update'
114
+ });
115
+ if (isLoading) {
116
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Loading, {});
117
+ }
118
+ if (error || !data) {
119
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Error, {});
120
+ }
121
+ if (data.length === 0) {
122
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.NoData, {
123
+ children: formatMessage({
124
+ id: 'content-manager.widget.last-edited.no-data',
125
+ defaultMessage: 'No edited entries'
126
+ })
127
+ });
128
+ }
129
+ return /*#__PURE__*/ jsxRuntime.jsx(RecentDocumentsTable, {
130
+ documents: data
131
+ });
132
+ };
133
+ /* -------------------------------------------------------------------------------------------------
134
+ * LastPublishedWidget
135
+ * -----------------------------------------------------------------------------------------------*/ const LastPublishedWidget = ()=>{
136
+ const { formatMessage } = reactIntl.useIntl();
137
+ const { data, isLoading, error } = homepage.useGetRecentDocumentsQuery({
138
+ action: 'publish'
139
+ });
140
+ if (isLoading) {
141
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Loading, {});
142
+ }
143
+ if (error || !data) {
144
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.Error, {});
145
+ }
146
+ if (data.length === 0) {
147
+ return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Widget.NoData, {
148
+ children: formatMessage({
149
+ id: 'content-manager.widget.last-published.no-data',
150
+ defaultMessage: 'No published entries'
151
+ })
152
+ });
153
+ }
154
+ return /*#__PURE__*/ jsxRuntime.jsx(RecentDocumentsTable, {
155
+ documents: data
156
+ });
157
+ };
158
+
159
+ exports.LastEditedWidget = LastEditedWidget;
160
+ exports.LastPublishedWidget = LastPublishedWidget;
161
+ //# sourceMappingURL=Widgets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Widgets.js","sources":["../../../admin/src/components/Widgets.tsx"],"sourcesContent":["import { Widget, useTracking } from '@strapi/admin/strapi-admin';\nimport { Box, IconButton, Table, Tbody, Td, Tr, Typography } from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { Link, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { DocumentStatus } from '../pages/EditView/components/DocumentStatus';\nimport { useGetRecentDocumentsQuery } from '../services/homepage';\n\nimport { RelativeTime } from './RelativeTime';\n\nimport type { RecentDocument } from '../../../shared/contracts/homepage';\n\nconst CellTypography = styled(Typography).attrs({ maxWidth: '14.4rem', display: 'block' })`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst RecentDocumentsTable = ({ documents }: { documents: RecentDocument[] }) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const navigate = useNavigate();\n\n const getEditViewLink = (document: RecentDocument): string => {\n const isSingleType = document.kind === 'singleType';\n const kindPath = isSingleType ? 'single-types' : 'collection-types';\n const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';\n\n return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;\n };\n\n const handleRowClick = (document: RecentDocument) => () => {\n trackUsage('willEditEntryFromHome');\n const link = getEditViewLink(document);\n navigate(link);\n };\n\n return (\n <Table colCount={5} rowCount={documents?.length ?? 0}>\n <Tbody>\n {documents?.map((document) => (\n <Tr onClick={handleRowClick(document)} cursor=\"pointer\" key={document.documentId}>\n <Td>\n <CellTypography title={document.title} variant=\"omega\" textColor=\"neutral800\">\n {document.title}\n </CellTypography>\n </Td>\n <Td>\n <CellTypography variant=\"omega\" textColor=\"neutral600\">\n {document.kind === 'singleType'\n ? formatMessage({\n id: 'content-manager.widget.last-edited.single-type',\n defaultMessage: 'Single-Type',\n })\n : formatMessage({\n id: document.contentTypeDisplayName,\n defaultMessage: document.contentTypeDisplayName,\n })}\n </CellTypography>\n </Td>\n <Td>\n <Box display=\"inline-block\">\n {document.status ? (\n <DocumentStatus status={document.status} />\n ) : (\n <Typography textColor=\"neutral600\" aria-hidden>\n -\n </Typography>\n )}\n </Box>\n </Td>\n <Td>\n <Typography textColor=\"neutral600\">\n <RelativeTime timestamp={new Date(document.updatedAt)} />\n </Typography>\n </Td>\n <Td onClick={(e) => e.stopPropagation()}>\n <Box display=\"inline-block\">\n <IconButton\n tag={Link}\n to={getEditViewLink(document)}\n onClick={() => trackUsage('willEditEntryFromHome')}\n label={formatMessage({\n id: 'content-manager.actions.edit.label',\n defaultMessage: 'Edit',\n })}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n </Box>\n </Td>\n </Tr>\n ))}\n </Tbody>\n </Table>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LastEditedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastEditedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'update' });\n\n if (isLoading) {\n return <Widget.Loading />;\n }\n\n if (error || !data) {\n return <Widget.Error />;\n }\n\n if (data.length === 0) {\n return (\n <Widget.NoData>\n {formatMessage({\n id: 'content-manager.widget.last-edited.no-data',\n defaultMessage: 'No edited entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LastPublishedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastPublishedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'publish' });\n\n if (isLoading) {\n return <Widget.Loading />;\n }\n\n if (error || !data) {\n return <Widget.Error />;\n }\n\n if (data.length === 0) {\n return (\n <Widget.NoData>\n {formatMessage({\n id: 'content-manager.widget.last-published.no-data',\n defaultMessage: 'No published entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\nexport { LastEditedWidget, LastPublishedWidget };\n"],"names":["CellTypography","styled","Typography","attrs","maxWidth","display","RecentDocumentsTable","documents","formatMessage","useIntl","trackUsage","useTracking","navigate","useNavigate","getEditViewLink","document","isSingleType","kind","kindPath","queryParams","locale","contentTypeUid","documentId","handleRowClick","link","_jsx","Table","colCount","rowCount","length","Tbody","map","_jsxs","Tr","onClick","cursor","Td","title","variant","textColor","id","defaultMessage","contentTypeDisplayName","Box","status","DocumentStatus","aria-hidden","RelativeTime","timestamp","Date","updatedAt","e","stopPropagation","IconButton","tag","Link","to","label","Pencil","LastEditedWidget","data","isLoading","error","useGetRecentDocumentsQuery","action","Widget","Loading","Error","NoData","LastPublishedWidget"],"mappings":";;;;;;;;;;;;;AAcA,MAAMA,cAAiBC,GAAAA,uBAAAA,CAAOC,uBAAYC,CAAAA,CAAAA,KAAK,CAAC;IAAEC,QAAU,EAAA,SAAA;IAAWC,OAAS,EAAA;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wC,mBAAOG,MAAM,EAAA;sBACX5D,aAAc,CAAA;gBACbgC,EAAI,EAAA,4CAAA;gBACJC,cAAgB,EAAA;AAClB,aAAA;;AAGN;AAEA,IAAA,qBAAOhB,cAACnB,CAAAA,oBAAAA,EAAAA;QAAqBC,SAAWqD,EAAAA;;AAC1C;AAEA;;AAEkG,2GAE5FS,mBAAsB,GAAA,IAAA;IAC1B,MAAM,EAAE7D,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;IAC1B,MAAM,EAAEmD,IAAI,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGC,mCAA2B,CAAA;QAAEC,MAAQ,EAAA;AAAU,KAAA,CAAA;AAElF,IAAA,IAAIH,SAAW,EAAA;QACb,qBAAOpC,cAAA,CAACwC,mBAAOC,OAAO,EAAA,EAAA,CAAA;AACxB;IAEA,IAAIJ,KAAAA,IAAS,CAACF,IAAM,EAAA;QAClB,qBAAOnC,cAAA,CAACwC,mBAAOE,KAAK,EAAA,EAAA,CAAA;AACtB;IAEA,IAAIP,IAAAA,CAAK/B,MAAM,KAAK,CAAG,EAAA;QACrB,qBACEJ,cAAA,CAACwC,mBAAOG,MAAM,EAAA;sBACX5D,aAAc,CAAA;gBACbgC,EAAI,EAAA,+CAAA;gBACJC,cAAgB,EAAA;AAClB,aAAA;;AAGN;AAEA,IAAA,qBAAOhB,cAACnB,CAAAA,oBAAAA,EAAAA;QAAqBC,SAAWqD,EAAAA;;AAC1C;;;;;"}
@@ -0,0 +1,158 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Widget, useTracking } from '@strapi/admin/strapi-admin';
3
+ import { Typography, Table, Tbody, Tr, Td, Box, IconButton } from '@strapi/design-system';
4
+ import { Pencil } from '@strapi/icons';
5
+ import { useIntl } from 'react-intl';
6
+ import { useNavigate, Link } from 'react-router-dom';
7
+ import { styled } from 'styled-components';
8
+ import { DocumentStatus } from '../pages/EditView/components/DocumentStatus.mjs';
9
+ import { useGetRecentDocumentsQuery } from '../services/homepage.mjs';
10
+ import { RelativeTime } from './RelativeTime.mjs';
11
+
12
+ const CellTypography = styled(Typography).attrs({
13
+ maxWidth: '14.4rem',
14
+ display: 'block'
15
+ })`
16
+ overflow: hidden;
17
+ text-overflow: ellipsis;
18
+ white-space: nowrap;
19
+ `;
20
+ const RecentDocumentsTable = ({ documents })=>{
21
+ const { formatMessage } = useIntl();
22
+ const { trackUsage } = useTracking();
23
+ const navigate = useNavigate();
24
+ const getEditViewLink = (document)=>{
25
+ const isSingleType = document.kind === 'singleType';
26
+ const kindPath = isSingleType ? 'single-types' : 'collection-types';
27
+ const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';
28
+ return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;
29
+ };
30
+ const handleRowClick = (document)=>()=>{
31
+ trackUsage('willEditEntryFromHome');
32
+ const link = getEditViewLink(document);
33
+ navigate(link);
34
+ };
35
+ return /*#__PURE__*/ jsx(Table, {
36
+ colCount: 5,
37
+ rowCount: documents?.length ?? 0,
38
+ children: /*#__PURE__*/ jsx(Tbody, {
39
+ children: documents?.map((document)=>/*#__PURE__*/ jsxs(Tr, {
40
+ onClick: handleRowClick(document),
41
+ cursor: "pointer",
42
+ children: [
43
+ /*#__PURE__*/ jsx(Td, {
44
+ children: /*#__PURE__*/ jsx(CellTypography, {
45
+ title: document.title,
46
+ variant: "omega",
47
+ textColor: "neutral800",
48
+ children: document.title
49
+ })
50
+ }),
51
+ /*#__PURE__*/ jsx(Td, {
52
+ children: /*#__PURE__*/ jsx(CellTypography, {
53
+ variant: "omega",
54
+ textColor: "neutral600",
55
+ children: document.kind === 'singleType' ? formatMessage({
56
+ id: 'content-manager.widget.last-edited.single-type',
57
+ defaultMessage: 'Single-Type'
58
+ }) : formatMessage({
59
+ id: document.contentTypeDisplayName,
60
+ defaultMessage: document.contentTypeDisplayName
61
+ })
62
+ })
63
+ }),
64
+ /*#__PURE__*/ jsx(Td, {
65
+ children: /*#__PURE__*/ jsx(Box, {
66
+ display: "inline-block",
67
+ children: document.status ? /*#__PURE__*/ jsx(DocumentStatus, {
68
+ status: document.status
69
+ }) : /*#__PURE__*/ jsx(Typography, {
70
+ textColor: "neutral600",
71
+ "aria-hidden": true,
72
+ children: "-"
73
+ })
74
+ })
75
+ }),
76
+ /*#__PURE__*/ jsx(Td, {
77
+ children: /*#__PURE__*/ jsx(Typography, {
78
+ textColor: "neutral600",
79
+ children: /*#__PURE__*/ jsx(RelativeTime, {
80
+ timestamp: new Date(document.updatedAt)
81
+ })
82
+ })
83
+ }),
84
+ /*#__PURE__*/ jsx(Td, {
85
+ onClick: (e)=>e.stopPropagation(),
86
+ children: /*#__PURE__*/ jsx(Box, {
87
+ display: "inline-block",
88
+ children: /*#__PURE__*/ jsx(IconButton, {
89
+ tag: Link,
90
+ to: getEditViewLink(document),
91
+ onClick: ()=>trackUsage('willEditEntryFromHome'),
92
+ label: formatMessage({
93
+ id: 'content-manager.actions.edit.label',
94
+ defaultMessage: 'Edit'
95
+ }),
96
+ variant: "ghost",
97
+ children: /*#__PURE__*/ jsx(Pencil, {})
98
+ })
99
+ })
100
+ })
101
+ ]
102
+ }, document.documentId))
103
+ })
104
+ });
105
+ };
106
+ /* -------------------------------------------------------------------------------------------------
107
+ * LastEditedWidget
108
+ * -----------------------------------------------------------------------------------------------*/ const LastEditedWidget = ()=>{
109
+ const { formatMessage } = useIntl();
110
+ const { data, isLoading, error } = useGetRecentDocumentsQuery({
111
+ action: 'update'
112
+ });
113
+ if (isLoading) {
114
+ return /*#__PURE__*/ jsx(Widget.Loading, {});
115
+ }
116
+ if (error || !data) {
117
+ return /*#__PURE__*/ jsx(Widget.Error, {});
118
+ }
119
+ if (data.length === 0) {
120
+ return /*#__PURE__*/ jsx(Widget.NoData, {
121
+ children: formatMessage({
122
+ id: 'content-manager.widget.last-edited.no-data',
123
+ defaultMessage: 'No edited entries'
124
+ })
125
+ });
126
+ }
127
+ return /*#__PURE__*/ jsx(RecentDocumentsTable, {
128
+ documents: data
129
+ });
130
+ };
131
+ /* -------------------------------------------------------------------------------------------------
132
+ * LastPublishedWidget
133
+ * -----------------------------------------------------------------------------------------------*/ const LastPublishedWidget = ()=>{
134
+ const { formatMessage } = useIntl();
135
+ const { data, isLoading, error } = useGetRecentDocumentsQuery({
136
+ action: 'publish'
137
+ });
138
+ if (isLoading) {
139
+ return /*#__PURE__*/ jsx(Widget.Loading, {});
140
+ }
141
+ if (error || !data) {
142
+ return /*#__PURE__*/ jsx(Widget.Error, {});
143
+ }
144
+ if (data.length === 0) {
145
+ return /*#__PURE__*/ jsx(Widget.NoData, {
146
+ children: formatMessage({
147
+ id: 'content-manager.widget.last-published.no-data',
148
+ defaultMessage: 'No published entries'
149
+ })
150
+ });
151
+ }
152
+ return /*#__PURE__*/ jsx(RecentDocumentsTable, {
153
+ documents: data
154
+ });
155
+ };
156
+
157
+ export { LastEditedWidget, LastPublishedWidget };
158
+ //# sourceMappingURL=Widgets.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Widgets.mjs","sources":["../../../admin/src/components/Widgets.tsx"],"sourcesContent":["import { Widget, useTracking } from '@strapi/admin/strapi-admin';\nimport { Box, IconButton, Table, Tbody, Td, Tr, Typography } from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { Link, useNavigate } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { DocumentStatus } from '../pages/EditView/components/DocumentStatus';\nimport { useGetRecentDocumentsQuery } from '../services/homepage';\n\nimport { RelativeTime } from './RelativeTime';\n\nimport type { RecentDocument } from '../../../shared/contracts/homepage';\n\nconst CellTypography = styled(Typography).attrs({ maxWidth: '14.4rem', display: 'block' })`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nconst RecentDocumentsTable = ({ documents }: { documents: RecentDocument[] }) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const navigate = useNavigate();\n\n const getEditViewLink = (document: RecentDocument): string => {\n const isSingleType = document.kind === 'singleType';\n const kindPath = isSingleType ? 'single-types' : 'collection-types';\n const queryParams = document.locale ? `?plugins[i18n][locale]=${document.locale}` : '';\n\n return `/content-manager/${kindPath}/${document.contentTypeUid}${isSingleType ? '' : '/' + document.documentId}${queryParams}`;\n };\n\n const handleRowClick = (document: RecentDocument) => () => {\n trackUsage('willEditEntryFromHome');\n const link = getEditViewLink(document);\n navigate(link);\n };\n\n return (\n <Table colCount={5} rowCount={documents?.length ?? 0}>\n <Tbody>\n {documents?.map((document) => (\n <Tr onClick={handleRowClick(document)} cursor=\"pointer\" key={document.documentId}>\n <Td>\n <CellTypography title={document.title} variant=\"omega\" textColor=\"neutral800\">\n {document.title}\n </CellTypography>\n </Td>\n <Td>\n <CellTypography variant=\"omega\" textColor=\"neutral600\">\n {document.kind === 'singleType'\n ? formatMessage({\n id: 'content-manager.widget.last-edited.single-type',\n defaultMessage: 'Single-Type',\n })\n : formatMessage({\n id: document.contentTypeDisplayName,\n defaultMessage: document.contentTypeDisplayName,\n })}\n </CellTypography>\n </Td>\n <Td>\n <Box display=\"inline-block\">\n {document.status ? (\n <DocumentStatus status={document.status} />\n ) : (\n <Typography textColor=\"neutral600\" aria-hidden>\n -\n </Typography>\n )}\n </Box>\n </Td>\n <Td>\n <Typography textColor=\"neutral600\">\n <RelativeTime timestamp={new Date(document.updatedAt)} />\n </Typography>\n </Td>\n <Td onClick={(e) => e.stopPropagation()}>\n <Box display=\"inline-block\">\n <IconButton\n tag={Link}\n to={getEditViewLink(document)}\n onClick={() => trackUsage('willEditEntryFromHome')}\n label={formatMessage({\n id: 'content-manager.actions.edit.label',\n defaultMessage: 'Edit',\n })}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n </Box>\n </Td>\n </Tr>\n ))}\n </Tbody>\n </Table>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LastEditedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastEditedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'update' });\n\n if (isLoading) {\n return <Widget.Loading />;\n }\n\n if (error || !data) {\n return <Widget.Error />;\n }\n\n if (data.length === 0) {\n return (\n <Widget.NoData>\n {formatMessage({\n id: 'content-manager.widget.last-edited.no-data',\n defaultMessage: 'No edited entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * LastPublishedWidget\n * -----------------------------------------------------------------------------------------------*/\n\nconst LastPublishedWidget = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, error } = useGetRecentDocumentsQuery({ action: 'publish' });\n\n if (isLoading) {\n return <Widget.Loading />;\n }\n\n if (error || !data) {\n return <Widget.Error />;\n }\n\n if (data.length === 0) {\n return (\n <Widget.NoData>\n {formatMessage({\n id: 'content-manager.widget.last-published.no-data',\n defaultMessage: 'No published entries',\n })}\n </Widget.NoData>\n );\n }\n\n return <RecentDocumentsTable documents={data} />;\n};\n\nexport { LastEditedWidget, LastPublishedWidget };\n"],"names":["CellTypography","styled","Typography","attrs","maxWidth","display","RecentDocumentsTable","documents","formatMessage","useIntl","trackUsage","useTracking","navigate","useNavigate","getEditViewLink","document","isSingleType","kind","kindPath","queryParams","locale","contentTypeUid","documentId","handleRowClick","link","_jsx","Table","colCount","rowCount","length","Tbody","map","_jsxs","Tr","onClick","cursor","Td","title","variant","textColor","id","defaultMessage","contentTypeDisplayName","Box","status","DocumentStatus","aria-hidden","RelativeTime","timestamp","Date","updatedAt","e","stopPropagation","IconButton","tag","Link","to","label","Pencil","LastEditedWidget","data","isLoading","error","useGetRecentDocumentsQuery","action","Widget","Loading","Error","NoData","LastPublishedWidget"],"mappings":";;;;;;;;;;;AAcA,MAAMA,cAAiBC,GAAAA,MAAAA,CAAOC,UAAYC,CAAAA,CAAAA,KAAK,CAAC;IAAEC,QAAU,EAAA,SAAA;IAA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OAAOG,MAAM,EAAA;sBACX5D,aAAc,CAAA;gBACbgC,EAAI,EAAA,4CAAA;gBACJC,cAAgB,EAAA;AAClB,aAAA;;AAGN;AAEA,IAAA,qBAAOhB,GAACnB,CAAAA,oBAAAA,EAAAA;QAAqBC,SAAWqD,EAAAA;;AAC1C;AAEA;;AAEkG,2GAE5FS,mBAAsB,GAAA,IAAA;IAC1B,MAAM,EAAE7D,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAM,EAAEmD,IAAI,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGC,0BAA2B,CAAA;QAAEC,MAAQ,EAAA;AAAU,KAAA,CAAA;AAElF,IAAA,IAAIH,SAAW,EAAA;QACb,qBAAOpC,GAAA,CAACwC,OAAOC,OAAO,EAAA,EAAA,CAAA;AACxB;IAEA,IAAIJ,KAAAA,IAAS,CAACF,IAAM,EAAA;QAClB,qBAAOnC,GAAA,CAACwC,OAAOE,KAAK,EAAA,EAAA,CAAA;AACtB;IAEA,IAAIP,IAAAA,CAAK/B,MAAM,KAAK,CAAG,EAAA;QACrB,qBACEJ,GAAA,CAACwC,OAAOG,MAAM,EAAA;sBACX5D,aAAc,CAAA;gBACbgC,EAAI,EAAA,+CAAA;gBACJC,cAAgB,EAAA;AAClB,aAAA;;AAGN;AAEA,IAAA,qBAAOhB,GAACnB,CAAAA,oBAAAA,EAAAA;QAAqBC,SAAWqD,EAAAA;;AAC1C;;;;"}
@@ -20,7 +20,7 @@ var DocumentRBAC = require('./features/DocumentRBAC.js');
20
20
 
21
21
  function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
22
22
 
23
- function __variableDynamicImportRuntime1__(path) {
23
+ function __variableDynamicImportRuntime3__(path) {
24
24
  switch (path) {
25
25
  case './translations/ar.json': return Promise.resolve().then(function () { return require('./translations/ar.json.js'); });
26
26
  case './translations/ca.json': return Promise.resolve().then(function () { return require('./translations/ca.json.js'); });
@@ -88,6 +88,45 @@ var index = {
88
88
  children: router.routes
89
89
  });
90
90
  app.registerPlugin(cm.config);
91
+ // Register homepage widgets
92
+ app.widgets.register([
93
+ {
94
+ icon: Icons.Pencil,
95
+ title: {
96
+ id: `${plugin.PLUGIN_ID}.widget.last-edited.title`,
97
+ defaultMessage: 'Last edited entries'
98
+ },
99
+ component: async ()=>{
100
+ const { LastEditedWidget } = await Promise.resolve().then(function () { return require('./components/Widgets.js'); });
101
+ return LastEditedWidget;
102
+ },
103
+ pluginId: plugin.PLUGIN_ID,
104
+ id: 'last-edited-entries',
105
+ permissions: [
106
+ {
107
+ action: 'plugin::content-manager.explorer.read'
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ icon: Icons.CheckCircle,
113
+ title: {
114
+ id: `${plugin.PLUGIN_ID}.widget.last-published.title`,
115
+ defaultMessage: 'Last published entries'
116
+ },
117
+ component: async ()=>{
118
+ const { LastPublishedWidget } = await Promise.resolve().then(function () { return require('./components/Widgets.js'); });
119
+ return LastPublishedWidget;
120
+ },
121
+ pluginId: plugin.PLUGIN_ID,
122
+ id: 'last-published-entries',
123
+ permissions: [
124
+ {
125
+ action: 'plugin::content-manager.explorer.read'
126
+ }
127
+ ]
128
+ }
129
+ ]);
91
130
  },
92
131
  bootstrap (app) {
93
132
  if (typeof index$1.historyAdmin.bootstrap === 'function') {
@@ -99,7 +138,7 @@ var index = {
99
138
  },
100
139
  async registerTrads ({ locales }) {
101
140
  const importedTrads = await Promise.all(locales.map((locale)=>{
102
- return __variableDynamicImportRuntime1__(`./translations/${locale}.json`).then(({ default: data })=>{
141
+ return __variableDynamicImportRuntime3__(`./translations/${locale}.json`).then(({ default: data })=>{
103
142
  return {
104
143
  data: translations.prefixPluginTranslations(data, plugin.PLUGIN_ID),
105
144
  locale
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import { Feather } from '@strapi/icons';\n\nimport { PLUGIN_ID } from './constants/plugin';\nimport { ContentManagerPlugin } from './content-manager';\nimport { historyAdmin } from './history';\nimport { reducer } from './modules/reducers';\nimport { previewAdmin } from './preview';\nimport { routes } from './router';\nimport { prefixPluginTranslations } from './utils/translations';\n\n// NOTE: we have to preload it to ensure chunks will have it available as global\nimport 'prismjs';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n const cm = new ContentManagerPlugin();\n\n app.addReducers({\n [PLUGIN_ID]: reducer,\n });\n\n app.addMenuLink({\n to: PLUGIN_ID,\n icon: Feather,\n intlLabel: {\n id: `content-manager.plugin.name`,\n defaultMessage: 'Content Manager',\n },\n permissions: [],\n position: 1,\n });\n\n app.router.addRoute({\n path: 'content-manager/*',\n lazy: async () => {\n const { Layout } = await import('./layout');\n\n return {\n Component: Layout,\n };\n },\n children: routes,\n });\n\n app.registerPlugin(cm.config);\n },\n bootstrap(app: any) {\n if (typeof historyAdmin.bootstrap === 'function') {\n historyAdmin.bootstrap(app);\n }\n if (typeof previewAdmin.bootstrap === 'function') {\n previewAdmin.bootstrap(app);\n }\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, PLUGIN_ID),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n\nexport * from './exports';\n"],"names":["register","app","cm","ContentManagerPlugin","addReducers","PLUGIN_ID","reducer","addMenuLink","to","icon","Feather","intlLabel","id","defaultMessage","permissions","position","router","addRoute","path","lazy","Layout","Component","children","routes","registerPlugin","config","bootstrap","historyAdmin","previewAdmin","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAA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OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAO,CAAA,KAAK,CAAC,CAAA,CAC1CC,IAAI,CAAC,CAAC,EAAEC,OAAAA,EAASC,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,sCAAyBD,IAAMjC,EAAAA,gBAAAA,CAAAA;AACrC8B,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCK,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../admin/src/index.ts"],"sourcesContent":["import { CheckCircle, Feather, Pencil } from '@strapi/icons';\n\nimport { PLUGIN_ID } from './constants/plugin';\nimport { ContentManagerPlugin } from './content-manager';\nimport { historyAdmin } from './history';\nimport { reducer } from './modules/reducers';\nimport { previewAdmin } from './preview';\nimport { routes } from './router';\nimport { prefixPluginTranslations } from './utils/translations';\n\n// NOTE: we have to preload it to ensure chunks will have it available as global\nimport 'prismjs';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n const cm = new ContentManagerPlugin();\n\n app.addReducers({\n [PLUGIN_ID]: reducer,\n });\n\n app.addMenuLink({\n to: PLUGIN_ID,\n icon: Feather,\n intlLabel: {\n id: `content-manager.plugin.name`,\n defaultMessage: 'Content Manager',\n },\n permissions: [],\n position: 1,\n });\n\n app.router.addRoute({\n path: 'content-manager/*',\n lazy: async () => {\n const { Layout } = await import('./layout');\n\n return {\n Component: Layout,\n };\n },\n children: routes,\n });\n\n app.registerPlugin(cm.config);\n\n // Register homepage widgets\n app.widgets.register([\n {\n icon: Pencil,\n title: {\n id: `${PLUGIN_ID}.widget.last-edited.title`,\n defaultMessage: 'Last edited entries',\n },\n component: async () => {\n const { LastEditedWidget } = await import('./components/Widgets');\n return LastEditedWidget;\n },\n pluginId: PLUGIN_ID,\n id: 'last-edited-entries',\n permissions: [{ action: 'plugin::content-manager.explorer.read' }],\n },\n {\n icon: CheckCircle,\n title: {\n id: `${PLUGIN_ID}.widget.last-published.title`,\n defaultMessage: 'Last published entries',\n },\n component: async () => {\n const { LastPublishedWidget } = await import('./components/Widgets');\n return LastPublishedWidget;\n },\n pluginId: PLUGIN_ID,\n id: 'last-published-entries',\n permissions: [{ action: 'plugin::content-manager.explorer.read' }],\n },\n ]);\n },\n bootstrap(app: any) {\n if (typeof historyAdmin.bootstrap === 'function') {\n historyAdmin.bootstrap(app);\n }\n if (typeof previewAdmin.bootstrap === 'function') {\n previewAdmin.bootstrap(app);\n }\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, PLUGIN_ID),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n\nexport * from './exports';\n"],"names":["register","app","cm","ContentManagerPlugin","addReducers","PLUGIN_ID","reducer","addMenuLink","to","icon","Feather","intlLabel","id","defaultMessage","permissions","position","router","addRoute","path","lazy","Layout","Component","children","routes","registerPlugin","config","widgets","Pencil","title","component","LastEditedWidget","pluginId","action","CheckCircle","LastPublishedWidget","bootstrap","historyAdmin","previewAdmin","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACf,QAAA,MAAMC,KAAK,IAAIC,mCAAAA,EAAAA;AAEfF,QAAAA,GAAAA,CA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ACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { Feather } from '@strapi/icons';
1
+ import { Feather, Pencil, CheckCircle } from '@strapi/icons';
2
2
  import { PLUGIN_ID } from './constants/plugin.mjs';
3
3
  import { ContentManagerPlugin } from './content-manager.mjs';
4
4
  import { historyAdmin } from './history/index.mjs';
@@ -14,7 +14,7 @@ export { useDocumentActions as unstable_useDocumentActions } from './hooks/useDo
14
14
  export { useDocumentLayout as unstable_useDocumentLayout } from './hooks/useDocumentLayout.mjs';
15
15
  export { DocumentRBAC, useDocumentRBAC } from './features/DocumentRBAC.mjs';
16
16
 
17
- function __variableDynamicImportRuntime1__(path) {
17
+ function __variableDynamicImportRuntime3__(path) {
18
18
  switch (path) {
19
19
  case './translations/ar.json': return import('./translations/ar.json.mjs');
20
20
  case './translations/ca.json': return import('./translations/ca.json.mjs');
@@ -82,6 +82,45 @@ var index = {
82
82
  children: routes
83
83
  });
84
84
  app.registerPlugin(cm.config);
85
+ // Register homepage widgets
86
+ app.widgets.register([
87
+ {
88
+ icon: Pencil,
89
+ title: {
90
+ id: `${PLUGIN_ID}.widget.last-edited.title`,
91
+ defaultMessage: 'Last edited entries'
92
+ },
93
+ component: async ()=>{
94
+ const { LastEditedWidget } = await import('./components/Widgets.mjs');
95
+ return LastEditedWidget;
96
+ },
97
+ pluginId: PLUGIN_ID,
98
+ id: 'last-edited-entries',
99
+ permissions: [
100
+ {
101
+ action: 'plugin::content-manager.explorer.read'
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ icon: CheckCircle,
107
+ title: {
108
+ id: `${PLUGIN_ID}.widget.last-published.title`,
109
+ defaultMessage: 'Last published entries'
110
+ },
111
+ component: async ()=>{
112
+ const { LastPublishedWidget } = await import('./components/Widgets.mjs');
113
+ return LastPublishedWidget;
114
+ },
115
+ pluginId: PLUGIN_ID,
116
+ id: 'last-published-entries',
117
+ permissions: [
118
+ {
119
+ action: 'plugin::content-manager.explorer.read'
120
+ }
121
+ ]
122
+ }
123
+ ]);
85
124
  },
86
125
  bootstrap (app) {
87
126
  if (typeof historyAdmin.bootstrap === 'function') {
@@ -93,7 +132,7 @@ var index = {
93
132
  },
94
133
  async registerTrads ({ locales }) {
95
134
  const importedTrads = await Promise.all(locales.map((locale)=>{
96
- return __variableDynamicImportRuntime1__(`./translations/${locale}.json`).then(({ default: data })=>{
135
+ return __variableDynamicImportRuntime3__(`./translations/${locale}.json`).then(({ default: data })=>{
97
136
  return {
98
137
  data: prefixPluginTranslations(data, PLUGIN_ID),
99
138
  locale
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import { Feather } from '@strapi/icons';\n\nimport { PLUGIN_ID } from './constants/plugin';\nimport { ContentManagerPlugin } from './content-manager';\nimport { historyAdmin } from './history';\nimport { reducer } from './modules/reducers';\nimport { previewAdmin } from './preview';\nimport { routes } from './router';\nimport { prefixPluginTranslations } from './utils/translations';\n\n// NOTE: we have to preload it to ensure chunks will have it available as global\nimport 'prismjs';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n const cm = new ContentManagerPlugin();\n\n app.addReducers({\n [PLUGIN_ID]: reducer,\n });\n\n app.addMenuLink({\n to: PLUGIN_ID,\n icon: Feather,\n intlLabel: {\n id: `content-manager.plugin.name`,\n defaultMessage: 'Content Manager',\n },\n permissions: [],\n position: 1,\n });\n\n app.router.addRoute({\n path: 'content-manager/*',\n lazy: async () => {\n const { Layout } = await import('./layout');\n\n return {\n Component: Layout,\n };\n },\n children: routes,\n });\n\n app.registerPlugin(cm.config);\n },\n bootstrap(app: any) {\n if (typeof historyAdmin.bootstrap === 'function') {\n historyAdmin.bootstrap(app);\n }\n if (typeof previewAdmin.bootstrap === 'function') {\n previewAdmin.bootstrap(app);\n }\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, PLUGIN_ID),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n\nexport * from './exports';\n"],"names":["register","app","cm","ContentManagerPlugin","addReducers","PLUGIN_ID","reducer","addMenuLink","to","icon","Feather","intlLabel","id","defaultMessage","permissions","position","router","addRoute","path","lazy","Layout","Component","children","routes","registerPlugin","config","bootstrap","historyAdmin","previewAdmin","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACf,QAAA,MAAMC,KAAK,IAAIC,oBAAAA,EAAAA;AAEfF,QAAAA,GAAAA,CAAIG,WAAW,CAAC;AACd,YAAA,CAACC,YAAYC;AACf,SAAA,CAAA;AAEAL,QAAAA,GAAAA,CAAIM,WAAW,CAAC;YACdC,EAAIH,EAAAA,SAAAA;YACJI,IAAMC,EAAAA,OAAAA;YACNC,SAAW,EAAA;gBACTC,EAAI,EAAA,CAAC,2BAA2B,CAAC;gBACjCC,cAAgB,EAAA;AAClB,aAAA;AACAC,YAAAA,WAAAA,EAAa,EAAE;YACfC,QAAU,EAAA;AACZ,SAAA,CAAA;QAEAd,GAAIe,CAAAA,MAAM,CAACC,QAAQ,CAAC;YAClBC,IAAM,EAAA,mBAAA;YACNC,IAAM,EAAA,UAAA;AACJ,gBAAA,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAM,OAAO,cAAA,CAAA;gBAEhC,OAAO;oBACLC,SAAWD,EAAAA;AACb,iBAAA;AACF,aAAA;YACAE,QAAUC,EAAAA;AACZ,SAAA,CAAA;QAEAtB,GAAIuB,CAAAA,cAAc,CAACtB,EAAAA,CAAGuB,MAAM,CAAA;AAC9B,KAAA;AACAC,IAAAA,SAAAA,CAAAA,CAAUzB,GAAQ,EAAA;AAChB,QAAA,IAAI,OAAO0B,YAAAA,CAAaD,SAAS,KAAK,UAAY,EAAA;AAChDC,YAAAA,YAAAA,CAAaD,SAAS,CAACzB,GAAAA,CAAAA;AACzB;AACA,QAAA,IAAI,OAAO2B,YAAAA,CAAaF,SAAS,KAAK,UAAY,EAAA;AAChDE,YAAAA,YAAAA,CAAaF,SAAS,CAACzB,GAAAA,CAAAA;AACzB;AACF,KAAA;IACA,MAAM4B,aAAAA,CAAAA,CAAc,EAAEC,OAAO,EAAyB,EAAA;QACpD,MAAMC,aAAAA,GAAgB,MAAMC,OAAQC,CAAAA,GAAG,CACrCH,OAAQI,CAAAA,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACX,YAAA,OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAO,CAAA,KAAK,CAAC,CAAA,CAC1CC,IAAI,CAAC,CAAC,EAAEC,OAAAA,EAASC,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,yBAAyBD,IAAMjC,EAAAA,SAAAA,CAAAA;AACrC8B,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCK,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../admin/src/index.ts"],"sourcesContent":["import { CheckCircle, Feather, Pencil } from '@strapi/icons';\n\nimport { PLUGIN_ID } from './constants/plugin';\nimport { ContentManagerPlugin } from './content-manager';\nimport { historyAdmin } from './history';\nimport { reducer } from './modules/reducers';\nimport { previewAdmin } from './preview';\nimport { routes } from './router';\nimport { prefixPluginTranslations } from './utils/translations';\n\n// NOTE: we have to preload it to ensure chunks will have it available as global\nimport 'prismjs';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n register(app: any) {\n const cm = new ContentManagerPlugin();\n\n app.addReducers({\n [PLUGIN_ID]: reducer,\n });\n\n app.addMenuLink({\n to: PLUGIN_ID,\n icon: Feather,\n intlLabel: {\n id: `content-manager.plugin.name`,\n defaultMessage: 'Content Manager',\n },\n permissions: [],\n position: 1,\n });\n\n app.router.addRoute({\n path: 'content-manager/*',\n lazy: async () => {\n const { Layout } = await import('./layout');\n\n return {\n Component: Layout,\n };\n },\n children: routes,\n });\n\n app.registerPlugin(cm.config);\n\n // Register homepage widgets\n app.widgets.register([\n {\n icon: Pencil,\n title: {\n id: `${PLUGIN_ID}.widget.last-edited.title`,\n defaultMessage: 'Last edited entries',\n },\n component: async () => {\n const { LastEditedWidget } = await import('./components/Widgets');\n return LastEditedWidget;\n },\n pluginId: PLUGIN_ID,\n id: 'last-edited-entries',\n permissions: [{ action: 'plugin::content-manager.explorer.read' }],\n },\n {\n icon: CheckCircle,\n title: {\n id: `${PLUGIN_ID}.widget.last-published.title`,\n defaultMessage: 'Last published entries',\n },\n component: async () => {\n const { LastPublishedWidget } = await import('./components/Widgets');\n return LastPublishedWidget;\n },\n pluginId: PLUGIN_ID,\n id: 'last-published-entries',\n permissions: [{ action: 'plugin::content-manager.explorer.read' }],\n },\n ]);\n },\n bootstrap(app: any) {\n if (typeof historyAdmin.bootstrap === 'function') {\n historyAdmin.bootstrap(app);\n }\n if (typeof previewAdmin.bootstrap === 'function') {\n previewAdmin.bootstrap(app);\n }\n },\n async registerTrads({ locales }: { locales: string[] }) {\n const importedTrads = await Promise.all(\n locales.map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: prefixPluginTranslations(data, PLUGIN_ID),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return Promise.resolve(importedTrads);\n },\n};\n\nexport * from './exports';\n"],"names":["register","app","cm","ContentManagerPlugin","addReducers","PLUGIN_ID","reducer","addMenuLink","to","icon","Feather","intlLabel","id","defaultMessage","permissions","position","router","addRoute","path","lazy","Layout","Component","children","routes","registerPlugin","config","widgets","Pencil","title","component","LastEditedWidget","pluginId","action","CheckCircle","LastPublishedWidget","bootstrap","historyAdmin","previewAdmin","registerTrads","locales","importedTrads","Promise","all","map","locale","then","default","data","prefixPluginTranslations","catch","resolve"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA,YAAe;AACbA,IAAAA,QAAAA,CAAAA,CAASC,GAAQ,EAAA;AACf,QAAA,MAAMC,KAAK,IAAIC,oBAAAA,EAAAA;AAEfF,QAAAA,GAAAA,CAAIG,WAAW,CAAC;AACd,YAAA,CAACC,YAAYC;AACf,SAAA,CAAA;AAEAL,QAAAA,GAAAA,CAAIM,WAAW,CAAC;YACdC,EAAIH,EAAAA,SAAAA;YACJI,IAAMC,EAAAA,OAAAA;YACNC,SAAW,EAAA;gBACTC,EAAI,EAAA,CAAC,2BAA2B,CAAC;gBACjCC,cAAgB,EAAA;AAClB,aAAA;AACAC,YAAAA,WAAAA,EAAa,EAAE;YACfC,QAAU,EAAA;AACZ,SAAA,CAAA;QAEAd,GAAIe,CAAAA,MAAM,CAACC,QAAQ,CAAC;YAClBC,IAAM,EAAA,mBAAA;YACNC,IAAM,EAAA,UAAA;AACJ,gBAAA,MAAM,EAAEC,MAAM,EAAE,GAAG,MAAM,OAAO,cAAA,CAAA;gBAEhC,OAAO;oBACLC,SAAWD,EAAAA;AACb,iBAAA;AACF,aAAA;YACAE,QAAUC,EAAAA;AACZ,SAAA,CAAA;QAEAtB,GAAIuB,CAAAA,cAAc,CAACtB,EAAAA,CAAGuB,MAAM,CAAA;;QAG5BxB,GAAIyB,CAAAA,OAA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A;IACA,MAAMqC,aAAAA,CAAAA,CAAc,EAAEC,OAAO,EAAyB,EAAA;QACpD,MAAMC,aAAAA,GAAgB,MAAMC,OAAQC,CAAAA,GAAG,CACrCH,OAAQI,CAAAA,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACX,YAAA,OAAO,iCAAM,CAAC,CAAC,eAAe,EAAEA,MAAO,CAAA,KAAK,CAAC,CAAA,CAC1CC,IAAI,CAAC,CAAC,EAAEC,OAAAA,EAASC,IAAI,EAAE,GAAA;gBACtB,OAAO;AACLA,oBAAAA,IAAAA,EAAMC,yBAAyBD,IAAM1C,EAAAA,SAAAA,CAAAA;AACrCuC,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA,CACCK,KAAK,CAAC,IAAA;gBACL,OAAO;AACLF,oBAAAA,IAAAA,EAAM,EAAC;AACPH,oBAAAA;AACF,iBAAA;AACF,aAAA,CAAA;AACJ,SAAA,CAAA,CAAA;QAGF,OAAOH,OAAAA,CAAQS,OAAO,CAACV,aAAAA,CAAAA;AACzB;AACF,CAAE;;;;"}
@@ -76,12 +76,6 @@ function useBlocksEditorContext(consumerName) {
76
76
  * -----------------------------------------------------------------------------------------------*/ const EditorDivider = styledComponents.styled(designSystem.Divider)`
77
77
  background: ${({ theme })=>theme.colors.neutral200};
78
78
  `;
79
- const ExpandIconButton = styledComponents.styled(designSystem.IconButton)`
80
- position: absolute;
81
- bottom: 1.2rem;
82
- right: 1.2rem;
83
- box-shadow: ${({ theme })=>theme.shadows.filterShadow};
84
- `;
85
79
  /**
86
80
  * Forces an update of the Slate editor when the value prop changes from outside of Slate.
87
81
  * The root cause is that Slate is not a controlled component: https://github.com/ianstormtaylor/slate/issues/4612
@@ -120,10 +114,7 @@ const BlocksEditor = /*#__PURE__*/ React__namespace.forwardRef(({ disabled = fal
120
114
  const [editor] = React__namespace.useState(()=>pipe(slateHistory.withHistory, withImages.withImages, withStrapiSchema.withStrapiSchema, slateReact.withReact, withLinks.withLinks)(slate.createEditor()));
121
115
  const [liveText, setLiveText] = React__namespace.useState('');
122
116
  const ariaDescriptionId = React__namespace.useId();
123
- const [isExpandedMode, setIsExpandedMode] = React__namespace.useState(false);
124
- const handleToggleExpand = ()=>{
125
- setIsExpandedMode((prev)=>!prev);
126
- };
117
+ const [isExpandedMode, handleToggleExpand] = React__namespace.useReducer((prev)=>!prev, false);
127
118
  /**
128
119
  * Editable is not able to hold the ref, https://github.com/ianstormtaylor/slate/issues/4082
129
120
  * so with "useImperativeHandle" we can use ReactEditor methods to expose to the parent above
@@ -189,7 +180,7 @@ const BlocksEditor = /*#__PURE__*/ React__namespace.forwardRef(({ disabled = fal
189
180
  children: /*#__PURE__*/ jsxRuntime.jsxs(EditorLayout.EditorLayout, {
190
181
  error: error,
191
182
  disabled: disabled,
192
- onCollapse: handleToggleExpand,
183
+ onToggleExpand: handleToggleExpand,
193
184
  ariaDescriptionId: ariaDescriptionId,
194
185
  children: [
195
186
  /*#__PURE__*/ jsxRuntime.jsx(BlocksToolbar.BlocksToolbar, {}),
@@ -199,7 +190,11 @@ const BlocksEditor = /*#__PURE__*/ React__namespace.forwardRef(({ disabled = fal
199
190
  /*#__PURE__*/ jsxRuntime.jsx(BlocksContent.BlocksContent, {
200
191
  ...contentProps
201
192
  }),
202
- !isExpandedMode && /*#__PURE__*/ jsxRuntime.jsx(ExpandIconButton, {
193
+ !isExpandedMode && /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
194
+ position: "absolute",
195
+ bottom: "1.2rem",
196
+ right: "1.2rem",
197
+ shadow: "filterShadow",
203
198
  label: formatMessage({
204
199
  id: translations.getTranslation('components.Blocks.expand'),
205
200
  defaultMessage: 'Expand'