decap-cms-core 3.4.2 → 3.5.0
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/decap-cms-core.js +5 -5
- package/dist/decap-cms-core.js.map +1 -1
- package/dist/esm/actions/editorControl.js +14 -0
- package/dist/esm/actions/entries.js +5 -2
- package/dist/esm/bootstrap.js +2 -2
- package/dist/esm/components/Editor/EditorControlPane/EditorControl.js +26 -12
- package/dist/esm/components/Editor/EditorToolbar.js +38 -34
- package/dist/esm/components/UI/ErrorBoundary.js +2 -2
- package/dist/esm/reducers/editorComponent.js +1 -0
- package/dist/esm/reducers/editorControl.js +17 -0
- package/dist/esm/reducers/entryDraft.js +4 -1
- package/package.json +2 -2
- package/src/actions/entries.ts +5 -2
- package/src/components/Editor/EditorControlPane/EditorControl.js +38 -26
- package/src/components/Editor/EditorToolbar.js +13 -4
- package/src/reducers/entryDraft.js +2 -1
|
@@ -54,8 +54,8 @@ function buildIssueTemplate({
|
|
|
54
54
|
let version = '';
|
|
55
55
|
if (typeof DECAP_CMS_VERSION === 'string') {
|
|
56
56
|
version = `decap-cms@${DECAP_CMS_VERSION}`;
|
|
57
|
-
} else if (typeof "3.
|
|
58
|
-
version = `decap-cms-app@${"3.
|
|
57
|
+
} else if (typeof "3.4.0" === 'string') {
|
|
58
|
+
version = `decap-cms-app@${"3.4.0"}`;
|
|
59
59
|
}
|
|
60
60
|
const template = getIssueTemplate({
|
|
61
61
|
version,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _editorControl = require("../actions/editorControl");
|
|
8
|
+
const initialState = null;
|
|
9
|
+
function editorControl(state = initialState, action) {
|
|
10
|
+
switch (action.type) {
|
|
11
|
+
case _editorControl.SET_EDITOR_CONTROL:
|
|
12
|
+
return action.payload;
|
|
13
|
+
default:
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
var _default = exports.default = editorControl;
|
|
@@ -113,7 +113,10 @@ function entryDraftReducer(state = (0, _immutable.Map)(), action) {
|
|
|
113
113
|
}
|
|
114
114
|
case _entries.DRAFT_CLEAR_ERRORS:
|
|
115
115
|
{
|
|
116
|
-
|
|
116
|
+
const {
|
|
117
|
+
uniqueFieldId
|
|
118
|
+
} = action.payload;
|
|
119
|
+
return state.deleteIn(['fieldsErrors', uniqueFieldId]);
|
|
117
120
|
}
|
|
118
121
|
case _entries.ENTRY_PERSIST_REQUEST:
|
|
119
122
|
case _editorialWorkflow.UNPUBLISHED_ENTRY_PERSIST_REQUEST:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decap-cms-core",
|
|
3
3
|
"description": "Decap CMS core application, see decap-cms package for the main distribution.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.0",
|
|
5
5
|
"repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-core",
|
|
6
6
|
"bugs": "https://github.com/decaporg/decap-cms/issues",
|
|
7
7
|
"module": "dist/esm/index.js",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"@types/url-join": "^4.0.0",
|
|
97
97
|
"redux-mock-store": "^1.5.3"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "022dbe523d07bb8bc74970460cc82b259fde4041"
|
|
100
100
|
}
|
package/src/actions/entries.ts
CHANGED
|
@@ -431,8 +431,11 @@ export function changeDraftFieldValidation(
|
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
-
export function clearFieldErrors() {
|
|
435
|
-
return {
|
|
434
|
+
export function clearFieldErrors(uniqueFieldId: string) {
|
|
435
|
+
return {
|
|
436
|
+
type: DRAFT_CLEAR_ERRORS,
|
|
437
|
+
payload: { uniqueFieldId },
|
|
438
|
+
};
|
|
436
439
|
}
|
|
437
440
|
|
|
438
441
|
export function localBackupRetrieved(entry: EntryValue) {
|
|
@@ -62,7 +62,6 @@ const styleStrings = {
|
|
|
62
62
|
disabled: `
|
|
63
63
|
pointer-events: none;
|
|
64
64
|
opacity: 0.5;
|
|
65
|
-
background: #ccc;
|
|
66
65
|
`,
|
|
67
66
|
hidden: `
|
|
68
67
|
visibility: hidden;
|
|
@@ -77,18 +76,26 @@ const ControlContainer = styled.div`
|
|
|
77
76
|
}
|
|
78
77
|
`;
|
|
79
78
|
|
|
79
|
+
const ControlTopbar = styled.div`
|
|
80
|
+
display: flex;
|
|
81
|
+
justify-content: space-between;
|
|
82
|
+
gap: 20px;
|
|
83
|
+
align-items: end;
|
|
84
|
+
`;
|
|
80
85
|
const ControlErrorsList = styled.ul`
|
|
81
86
|
list-style-type: none;
|
|
82
87
|
font-size: 12px;
|
|
83
88
|
color: ${colors.errorText};
|
|
84
|
-
margin-bottom: 8px;
|
|
85
89
|
text-align: right;
|
|
90
|
+
text-transform: uppercase;
|
|
86
91
|
font-weight: 600;
|
|
92
|
+
margin: 0;
|
|
93
|
+
padding: 2px 0 3px;
|
|
87
94
|
`;
|
|
88
95
|
|
|
89
96
|
export const ControlHint = styled.p`
|
|
90
97
|
margin-bottom: 0;
|
|
91
|
-
padding:
|
|
98
|
+
padding: 6px 0 0;
|
|
92
99
|
font-size: 12px;
|
|
93
100
|
color: ${props =>
|
|
94
101
|
props.error ? colors.errorText : props.active ? colors.active : colors.controlLabel};
|
|
@@ -238,28 +245,30 @@ class EditorControl extends React.Component {
|
|
|
238
245
|
${isHidden && styleStrings.hidden};
|
|
239
246
|
`}
|
|
240
247
|
>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
<
|
|
244
|
-
{
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
248
|
+
<ControlTopbar>
|
|
249
|
+
{widget.globalStyles && <Global styles={coreCss`${widget.globalStyles}`} />}
|
|
250
|
+
<LabelComponent
|
|
251
|
+
field={field}
|
|
252
|
+
isActive={isSelected || this.state.styleActive}
|
|
253
|
+
hasErrors={hasErrors}
|
|
254
|
+
uniqueFieldId={this.uniqueFieldId}
|
|
255
|
+
isFieldOptional={isFieldOptional}
|
|
256
|
+
t={t}
|
|
257
|
+
/>
|
|
258
|
+
{errors && (
|
|
259
|
+
<ControlErrorsList>
|
|
260
|
+
{errors.map(
|
|
261
|
+
error =>
|
|
262
|
+
error.message &&
|
|
263
|
+
typeof error.message === 'string' && (
|
|
264
|
+
<li key={error.message.trim().replace(/[^a-z0-9]+/gi, '-')}>
|
|
265
|
+
{error.message}
|
|
266
|
+
</li>
|
|
267
|
+
),
|
|
268
|
+
)}
|
|
269
|
+
</ControlErrorsList>
|
|
270
|
+
)}
|
|
271
|
+
</ControlTopbar>
|
|
263
272
|
<Widget
|
|
264
273
|
classNameWrapper={cx(
|
|
265
274
|
css`
|
|
@@ -302,7 +311,10 @@ class EditorControl extends React.Component {
|
|
|
302
311
|
value={value}
|
|
303
312
|
mediaPaths={mediaPaths}
|
|
304
313
|
metadata={metadata}
|
|
305
|
-
onChange={(newValue, newMetadata) =>
|
|
314
|
+
onChange={(newValue, newMetadata) => {
|
|
315
|
+
onChange(field, newValue, newMetadata);
|
|
316
|
+
clearFieldErrors(this.uniqueFieldId); // Видаляємо помилки лише для цього поля
|
|
317
|
+
}}
|
|
306
318
|
onValidate={onValidate && partial(onValidate, this.uniqueFieldId)}
|
|
307
319
|
onOpenMediaLibrary={openMediaLibrary}
|
|
308
320
|
onClearMediaControl={clearMediaControl}
|
|
@@ -594,11 +594,20 @@ export class EditorToolbar extends React.Component {
|
|
|
594
594
|
</SaveButton>,
|
|
595
595
|
currentStatus
|
|
596
596
|
? [
|
|
597
|
-
|
|
598
|
-
|
|
597
|
+
<React.Fragment key="workflow-status-controls">
|
|
598
|
+
{this.renderWorkflowStatusControls()}
|
|
599
|
+
{!hasChanged && this.renderNewEntryWorkflowPublishControls({ canCreate, canPublish })}
|
|
600
|
+
</React.Fragment>,
|
|
599
601
|
]
|
|
600
|
-
: !isNewEntry &&
|
|
601
|
-
|
|
602
|
+
: !isNewEntry && (
|
|
603
|
+
<React.Fragment key="existing-entry-workflow-publish-controls">
|
|
604
|
+
{this.renderExistingEntryWorkflowPublishControls({
|
|
605
|
+
canCreate,
|
|
606
|
+
canPublish,
|
|
607
|
+
canDelete,
|
|
608
|
+
})}
|
|
609
|
+
</React.Fragment>
|
|
610
|
+
),
|
|
602
611
|
(!showDelete || useOpenAuthoring) && !hasUnpublishedChanges && !isModification ? null : (
|
|
603
612
|
<DeleteButton
|
|
604
613
|
key="delete-button"
|
|
@@ -129,7 +129,8 @@ function entryDraftReducer(state = Map(), action) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
case DRAFT_CLEAR_ERRORS: {
|
|
132
|
-
|
|
132
|
+
const { uniqueFieldId } = action.payload;
|
|
133
|
+
return state.deleteIn(['fieldsErrors', uniqueFieldId]);
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
case ENTRY_PERSIST_REQUEST:
|