decap-cms-core 3.5.0 → 3.6.1
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 +10 -10
- package/dist/decap-cms-core.js.map +1 -1
- package/dist/esm/actions/auth.js +22 -37
- package/dist/esm/actions/collections.js +9 -17
- package/dist/esm/actions/config.js +58 -74
- package/dist/esm/actions/deploys.js +10 -17
- package/dist/esm/actions/editorialWorkflow.js +87 -101
- package/dist/esm/actions/entries.js +161 -211
- package/dist/esm/actions/media.js +31 -46
- package/dist/esm/actions/mediaLibrary.js +94 -126
- package/dist/esm/actions/notifications.js +5 -13
- package/dist/esm/actions/search.js +30 -47
- package/dist/esm/actions/status.js +13 -23
- package/dist/esm/actions/waitUntil.js +4 -11
- package/dist/esm/backend.js +132 -148
- package/dist/esm/bootstrap.js +37 -44
- package/dist/esm/components/App/App.js +82 -89
- package/dist/esm/components/App/Header.js +46 -52
- package/dist/esm/components/App/NotFoundPage.js +11 -18
- package/dist/esm/components/Collection/Collection.js +55 -63
- package/dist/esm/components/Collection/CollectionControls.js +15 -22
- package/dist/esm/components/Collection/CollectionSearch.js +35 -42
- package/dist/esm/components/Collection/CollectionTop.js +23 -30
- package/dist/esm/components/Collection/ControlButton.js +10 -16
- package/dist/esm/components/Collection/Entries/Entries.js +24 -31
- package/dist/esm/components/Collection/Entries/EntriesCollection.js +60 -63
- package/dist/esm/components/Collection/Entries/EntriesSearch.js +26 -33
- package/dist/esm/components/Collection/Entries/EntryCard.js +38 -45
- package/dist/esm/components/Collection/Entries/EntryListing.js +24 -32
- package/dist/esm/components/Collection/FilterControl.js +9 -16
- package/dist/esm/components/Collection/GroupControl.js +9 -16
- package/dist/esm/components/Collection/NestedCollection.js +56 -64
- package/dist/esm/components/Collection/Sidebar.js +36 -43
- package/dist/esm/components/Collection/SortControl.js +19 -26
- package/dist/esm/components/Collection/ViewStyleControl.js +17 -24
- package/dist/esm/components/Editor/Editor.js +100 -108
- package/dist/esm/components/Editor/EditorControlPane/EditorControl.js +105 -112
- package/dist/esm/components/Editor/EditorControlPane/EditorControlPane.js +68 -62
- package/dist/esm/components/Editor/EditorControlPane/Widget.js +87 -73
- package/dist/esm/components/Editor/EditorInterface.js +95 -98
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreview.js +13 -21
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreviewContent.js +64 -23
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreviewPane.js +94 -78
- package/dist/esm/components/Editor/EditorPreviewPane/PreviewHOC.js +9 -16
- package/dist/esm/components/Editor/EditorToolbar.js +133 -140
- package/dist/esm/components/Editor/withWorkflow.js +15 -22
- package/dist/esm/components/EditorWidgets/Unknown/UnknownControl.js +9 -16
- package/dist/esm/components/EditorWidgets/Unknown/UnknownPreview.js +9 -16
- package/dist/esm/components/EditorWidgets/index.js +4 -7
- package/dist/esm/components/MediaLibrary/EmptyMessage.js +12 -19
- package/dist/esm/components/MediaLibrary/MediaLibrary.js +55 -62
- package/dist/esm/components/MediaLibrary/MediaLibraryButtons.js +28 -35
- package/dist/esm/components/MediaLibrary/MediaLibraryCard.js +36 -43
- package/dist/esm/components/MediaLibrary/MediaLibraryCardGrid.js +50 -57
- package/dist/esm/components/MediaLibrary/MediaLibraryHeader.js +16 -23
- package/dist/esm/components/MediaLibrary/MediaLibraryModal.js +59 -64
- package/dist/esm/components/MediaLibrary/MediaLibrarySearch.js +18 -25
- package/dist/esm/components/MediaLibrary/MediaLibraryTop.js +39 -46
- package/dist/esm/components/UI/DragDrop.js +21 -30
- package/dist/esm/components/UI/ErrorBoundary.js +35 -43
- package/dist/esm/components/UI/FileUploadButton.js +11 -18
- package/dist/esm/components/UI/Modal.js +19 -26
- package/dist/esm/components/UI/Notifications.js +21 -28
- package/dist/esm/components/UI/SettingsDropdown.js +28 -34
- package/dist/esm/components/UI/index.js +6 -60
- package/dist/esm/components/Workflow/Workflow.js +52 -61
- package/dist/esm/components/Workflow/WorkflowCard.js +45 -51
- package/dist/esm/components/Workflow/WorkflowList.js +43 -49
- package/dist/esm/constants/collectionTypes.js +2 -8
- package/dist/esm/constants/collectionViews.js +2 -8
- package/dist/esm/constants/commitProps.js +2 -8
- package/dist/esm/constants/configSchema.js +23 -27
- package/dist/esm/constants/fieldInference.js +8 -15
- package/dist/esm/constants/publishModes.js +6 -11
- package/dist/esm/constants/validationErrorTypes.js +1 -7
- package/dist/esm/formats/formats.js +32 -41
- package/dist/esm/formats/frontmatter.js +18 -30
- package/dist/esm/formats/helpers.js +1 -7
- package/dist/esm/formats/json.js +1 -7
- package/dist/esm/formats/toml.js +11 -18
- package/dist/esm/formats/yaml.js +7 -14
- package/dist/esm/index.js +5 -12
- package/dist/esm/integrations/index.js +8 -16
- package/dist/esm/integrations/providers/algolia/implementation.js +14 -22
- package/dist/esm/integrations/providers/assetStore/implementation.js +10 -18
- package/dist/esm/lib/consoleError.js +1 -7
- package/dist/esm/lib/formatters.js +34 -47
- package/dist/esm/lib/i18n.js +37 -66
- package/dist/esm/lib/phrases.js +4 -11
- package/dist/esm/lib/registry.js +40 -75
- package/dist/esm/lib/serializeEntryValues.js +11 -18
- package/dist/esm/lib/textHelper.js +1 -7
- package/dist/esm/lib/urlHelper.js +28 -43
- package/dist/esm/mediaLibrary.js +12 -16
- package/dist/esm/reducers/auth.js +10 -16
- package/dist/esm/reducers/collections.js +70 -102
- package/dist/esm/reducers/combinedReducer.js +4 -11
- package/dist/esm/reducers/config.js +11 -19
- package/dist/esm/reducers/cursors.js +12 -18
- package/dist/esm/reducers/deploys.js +8 -15
- package/dist/esm/reducers/editorialWorkflow.js +37 -47
- package/dist/esm/reducers/entries.js +107 -132
- package/dist/esm/reducers/entryDraft.js +64 -72
- package/dist/esm/reducers/globalUI.js +5 -11
- package/dist/esm/reducers/index.js +43 -64
- package/dist/esm/reducers/integrations.js +8 -16
- package/dist/esm/reducers/mediaLibrary.js +43 -52
- package/dist/esm/reducers/medias.js +11 -18
- package/dist/esm/reducers/notifications.js +9 -15
- package/dist/esm/reducers/search.js +12 -18
- package/dist/esm/reducers/status.js +7 -13
- package/dist/esm/redux/index.js +7 -13
- package/dist/esm/redux/middleware/waitUntilAction.js +3 -10
- package/dist/esm/routing/history.js +7 -15
- package/dist/esm/types/diacritics.d.js +0 -1
- package/dist/esm/types/global.d.js +1 -5
- package/dist/esm/types/immutable.js +1 -5
- package/dist/esm/types/redux.js +7 -8
- package/dist/esm/types/tomlify-j0.4.d.js +0 -1
- package/dist/esm/valueObjects/AssetProxy.js +2 -10
- package/dist/esm/valueObjects/EditorComponent.js +5 -12
- package/dist/esm/valueObjects/Entry.js +3 -10
- package/index.d.ts +1 -0
- package/package.json +3 -2
- package/src/components/Collection/Entries/EntriesCollection.js +21 -10
- package/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js +7 -7
- package/src/components/Collection/Entries/__tests__/__snapshots__/EntriesCollection.spec.js.snap +9 -9
- package/src/components/Collection/NestedCollection.js +11 -2
- package/src/components/Collection/__tests__/NestedCollection.spec.js +3 -0
- package/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap +68 -0
- package/src/components/Editor/EditorControlPane/EditorControl.js +0 -3
- package/src/components/Editor/EditorControlPane/EditorControlPane.js +21 -8
- package/src/components/Editor/EditorControlPane/Widget.js +22 -1
- package/src/components/Editor/EditorInterface.js +6 -1
- package/src/components/Editor/EditorPreviewPane/EditorPreviewContent.js +51 -11
- package/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js +33 -1
- package/src/constants/configSchema.js +1 -0
- package/src/types/redux.ts +1 -1
- package/dist/esm/actions/editorControl.js +0 -14
- package/dist/esm/reducers/editorComponent.js +0 -1
- package/dist/esm/reducers/editorControl.js +0 -17
|
@@ -1,48 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.loadAssetRequest = loadAssetRequest;
|
|
14
|
-
exports.loadAssetSuccess = loadAssetSuccess;
|
|
15
|
-
exports.removeAsset = removeAsset;
|
|
16
|
-
var _decapCmsLibUtil = require("decap-cms-lib-util");
|
|
17
|
-
var _AssetProxy = require("../valueObjects/AssetProxy");
|
|
18
|
-
var _entries = require("../reducers/entries");
|
|
19
|
-
var _mediaLibrary = require("../reducers/mediaLibrary");
|
|
20
|
-
var _mediaLibrary2 = require("./mediaLibrary");
|
|
21
|
-
const ADD_ASSETS = exports.ADD_ASSETS = 'ADD_ASSETS';
|
|
22
|
-
const ADD_ASSET = exports.ADD_ASSET = 'ADD_ASSET';
|
|
23
|
-
const REMOVE_ASSET = exports.REMOVE_ASSET = 'REMOVE_ASSET';
|
|
24
|
-
const LOAD_ASSET_REQUEST = exports.LOAD_ASSET_REQUEST = 'LOAD_ASSET_REQUEST';
|
|
25
|
-
const LOAD_ASSET_SUCCESS = exports.LOAD_ASSET_SUCCESS = 'LOAD_ASSET_SUCCESS';
|
|
26
|
-
const LOAD_ASSET_FAILURE = exports.LOAD_ASSET_FAILURE = 'LOAD_ASSET_FAILURE';
|
|
27
|
-
function addAssets(assets) {
|
|
1
|
+
import { isAbsolutePath } from 'decap-cms-lib-util';
|
|
2
|
+
import { createAssetProxy } from '../valueObjects/AssetProxy';
|
|
3
|
+
import { selectMediaFilePath } from '../reducers/entries';
|
|
4
|
+
import { selectMediaFileByPath } from '../reducers/mediaLibrary';
|
|
5
|
+
import { getMediaFile, waitForMediaLibraryToLoad, getMediaDisplayURL } from './mediaLibrary';
|
|
6
|
+
export const ADD_ASSETS = 'ADD_ASSETS';
|
|
7
|
+
export const ADD_ASSET = 'ADD_ASSET';
|
|
8
|
+
export const REMOVE_ASSET = 'REMOVE_ASSET';
|
|
9
|
+
export const LOAD_ASSET_REQUEST = 'LOAD_ASSET_REQUEST';
|
|
10
|
+
export const LOAD_ASSET_SUCCESS = 'LOAD_ASSET_SUCCESS';
|
|
11
|
+
export const LOAD_ASSET_FAILURE = 'LOAD_ASSET_FAILURE';
|
|
12
|
+
export function addAssets(assets) {
|
|
28
13
|
return {
|
|
29
14
|
type: ADD_ASSETS,
|
|
30
15
|
payload: assets
|
|
31
16
|
};
|
|
32
17
|
}
|
|
33
|
-
function addAsset(assetProxy) {
|
|
18
|
+
export function addAsset(assetProxy) {
|
|
34
19
|
return {
|
|
35
20
|
type: ADD_ASSET,
|
|
36
21
|
payload: assetProxy
|
|
37
22
|
};
|
|
38
23
|
}
|
|
39
|
-
function removeAsset(path) {
|
|
24
|
+
export function removeAsset(path) {
|
|
40
25
|
return {
|
|
41
26
|
type: REMOVE_ASSET,
|
|
42
27
|
payload: path
|
|
43
28
|
};
|
|
44
29
|
}
|
|
45
|
-
function loadAssetRequest(path) {
|
|
30
|
+
export function loadAssetRequest(path) {
|
|
46
31
|
return {
|
|
47
32
|
type: LOAD_ASSET_REQUEST,
|
|
48
33
|
payload: {
|
|
@@ -50,7 +35,7 @@ function loadAssetRequest(path) {
|
|
|
50
35
|
}
|
|
51
36
|
};
|
|
52
37
|
}
|
|
53
|
-
function loadAssetSuccess(path) {
|
|
38
|
+
export function loadAssetSuccess(path) {
|
|
54
39
|
return {
|
|
55
40
|
type: LOAD_ASSET_SUCCESS,
|
|
56
41
|
payload: {
|
|
@@ -58,7 +43,7 @@ function loadAssetSuccess(path) {
|
|
|
58
43
|
}
|
|
59
44
|
};
|
|
60
45
|
}
|
|
61
|
-
function loadAssetFailure(path, error) {
|
|
46
|
+
export function loadAssetFailure(path, error) {
|
|
62
47
|
return {
|
|
63
48
|
type: LOAD_ASSET_FAILURE,
|
|
64
49
|
payload: {
|
|
@@ -67,16 +52,16 @@ function loadAssetFailure(path, error) {
|
|
|
67
52
|
}
|
|
68
53
|
};
|
|
69
54
|
}
|
|
70
|
-
function loadAsset(resolvedPath) {
|
|
55
|
+
export function loadAsset(resolvedPath) {
|
|
71
56
|
return async (dispatch, getState) => {
|
|
72
57
|
try {
|
|
73
58
|
dispatch(loadAssetRequest(resolvedPath));
|
|
74
59
|
// load asset url from backend
|
|
75
|
-
await
|
|
76
|
-
const file =
|
|
60
|
+
await waitForMediaLibraryToLoad(dispatch, getState());
|
|
61
|
+
const file = selectMediaFileByPath(getState(), resolvedPath);
|
|
77
62
|
if (file) {
|
|
78
|
-
const url = await
|
|
79
|
-
const asset =
|
|
63
|
+
const url = await getMediaDisplayURL(dispatch, getState(), file);
|
|
64
|
+
const asset = createAssetProxy({
|
|
80
65
|
path: resolvedPath,
|
|
81
66
|
url: url || resolvedPath
|
|
82
67
|
});
|
|
@@ -84,8 +69,8 @@ function loadAsset(resolvedPath) {
|
|
|
84
69
|
} else {
|
|
85
70
|
const {
|
|
86
71
|
url
|
|
87
|
-
} = await
|
|
88
|
-
const asset =
|
|
72
|
+
} = await getMediaFile(getState(), resolvedPath);
|
|
73
|
+
const asset = createAssetProxy({
|
|
89
74
|
path: resolvedPath,
|
|
90
75
|
url
|
|
91
76
|
});
|
|
@@ -97,13 +82,13 @@ function loadAsset(resolvedPath) {
|
|
|
97
82
|
}
|
|
98
83
|
};
|
|
99
84
|
}
|
|
100
|
-
const emptyAsset =
|
|
85
|
+
const emptyAsset = createAssetProxy({
|
|
101
86
|
path: 'empty.svg',
|
|
102
87
|
file: new File([`<svg xmlns="http://www.w3.org/2000/svg"></svg>`], 'empty.svg', {
|
|
103
88
|
type: 'image/svg+xml'
|
|
104
89
|
})
|
|
105
90
|
});
|
|
106
|
-
function boundGetAsset(dispatch, collection, entry) {
|
|
91
|
+
export function boundGetAsset(dispatch, collection, entry) {
|
|
107
92
|
function bound(path, field) {
|
|
108
93
|
const asset = dispatch(getAsset({
|
|
109
94
|
collection,
|
|
@@ -115,7 +100,7 @@ function boundGetAsset(dispatch, collection, entry) {
|
|
|
115
100
|
}
|
|
116
101
|
return bound;
|
|
117
102
|
}
|
|
118
|
-
function getAsset({
|
|
103
|
+
export function getAsset({
|
|
119
104
|
collection,
|
|
120
105
|
entry,
|
|
121
106
|
path,
|
|
@@ -124,7 +109,7 @@ function getAsset({
|
|
|
124
109
|
return (dispatch, getState) => {
|
|
125
110
|
if (!path) return emptyAsset;
|
|
126
111
|
const state = getState();
|
|
127
|
-
const resolvedPath =
|
|
112
|
+
const resolvedPath = selectMediaFilePath(state.config, collection, entry, path, field);
|
|
128
113
|
let {
|
|
129
114
|
asset,
|
|
130
115
|
isLoading,
|
|
@@ -137,9 +122,9 @@ function getAsset({
|
|
|
137
122
|
// There is already an AssetProxy in memory for this path. Use it.
|
|
138
123
|
return asset;
|
|
139
124
|
}
|
|
140
|
-
if (
|
|
125
|
+
if (isAbsolutePath(resolvedPath)) {
|
|
141
126
|
// asset path is a public url so we can just use it as is
|
|
142
|
-
asset =
|
|
127
|
+
asset = createAssetProxy({
|
|
143
128
|
path: resolvedPath,
|
|
144
129
|
url: path
|
|
145
130
|
});
|
|
@@ -147,7 +132,7 @@ function getAsset({
|
|
|
147
132
|
} else {
|
|
148
133
|
if (error) {
|
|
149
134
|
// on load error default back to original path
|
|
150
|
-
asset =
|
|
135
|
+
asset = createAssetProxy({
|
|
151
136
|
path: resolvedPath,
|
|
152
137
|
url: path
|
|
153
138
|
});
|