decap-cms-core 3.8.0 → 3.9.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 +18 -18
- package/dist/decap-cms-core.js.map +1 -1
- package/dist/esm/bootstrap.js +2 -2
- package/dist/esm/components/Collection/Entries/EntriesSearch.js +13 -5
- package/dist/esm/components/Editor/EditorNotesPane/AddNoteForm.js +108 -0
- package/dist/esm/components/Editor/EditorNotesPane/EditorNotesPane.js +138 -0
- package/dist/esm/components/Editor/EditorNotesPane/NoteItem.js +247 -0
- package/dist/esm/components/Editor/EditorNotesPane/NotesList.js +54 -0
- package/dist/esm/components/UI/ErrorBoundary.js +2 -2
- package/dist/esm/reducers/entries.js +1 -2
- package/index.d.ts +2 -0
- package/package.json +2 -2
- package/src/components/Collection/Entries/EntriesSearch.js +11 -3
- package/src/reducers/__tests__/entries.spec.js +3 -3
- package/src/reducers/entries.ts +1 -3
- package/src/types/redux.ts +2 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _styled from "@emotion/styled/base";
|
|
2
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
6
|
+
import NoteItem from './NoteItem';
|
|
7
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
8
|
+
const ListContainer = /*#__PURE__*/_styled("div", {
|
|
9
|
+
target: "etcnkr60",
|
|
10
|
+
label: "ListContainer"
|
|
11
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
12
|
+
name: "1cs7bse",
|
|
13
|
+
styles: "flex:1;overflow-y:auto;padding:8px"
|
|
14
|
+
} : {
|
|
15
|
+
name: "1cs7bse",
|
|
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sXG59O1xuXG5leHBvcnQgZGVmYXVsdCBOb3Rlc0xpc3Q7XG4iXX0= */",
|
|
17
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
18
|
+
});
|
|
19
|
+
function NotesList({
|
|
20
|
+
notes,
|
|
21
|
+
onUpdate,
|
|
22
|
+
onDelete,
|
|
23
|
+
onToggleResolution,
|
|
24
|
+
user,
|
|
25
|
+
t
|
|
26
|
+
}) {
|
|
27
|
+
// Sort notes: unresolved first, then by newest
|
|
28
|
+
const sortedNotes = notes.sort((a, b) => {
|
|
29
|
+
// First sort by resolved status (unresolved first)
|
|
30
|
+
if (a.get('resolved') !== b.get('resolved')) {
|
|
31
|
+
return a.get('resolved') ? 1 : -1;
|
|
32
|
+
}
|
|
33
|
+
// Then sort by timestamp (newest first)
|
|
34
|
+
return new Date(b.get('timestamp')) - new Date(a.get('timestamp'));
|
|
35
|
+
});
|
|
36
|
+
return ___EmotionJSX(ListContainer, null, sortedNotes.map(note => ___EmotionJSX(NoteItem, {
|
|
37
|
+
key: note.get('id'),
|
|
38
|
+
note: note,
|
|
39
|
+
onUpdate: onUpdate,
|
|
40
|
+
onDelete: onDelete,
|
|
41
|
+
onToggleResolution: onToggleResolution,
|
|
42
|
+
user: user,
|
|
43
|
+
t: t
|
|
44
|
+
})));
|
|
45
|
+
}
|
|
46
|
+
NotesList.propTypes = {
|
|
47
|
+
notes: ImmutablePropTypes.list.isRequired,
|
|
48
|
+
onUpdate: PropTypes.func.isRequired,
|
|
49
|
+
onDelete: PropTypes.func.isRequired,
|
|
50
|
+
onToggleResolution: PropTypes.func.isRequired,
|
|
51
|
+
user: PropTypes.object,
|
|
52
|
+
t: PropTypes.func.isRequired
|
|
53
|
+
};
|
|
54
|
+
export default NotesList;
|
|
@@ -44,8 +44,8 @@ function buildIssueTemplate({
|
|
|
44
44
|
let version = '';
|
|
45
45
|
if (typeof DECAP_CMS_VERSION === 'string') {
|
|
46
46
|
version = `decap-cms@${DECAP_CMS_VERSION}`;
|
|
47
|
-
} else if (typeof "3.8.
|
|
48
|
-
version = `decap-cms-app@${"3.8.
|
|
47
|
+
} else if (typeof "3.8.4" === 'string') {
|
|
48
|
+
version = `decap-cms-app@${"3.8.4"}`;
|
|
49
49
|
}
|
|
50
50
|
const template = getIssueTemplate({
|
|
51
51
|
version,
|
|
@@ -429,7 +429,6 @@ export function selectEntriesLoaded(state, collection) {
|
|
|
429
429
|
export function selectIsFetching(state, collection) {
|
|
430
430
|
return state.getIn(['pages', collection, 'isFetching'], false);
|
|
431
431
|
}
|
|
432
|
-
const DRAFT_MEDIA_FILES = 'DRAFT_MEDIA_FILES';
|
|
433
432
|
function getFileField(collectionFiles, slug) {
|
|
434
433
|
const file = collectionFiles.find(f => f?.get('name') === slug);
|
|
435
434
|
return file;
|
|
@@ -528,7 +527,7 @@ export function selectMediaFolder(config, collection, entryMap, field) {
|
|
|
528
527
|
mediaFolder = join(folder);
|
|
529
528
|
} else {
|
|
530
529
|
const entryPath = entryMap?.get('path');
|
|
531
|
-
mediaFolder = entryPath ? join(dirname(entryPath), folder) :
|
|
530
|
+
mediaFolder = entryPath ? join(dirname(entryPath), folder) : collection.get('folder');
|
|
532
531
|
}
|
|
533
532
|
}
|
|
534
533
|
return trim(mediaFolder, '/');
|
package/index.d.ts
CHANGED
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.9.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",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"browser": {
|
|
101
101
|
"path": "path-browserify"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "13afe6686b32f7c03b4819d343d787c63f13664f"
|
|
104
104
|
}
|
|
@@ -5,7 +5,7 @@ import { connect } from 'react-redux';
|
|
|
5
5
|
import isEqual from 'lodash/isEqual';
|
|
6
6
|
import { Cursor } from 'decap-cms-lib-util';
|
|
7
7
|
|
|
8
|
-
import { selectSearchedEntries } from '../../../reducers';
|
|
8
|
+
import { selectSearchedEntries, selectUnpublishedEntry } from '../../../reducers';
|
|
9
9
|
import {
|
|
10
10
|
searchEntries as actionSearchEntries,
|
|
11
11
|
clearSearch as actionClearSearch,
|
|
@@ -22,6 +22,7 @@ class EntriesSearch extends React.Component {
|
|
|
22
22
|
collectionNames: PropTypes.array,
|
|
23
23
|
entries: ImmutablePropTypes.list,
|
|
24
24
|
page: PropTypes.number,
|
|
25
|
+
getWorkflowStatus: PropTypes.func,
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
componentDidMount() {
|
|
@@ -63,7 +64,7 @@ class EntriesSearch extends React.Component {
|
|
|
63
64
|
};
|
|
64
65
|
|
|
65
66
|
render() {
|
|
66
|
-
const { collections, entries, isFetching } = this.props;
|
|
67
|
+
const { collections, entries, isFetching, getWorkflowStatus } = this.props;
|
|
67
68
|
return (
|
|
68
69
|
<Entries
|
|
69
70
|
cursor={this.getCursor()}
|
|
@@ -71,6 +72,7 @@ class EntriesSearch extends React.Component {
|
|
|
71
72
|
collections={collections}
|
|
72
73
|
entries={entries}
|
|
73
74
|
isFetching={isFetching}
|
|
75
|
+
getWorkflowStatus={getWorkflowStatus}
|
|
74
76
|
/>
|
|
75
77
|
);
|
|
76
78
|
}
|
|
@@ -83,7 +85,13 @@ function mapStateToProps(state, ownProps) {
|
|
|
83
85
|
const isFetching = state.search.isFetching;
|
|
84
86
|
const page = state.search.page;
|
|
85
87
|
const entries = selectSearchedEntries(state, collectionNames);
|
|
86
|
-
|
|
88
|
+
|
|
89
|
+
function getWorkflowStatus(collectionName, slug) {
|
|
90
|
+
const unpublishedEntry = selectUnpublishedEntry(state, collectionName, slug);
|
|
91
|
+
return unpublishedEntry ? unpublishedEntry.get('status') : null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return { isFetching, page, collections, collectionNames, entries, searchTerm, getWorkflowStatus };
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
const mapDispatchToProps = {
|
|
@@ -85,7 +85,7 @@ describe('entries', () => {
|
|
|
85
85
|
).toEqual('static/media');
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
it('should return
|
|
88
|
+
it('should return collection folder when collection specifies media_folder and entry is undefined', () => {
|
|
89
89
|
expect(
|
|
90
90
|
selectMediaFolder(
|
|
91
91
|
{ media_folder: 'static/media' },
|
|
@@ -93,7 +93,7 @@ describe('entries', () => {
|
|
|
93
93
|
undefined,
|
|
94
94
|
undefined,
|
|
95
95
|
),
|
|
96
|
-
).toEqual('posts
|
|
96
|
+
).toEqual('posts');
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
it('should return relative media folder when collection specifies media_folder and entry path is not null', () => {
|
|
@@ -364,7 +364,7 @@ describe('entries', () => {
|
|
|
364
364
|
'image.png',
|
|
365
365
|
undefined,
|
|
366
366
|
),
|
|
367
|
-
).toBe('posts/
|
|
367
|
+
).toBe('posts/image.png');
|
|
368
368
|
});
|
|
369
369
|
|
|
370
370
|
it('should handle relative media_folder', () => {
|
package/src/reducers/entries.ts
CHANGED
|
@@ -532,8 +532,6 @@ export function selectIsFetching(state: Entries, collection: string) {
|
|
|
532
532
|
return state.getIn(['pages', collection, 'isFetching'], false);
|
|
533
533
|
}
|
|
534
534
|
|
|
535
|
-
const DRAFT_MEDIA_FILES = 'DRAFT_MEDIA_FILES';
|
|
536
|
-
|
|
537
535
|
function getFileField(collectionFiles: CollectionFiles, slug: string | undefined) {
|
|
538
536
|
const file = collectionFiles.find(f => f?.get('name') === slug);
|
|
539
537
|
return file;
|
|
@@ -752,7 +750,7 @@ export function selectMediaFolder(
|
|
|
752
750
|
const entryPath = entryMap?.get('path');
|
|
753
751
|
mediaFolder = entryPath
|
|
754
752
|
? join(dirname(entryPath), folder)
|
|
755
|
-
:
|
|
753
|
+
: (collection!.get('folder') as string);
|
|
756
754
|
}
|
|
757
755
|
}
|
|
758
756
|
|
package/src/types/redux.ts
CHANGED