@strapi/content-manager 5.31.1 → 5.31.3
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/dist/admin/components/ConfigurationForm/EditFieldForm.js +1 -0
- package/dist/admin/components/ConfigurationForm/EditFieldForm.js.map +1 -1
- package/dist/admin/components/ConfigurationForm/EditFieldForm.mjs +1 -0
- package/dist/admin/components/ConfigurationForm/EditFieldForm.mjs.map +1 -1
- package/dist/admin/components/ConfigurationForm/Fields.js +2 -0
- package/dist/admin/components/ConfigurationForm/Fields.js.map +1 -1
- package/dist/admin/components/ConfigurationForm/Fields.mjs +2 -0
- package/dist/admin/components/ConfigurationForm/Fields.mjs.map +1 -1
- package/dist/admin/components/ConfigurationForm/Form.js +1 -1
- package/dist/admin/components/ConfigurationForm/Form.js.map +1 -1
- package/dist/admin/components/ConfigurationForm/Form.mjs +1 -1
- package/dist/admin/components/ConfigurationForm/Form.mjs.map +1 -1
- package/dist/admin/history/components/VersionContent.js +0 -3
- package/dist/admin/history/components/VersionContent.js.map +1 -1
- package/dist/admin/history/components/VersionContent.mjs +0 -3
- package/dist/admin/history/components/VersionContent.mjs.map +1 -1
- package/dist/admin/pages/EditView/EditViewPage.js +2 -2
- package/dist/admin/pages/EditView/EditViewPage.js.map +1 -1
- package/dist/admin/pages/EditView/EditViewPage.mjs +2 -2
- package/dist/admin/pages/EditView/EditViewPage.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.js +52 -64
- package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.mjs +54 -66
- package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js +4 -4
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs +4 -4
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js +1 -0
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs +1 -0
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/AddComponentButton.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/AddComponentButton.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js +0 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs +0 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/InputRenderer.js +3 -1
- package/dist/admin/pages/EditView/components/InputRenderer.js.map +1 -1
- package/dist/admin/pages/EditView/components/InputRenderer.mjs +3 -1
- package/dist/admin/pages/EditView/components/InputRenderer.mjs.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/DraggableCard.js +1 -0
- package/dist/admin/pages/ListConfiguration/components/DraggableCard.js.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/DraggableCard.mjs +1 -0
- package/dist/admin/pages/ListConfiguration/components/DraggableCard.mjs.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/EditFieldForm.js +1 -1
- package/dist/admin/pages/ListConfiguration/components/EditFieldForm.js.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/EditFieldForm.mjs +1 -1
- package/dist/admin/pages/ListConfiguration/components/EditFieldForm.mjs.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/Settings.js +1 -1
- package/dist/admin/pages/ListConfiguration/components/Settings.js.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/Settings.mjs +1 -1
- package/dist/admin/pages/ListConfiguration/components/Settings.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/Media.js +4 -2
- package/dist/admin/pages/ListView/components/TableCells/Media.js.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/Media.mjs +4 -2
- package/dist/admin/pages/ListView/components/TableCells/Media.mjs.map +1 -1
- package/dist/admin/preview/components/PreviewHeader.js +0 -1
- package/dist/admin/preview/components/PreviewHeader.js.map +1 -1
- package/dist/admin/preview/components/PreviewHeader.mjs +0 -1
- package/dist/admin/preview/components/PreviewHeader.mjs.map +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +2 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +1 -1
- package/dist/admin/translations/en.json.js +1 -0
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +1 -0
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/admin/translations/es.json.js +1 -0
- package/dist/admin/translations/es.json.js.map +1 -1
- package/dist/admin/translations/es.json.mjs +1 -0
- package/dist/admin/translations/es.json.mjs.map +1 -1
- package/dist/admin/translations/fr.json.js +1 -0
- package/dist/admin/translations/fr.json.js.map +1 -1
- package/dist/admin/translations/fr.json.mjs +1 -0
- package/dist/admin/translations/fr.json.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { tours, useNotification, useAPIErrorHandler, useQueryParams, useForm, useGuidedTour, GUIDED_TOUR_REQUIRED_ACTIONS } from '@strapi/admin/strapi-admin';
|
|
4
|
-
import { Flex, Button, Menu, VisuallyHidden, Dialog, Modal, Typography, Radio } from '@strapi/design-system';
|
|
4
|
+
import { Flex, Button, Menu, VisuallyHidden, Dialog, Modal, Typography, Radio, Tooltip } from '@strapi/design-system';
|
|
5
5
|
import { More, Cross, WarningCircle } from '@strapi/icons';
|
|
6
6
|
import mapValues from 'lodash/fp/mapValues';
|
|
7
7
|
import get from 'lodash/get';
|
|
@@ -18,7 +18,7 @@ import { useDocumentContext } from '../../../hooks/useDocumentContext.mjs';
|
|
|
18
18
|
import { usePreviewContext } from '../../../preview/pages/Preview.mjs';
|
|
19
19
|
import { LIST_PATH, CLONE_PATH } from '../../../router.mjs';
|
|
20
20
|
import { useGetDraftRelationCountQuery as useLazyGetDraftRelationCountQuery, useUpdateDocumentMutation } from '../../../services/documents.mjs';
|
|
21
|
-
import {
|
|
21
|
+
import { buildValidParams, isBaseQueryError } from '../../../utils/api.mjs';
|
|
22
22
|
import { getTranslation } from '../../../utils/translations.mjs';
|
|
23
23
|
import { handleInvisibleAttributes } from '../utils/data.mjs';
|
|
24
24
|
import { useRelationModal } from './FormInputs/Relations/RelationModal.mjs';
|
|
@@ -69,6 +69,20 @@ const DocumentActions = ({ actions })=>{
|
|
|
69
69
|
if (!primaryAction) {
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
|
+
const addHintTooltip = (action, children)=>{
|
|
73
|
+
return !action.disabled ? /*#__PURE__*/ jsx(Tooltip, {
|
|
74
|
+
label: formatMessage({
|
|
75
|
+
id: 'content-manager.containers.EditView.saveHint',
|
|
76
|
+
defaultMessage: 'Ctrl / Cmd + Enter to {action}'
|
|
77
|
+
}, {
|
|
78
|
+
action: action.label
|
|
79
|
+
}),
|
|
80
|
+
children: /*#__PURE__*/ jsx(Flex, {
|
|
81
|
+
width: "100%",
|
|
82
|
+
children: children
|
|
83
|
+
})
|
|
84
|
+
}) : children;
|
|
85
|
+
};
|
|
72
86
|
return /*#__PURE__*/ jsxs(Flex, {
|
|
73
87
|
direction: "column",
|
|
74
88
|
gap: 2,
|
|
@@ -79,13 +93,14 @@ const DocumentActions = ({ actions })=>{
|
|
|
79
93
|
children: /*#__PURE__*/ jsxs(Flex, {
|
|
80
94
|
gap: 2,
|
|
81
95
|
children: [
|
|
82
|
-
primaryAction.label === 'Publish' ? /*#__PURE__*/ jsx(DocumentActionButton, {
|
|
96
|
+
primaryAction.label === 'Publish' ? addHintTooltip(primaryAction, /*#__PURE__*/ jsx(DocumentActionButton, {
|
|
83
97
|
...primaryAction,
|
|
84
98
|
variant: primaryAction.variant || 'default'
|
|
85
|
-
}) : /*#__PURE__*/ jsx(DocumentActionButton, {
|
|
99
|
+
})) : addHintTooltip(primaryAction, /*#__PURE__*/ jsx(DocumentActionButton, {
|
|
86
100
|
...primaryAction,
|
|
87
|
-
variant: primaryAction.variant || 'default'
|
|
88
|
-
|
|
101
|
+
variant: primaryAction.variant || 'default',
|
|
102
|
+
buttonType: "submit"
|
|
103
|
+
})),
|
|
89
104
|
restActions.length > 0 ? /*#__PURE__*/ jsx(DocumentActionsMenu, {
|
|
90
105
|
actions: restActions,
|
|
91
106
|
label: formatMessage({
|
|
@@ -103,12 +118,13 @@ const DocumentActions = ({ actions })=>{
|
|
|
103
118
|
})
|
|
104
119
|
}) : /*#__PURE__*/ jsx(DocumentActionButton, {
|
|
105
120
|
...secondaryAction,
|
|
106
|
-
variant: secondaryAction.variant || 'secondary'
|
|
121
|
+
variant: secondaryAction.variant || 'secondary',
|
|
122
|
+
buttonType: "submit"
|
|
107
123
|
}) : null
|
|
108
124
|
]
|
|
109
125
|
});
|
|
110
126
|
};
|
|
111
|
-
const DocumentActionButton = (action)=>{
|
|
127
|
+
const DocumentActionButton = ({ buttonType = 'button', ...action })=>{
|
|
112
128
|
const [dialogId, setDialogId] = React.useState(null);
|
|
113
129
|
const { toggleNotification } = useNotification();
|
|
114
130
|
const handleClick = (action)=>async (e)=>{
|
|
@@ -147,6 +163,7 @@ const DocumentActionButton = (action)=>{
|
|
|
147
163
|
paddingTop: "7px",
|
|
148
164
|
paddingBottom: "7px",
|
|
149
165
|
loading: action.loading,
|
|
166
|
+
type: buttonType,
|
|
150
167
|
children: action.label
|
|
151
168
|
}),
|
|
152
169
|
action.dialog?.type === 'dialog' ? /*#__PURE__*/ jsx(DocumentActionConfirmDialog, {
|
|
@@ -494,9 +511,7 @@ const transformData = (data)=>{
|
|
|
494
511
|
});
|
|
495
512
|
const { getInitialFormValues } = useDoc();
|
|
496
513
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc)=>doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== 'modified';
|
|
497
|
-
|
|
498
|
-
return null;
|
|
499
|
-
}
|
|
514
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
500
515
|
const performPublish = async ()=>{
|
|
501
516
|
setSubmitting(true);
|
|
502
517
|
try {
|
|
@@ -504,7 +519,7 @@ const transformData = (data)=>{
|
|
|
504
519
|
status: 'published'
|
|
505
520
|
});
|
|
506
521
|
if (errors) {
|
|
507
|
-
const hasUnreadableRequiredField = Object.keys(schema.attributes).some((fieldName)=>{
|
|
522
|
+
const hasUnreadableRequiredField = schema && Object.keys(schema.attributes).some((fieldName)=>{
|
|
508
523
|
const attribute = schema.attributes[fieldName];
|
|
509
524
|
// For components, check if any of the component fields are readable
|
|
510
525
|
if (attribute.type === 'component') {
|
|
@@ -626,6 +641,31 @@ const transformData = (data)=>{
|
|
|
626
641
|
// see RFC "Count draft relations" in Notion
|
|
627
642
|
const enableDraftRelationsCount = false;
|
|
628
643
|
const hasDraftRelations = enableDraftRelationsCount;
|
|
644
|
+
// Auto-publish on CMD+Enter on macOS, and CTRL+Enter on Windows/Linux
|
|
645
|
+
React.useEffect(()=>{
|
|
646
|
+
if (!schema?.options?.draftAndPublish) {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
const handleKeyDown = (e)=>{
|
|
650
|
+
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
|
651
|
+
e.preventDefault();
|
|
652
|
+
{
|
|
653
|
+
performPublish();
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
658
|
+
return ()=>{
|
|
659
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
660
|
+
};
|
|
661
|
+
}, [
|
|
662
|
+
hasDraftRelations,
|
|
663
|
+
performPublish,
|
|
664
|
+
schema?.options?.draftAndPublish
|
|
665
|
+
]);
|
|
666
|
+
if (!schema?.options?.draftAndPublish) {
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
629
669
|
return {
|
|
630
670
|
loading: isLoading,
|
|
631
671
|
position: [
|
|
@@ -718,7 +758,7 @@ const UpdateAction = ({ activeTab, documentId, model, collectionType })=>{
|
|
|
718
758
|
skip: !parentDocumentMetaToUpdate
|
|
719
759
|
});
|
|
720
760
|
const { schema } = useDoc();
|
|
721
|
-
const handleUpdate =
|
|
761
|
+
const handleUpdate = async ()=>{
|
|
722
762
|
setSubmitting(true);
|
|
723
763
|
try {
|
|
724
764
|
if (!modified) {
|
|
@@ -855,59 +895,7 @@ const UpdateAction = ({ activeTab, documentId, model, collectionType })=>{
|
|
|
855
895
|
onPreview();
|
|
856
896
|
}
|
|
857
897
|
}
|
|
858
|
-
}
|
|
859
|
-
setSubmitting,
|
|
860
|
-
modified,
|
|
861
|
-
validate,
|
|
862
|
-
isCloning,
|
|
863
|
-
documentId,
|
|
864
|
-
collectionType,
|
|
865
|
-
toggleNotification,
|
|
866
|
-
formatMessage,
|
|
867
|
-
clone,
|
|
868
|
-
model,
|
|
869
|
-
cloneMatch?.params.origin,
|
|
870
|
-
currentDocumentMeta.params,
|
|
871
|
-
document,
|
|
872
|
-
navigate,
|
|
873
|
-
rawQuery,
|
|
874
|
-
setErrors,
|
|
875
|
-
formatValidationErrors,
|
|
876
|
-
update,
|
|
877
|
-
resetForm,
|
|
878
|
-
create,
|
|
879
|
-
fromRelationModal,
|
|
880
|
-
fieldToConnect,
|
|
881
|
-
documentHistory,
|
|
882
|
-
parentDocumentMetaToUpdate,
|
|
883
|
-
dispatch,
|
|
884
|
-
getInitialFormValues,
|
|
885
|
-
parentDocumentData,
|
|
886
|
-
fieldToConnectUID,
|
|
887
|
-
updateDocumentMutation,
|
|
888
|
-
formatAPIError,
|
|
889
|
-
onPreview,
|
|
890
|
-
initialValues,
|
|
891
|
-
schema,
|
|
892
|
-
components,
|
|
893
|
-
relationalModalSchema,
|
|
894
|
-
dispatchGuidedTour
|
|
895
|
-
]);
|
|
896
|
-
// Auto-save on CMD+S or CMD+Enter on macOS, and CTRL+S or CTRL+Enter on Windows/Linux
|
|
897
|
-
React.useEffect(()=>{
|
|
898
|
-
const handleKeyDown = (e)=>{
|
|
899
|
-
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
|
|
900
|
-
e.preventDefault();
|
|
901
|
-
handleUpdate();
|
|
902
|
-
}
|
|
903
|
-
};
|
|
904
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
905
|
-
return ()=>{
|
|
906
|
-
window.removeEventListener('keydown', handleKeyDown);
|
|
907
|
-
};
|
|
908
|
-
}, [
|
|
909
|
-
handleUpdate
|
|
910
|
-
]);
|
|
898
|
+
};
|
|
911
899
|
return {
|
|
912
900
|
loading: isLoading,
|
|
913
901
|
/**
|