decap-cms-core 3.6.3 → 3.7.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 +25 -25
- package/dist/decap-cms-core.js.LICENSE.txt +14 -8
- package/dist/decap-cms-core.js.map +1 -1
- package/dist/esm/actions/config.js +57 -49
- package/dist/esm/actions/editorialWorkflow.js +4 -4
- package/dist/esm/actions/entries.js +8 -14
- package/dist/esm/actions/mediaLibrary.js +6 -11
- package/dist/esm/actions/search.js +2 -2
- package/dist/esm/actions/status.js +2 -8
- package/dist/esm/backend.js +70 -79
- package/dist/esm/bootstrap.js +3 -2
- package/dist/esm/components/App/App.js +28 -34
- package/dist/esm/components/App/Header.js +32 -39
- package/dist/esm/components/Collection/Collection.js +45 -48
- package/dist/esm/components/Collection/CollectionSearch.js +76 -81
- package/dist/esm/components/Collection/CollectionTop.js +1 -2
- package/dist/esm/components/Collection/Entries/Entries.js +2 -4
- package/dist/esm/components/Collection/Entries/EntriesCollection.js +25 -29
- package/dist/esm/components/Collection/Entries/EntriesSearch.js +34 -38
- package/dist/esm/components/Collection/Entries/EntryCard.js +8 -13
- package/dist/esm/components/Collection/Entries/EntryListing.js +72 -76
- package/dist/esm/components/Collection/FilterControl.js +1 -1
- package/dist/esm/components/Collection/GroupControl.js +1 -1
- package/dist/esm/components/Collection/NestedCollection.js +50 -53
- package/dist/esm/components/Collection/Sidebar.js +35 -38
- package/dist/esm/components/Collection/SortControl.js +3 -3
- package/dist/esm/components/Collection/ViewStyleControl.js +1 -2
- package/dist/esm/components/Editor/Editor.js +197 -201
- package/dist/esm/components/Editor/EditorControlPane/EditorControl.js +79 -87
- package/dist/esm/components/Editor/EditorControlPane/EditorControlPane.js +75 -86
- package/dist/esm/components/Editor/EditorControlPane/Widget.js +226 -228
- package/dist/esm/components/Editor/EditorInterface.js +69 -80
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreview.js +1 -2
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreviewContent.js +20 -28
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreviewPane.js +163 -161
- package/dist/esm/components/Editor/EditorPreviewPane/PreviewHOC.js +4 -8
- package/dist/esm/components/Editor/EditorToolbar.js +335 -347
- package/dist/esm/components/Editor/withWorkflow.js +5 -6
- package/dist/esm/components/MediaLibrary/MediaLibrary.js +304 -294
- package/dist/esm/components/MediaLibrary/MediaLibraryButtons.js +40 -46
- package/dist/esm/components/MediaLibrary/MediaLibraryCard.js +1 -2
- package/dist/esm/components/MediaLibrary/MediaLibraryCardGrid.js +8 -13
- package/dist/esm/components/MediaLibrary/MediaLibraryModal.js +3 -3
- package/dist/esm/components/MediaLibrary/MediaLibrarySearch.js +1 -2
- package/dist/esm/components/MediaLibrary/MediaLibraryTop.js +3 -6
- package/dist/esm/components/UI/DragDrop.js +15 -23
- package/dist/esm/components/UI/ErrorBoundary.js +23 -25
- package/dist/esm/components/UI/Modal.js +10 -12
- package/dist/esm/components/UI/Notifications.js +4 -8
- package/dist/esm/components/UI/SettingsDropdown.js +4 -8
- package/dist/esm/components/Workflow/Workflow.js +19 -20
- package/dist/esm/components/Workflow/WorkflowCard.js +2 -4
- package/dist/esm/components/Workflow/WorkflowList.js +105 -113
- package/dist/esm/constants/configSchema.js +18 -16
- package/dist/esm/formats/formats.js +11 -12
- package/dist/esm/formats/frontmatter.js +17 -21
- package/dist/esm/formats/toml.js +2 -2
- package/dist/esm/formats/yaml.js +2 -6
- package/dist/esm/index.js +3 -7
- package/dist/esm/integrations/providers/algolia/implementation.js +12 -14
- package/dist/esm/integrations/providers/assetStore/implementation.js +10 -12
- package/dist/esm/lib/formatters.js +13 -17
- package/dist/esm/lib/i18n.js +35 -33
- package/dist/esm/lib/phrases.js +2 -2
- package/dist/esm/lib/polyfill.js +8 -0
- package/dist/esm/lib/registry.js +35 -35
- package/dist/esm/lib/serializeEntryValues.js +3 -3
- package/dist/esm/lib/stega.js +142 -0
- package/dist/esm/lib/urlHelper.js +16 -18
- package/dist/esm/mediaLibrary.js +3 -4
- package/dist/esm/reducers/collections.js +26 -42
- package/dist/esm/reducers/combinedReducer.js +3 -6
- package/dist/esm/reducers/config.js +3 -7
- package/dist/esm/reducers/editorialWorkflow.js +5 -9
- package/dist/esm/reducers/entries.js +33 -35
- package/dist/esm/reducers/entryDraft.js +2 -2
- package/dist/esm/reducers/integrations.js +8 -14
- package/dist/esm/reducers/mediaLibrary.js +18 -20
- package/dist/esm/reducers/notifications.js +4 -8
- package/dist/esm/types/immutable.js +7 -1
- package/dist/esm/valueObjects/AssetProxy.js +1 -9
- package/dist/esm/valueObjects/EditorComponent.js +18 -25
- package/dist/esm/valueObjects/Entry.js +2 -2
- package/index.d.ts +2 -0
- package/package.json +14 -11
- package/src/actions/__tests__/config.spec.js +3 -3
- package/src/actions/config.ts +3 -1
- package/src/actions/editorialWorkflow.ts +1 -1
- package/src/actions/entries.ts +1 -1
- package/src/actions/search.ts +1 -1
- package/src/backend.ts +8 -1
- package/src/bootstrap.js +1 -0
- package/src/components/App/App.js +5 -0
- package/src/components/App/Header.js +3 -0
- package/src/components/Collection/Collection.js +5 -0
- package/src/components/Collection/CollectionSearch.js +5 -0
- package/src/components/Collection/Entries/EntriesCollection.js +4 -1
- package/src/components/Collection/Entries/EntriesSearch.js +4 -1
- package/src/components/Collection/Entries/EntryListing.js +5 -0
- package/src/components/Collection/Entries/__tests__/__snapshots__/EntriesCollection.spec.js.snap +0 -4
- package/src/components/Collection/NestedCollection.js +6 -1
- package/src/components/Collection/Sidebar.js +5 -0
- package/src/components/Editor/Editor.js +4 -1
- package/src/components/Editor/EditorControlPane/EditorControl.js +7 -1
- package/src/components/Editor/EditorControlPane/Widget.js +5 -0
- package/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js +1 -1
- package/src/components/Editor/EditorToolbar.js +3 -0
- package/src/components/Editor/__tests__/Editor.spec.js +3 -4
- package/src/components/Editor/__tests__/__snapshots__/Editor.spec.js.snap +5 -5
- package/src/components/Editor/__tests__/__snapshots__/EditorToolbar.spec.js.snap +708 -393
- package/src/components/MediaLibrary/MediaLibrary.js +5 -1
- package/src/components/MediaLibrary/MediaLibraryModal.js +1 -1
- package/src/components/UI/ErrorBoundary.js +6 -1
- package/src/components/UI/Modal.js +3 -0
- package/src/components/Workflow/Workflow.js +3 -0
- package/src/components/Workflow/WorkflowList.js +5 -0
- package/src/constants/__tests__/configSchema.spec.js +1 -1
- package/src/formats/formats.ts +1 -1
- package/src/formats/toml.ts +2 -2
- package/src/integrations/providers/algolia/implementation.js +2 -2
- package/src/integrations/providers/assetStore/implementation.js +2 -1
- package/src/lib/formatters.ts +4 -1
- package/src/lib/i18n.ts +3 -1
- package/src/lib/phrases.js +1 -1
- package/src/lib/polyfill.js +9 -0
- package/src/lib/serializeEntryValues.js +1 -1
- package/src/lib/stega.ts +145 -0
- package/src/lib/urlHelper.ts +4 -1
- package/src/mediaLibrary.ts +1 -1
- package/src/reducers/collections.ts +2 -1
- package/src/reducers/editorialWorkflow.ts +1 -1
- package/src/reducers/entries.ts +6 -1
- package/src/reducers/entryDraft.js +1 -1
- package/src/types/immutable.ts +10 -0
- package/src/types/redux.ts +2 -0
- package/src/valueObjects/EditorComponent.js +1 -1
- package/src/valueObjects/Entry.ts +1 -1
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import _isEmpty from "lodash/isEmpty";
|
|
2
|
-
import _trim from "lodash/trim";
|
|
3
|
-
import _trimStart from "lodash/trimStart";
|
|
4
|
-
const _excluded = ["sortableFields"];
|
|
5
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
11
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
1
|
import yaml from 'yaml';
|
|
13
2
|
import { fromJS } from 'immutable';
|
|
14
3
|
import deepmerge from 'deepmerge';
|
|
15
4
|
import { produce } from 'immer';
|
|
5
|
+
import trimStart from 'lodash/trimStart';
|
|
6
|
+
import trim from 'lodash/trim';
|
|
7
|
+
import isEmpty from 'lodash/isEmpty';
|
|
16
8
|
import { SIMPLE as SIMPLE_PUBLISH_MODE } from '../constants/publishModes';
|
|
17
9
|
import { validateConfig } from '../constants/configSchema';
|
|
18
10
|
import { selectDefaultSortableFields } from '../reducers/collections';
|
|
@@ -33,17 +25,20 @@ function traverseFieldsJS(fields, updater) {
|
|
|
33
25
|
return fields.map(field => {
|
|
34
26
|
const newField = updater(field);
|
|
35
27
|
if (isObjectField(newField)) {
|
|
36
|
-
return
|
|
28
|
+
return {
|
|
29
|
+
...newField,
|
|
37
30
|
fields: traverseFieldsJS(newField.fields, updater)
|
|
38
|
-
}
|
|
31
|
+
};
|
|
39
32
|
} else if (isFieldList(newField) && newField.field) {
|
|
40
|
-
return
|
|
33
|
+
return {
|
|
34
|
+
...newField,
|
|
41
35
|
field: traverseFieldsJS([newField.field], updater)[0]
|
|
42
|
-
}
|
|
36
|
+
};
|
|
43
37
|
} else if (isFieldList(newField) && newField.types) {
|
|
44
|
-
return
|
|
38
|
+
return {
|
|
39
|
+
...newField,
|
|
45
40
|
types: traverseFieldsJS(newField.types, updater)
|
|
46
|
-
}
|
|
41
|
+
};
|
|
47
42
|
}
|
|
48
43
|
return newField;
|
|
49
44
|
});
|
|
@@ -62,9 +57,10 @@ function getConfigUrl() {
|
|
|
62
57
|
}
|
|
63
58
|
function setDefaultPublicFolderForField(field) {
|
|
64
59
|
if ('media_folder' in field && !('public_folder' in field)) {
|
|
65
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
...field,
|
|
66
62
|
public_folder: field.media_folder
|
|
67
|
-
}
|
|
63
|
+
};
|
|
68
64
|
}
|
|
69
65
|
return field;
|
|
70
66
|
}
|
|
@@ -94,13 +90,15 @@ function setSnakeCaseConfig(field) {
|
|
|
94
90
|
}
|
|
95
91
|
function setI18nField(field) {
|
|
96
92
|
if (field[I18N] === true) {
|
|
97
|
-
return
|
|
93
|
+
return {
|
|
94
|
+
...field,
|
|
98
95
|
[I18N]: I18N_FIELD.TRANSLATE
|
|
99
|
-
}
|
|
96
|
+
};
|
|
100
97
|
} else if (field[I18N] === false || !field[I18N]) {
|
|
101
|
-
return
|
|
98
|
+
return {
|
|
99
|
+
...field,
|
|
102
100
|
[I18N]: I18N_FIELD.NONE
|
|
103
|
-
}
|
|
101
|
+
};
|
|
104
102
|
}
|
|
105
103
|
return field;
|
|
106
104
|
}
|
|
@@ -122,7 +120,9 @@ function setI18nDefaultsForFields(collectionOrFileFields, hasI18n) {
|
|
|
122
120
|
return traverseFieldsJS(collectionOrFileFields, setI18nField);
|
|
123
121
|
} else {
|
|
124
122
|
return traverseFieldsJS(collectionOrFileFields, field => {
|
|
125
|
-
const newField =
|
|
123
|
+
const newField = {
|
|
124
|
+
...field
|
|
125
|
+
};
|
|
126
126
|
delete newField[I18N];
|
|
127
127
|
return newField;
|
|
128
128
|
});
|
|
@@ -156,36 +156,41 @@ export function normalizeConfig(config) {
|
|
|
156
156
|
let normalizedCollection = collection;
|
|
157
157
|
if (fields) {
|
|
158
158
|
const normalizedFields = traverseFieldsJS(fields, setSnakeCaseConfig);
|
|
159
|
-
normalizedCollection =
|
|
159
|
+
normalizedCollection = {
|
|
160
|
+
...normalizedCollection,
|
|
160
161
|
fields: normalizedFields
|
|
161
|
-
}
|
|
162
|
+
};
|
|
162
163
|
}
|
|
163
164
|
if (files) {
|
|
164
165
|
const normalizedFiles = files.map(file => {
|
|
165
166
|
const normalizedFileFields = traverseFieldsJS(file.fields, setSnakeCaseConfig);
|
|
166
|
-
return
|
|
167
|
+
return {
|
|
168
|
+
...file,
|
|
167
169
|
fields: normalizedFileFields
|
|
168
|
-
}
|
|
170
|
+
};
|
|
169
171
|
});
|
|
170
|
-
normalizedCollection =
|
|
172
|
+
normalizedCollection = {
|
|
173
|
+
...normalizedCollection,
|
|
171
174
|
files: normalizedFiles
|
|
172
|
-
}
|
|
175
|
+
};
|
|
173
176
|
}
|
|
174
177
|
if (normalizedCollection.sortableFields) {
|
|
175
178
|
const {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
normalizedCollection =
|
|
179
|
+
sortableFields,
|
|
180
|
+
...rest
|
|
181
|
+
} = normalizedCollection;
|
|
182
|
+
normalizedCollection = {
|
|
183
|
+
...rest,
|
|
180
184
|
sortable_fields: sortableFields
|
|
181
|
-
}
|
|
185
|
+
};
|
|
182
186
|
console.warn(`Collection ${collection.name} is using a deprecated configuration 'sortableFields'. Please use 'sortable_fields'`);
|
|
183
187
|
}
|
|
184
188
|
return normalizedCollection;
|
|
185
189
|
});
|
|
186
|
-
return
|
|
190
|
+
return {
|
|
191
|
+
...config,
|
|
187
192
|
collections: normalizedCollections
|
|
188
|
-
}
|
|
193
|
+
};
|
|
189
194
|
}
|
|
190
195
|
export function applyDefaults(originalConfig) {
|
|
191
196
|
return produce(originalConfig, config => {
|
|
@@ -199,7 +204,7 @@ export function applyDefaults(originalConfig) {
|
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
// Use media_folder as default public_folder.
|
|
202
|
-
const defaultPublicFolder = `/${
|
|
207
|
+
const defaultPublicFolder = `/${trimStart(config.media_folder, '/')}`;
|
|
203
208
|
if (!('public_folder' in config)) {
|
|
204
209
|
config.public_folder = defaultPublicFolder;
|
|
205
210
|
}
|
|
@@ -254,13 +259,14 @@ export function applyDefaults(originalConfig) {
|
|
|
254
259
|
if (collection.fields) {
|
|
255
260
|
collection.fields = traverseFieldsJS(collection.fields, setDefaultPublicFolderForField);
|
|
256
261
|
}
|
|
257
|
-
collection.folder =
|
|
262
|
+
collection.folder = trim(folder, '/');
|
|
258
263
|
if (meta && meta.path) {
|
|
259
|
-
const metaField =
|
|
264
|
+
const metaField = {
|
|
260
265
|
name: 'path',
|
|
261
266
|
meta: true,
|
|
262
|
-
required: true
|
|
263
|
-
|
|
267
|
+
required: true,
|
|
268
|
+
...meta.path
|
|
269
|
+
};
|
|
264
270
|
collection.fields = [metaField, ...(collection.fields || [])];
|
|
265
271
|
}
|
|
266
272
|
}
|
|
@@ -270,7 +276,7 @@ export function applyDefaults(originalConfig) {
|
|
|
270
276
|
delete collection.nested;
|
|
271
277
|
delete collection.meta;
|
|
272
278
|
for (const file of files) {
|
|
273
|
-
file.file =
|
|
279
|
+
file.file = trimStart(file.file, '/');
|
|
274
280
|
if ('media_folder' in file && !('public_folder' in file)) {
|
|
275
281
|
file.public_folder = file.media_folder;
|
|
276
282
|
}
|
|
@@ -297,14 +303,16 @@ export function applyDefaults(originalConfig) {
|
|
|
297
303
|
fromJS(collection), backend, hasIntegration(config, collection));
|
|
298
304
|
}
|
|
299
305
|
collection.view_filters = (view_filters || []).map(filter => {
|
|
300
|
-
return
|
|
306
|
+
return {
|
|
307
|
+
...filter,
|
|
301
308
|
id: `${filter.field}__${filter.pattern}`
|
|
302
|
-
}
|
|
309
|
+
};
|
|
303
310
|
});
|
|
304
311
|
collection.view_groups = (view_groups || []).map(group => {
|
|
305
|
-
return
|
|
312
|
+
return {
|
|
313
|
+
...group,
|
|
306
314
|
id: `${group.field}__${group.pattern}`
|
|
307
|
-
}
|
|
315
|
+
};
|
|
308
316
|
});
|
|
309
317
|
if (config.editor && !collection.editor) {
|
|
310
318
|
collection.editor = {
|
|
@@ -368,7 +376,7 @@ export function configFailed(err) {
|
|
|
368
376
|
};
|
|
369
377
|
}
|
|
370
378
|
export async function detectProxyServer(localBackend) {
|
|
371
|
-
const allowedHosts = ['localhost', '127.0.0.1', ...(typeof localBackend === 'boolean' ? [] :
|
|
379
|
+
const allowedHosts = ['localhost', '127.0.0.1', ...(typeof localBackend === 'boolean' ? [] : localBackend?.allowed_hosts || [])];
|
|
372
380
|
if (!allowedHosts.includes(location.hostname) || !localBackend) {
|
|
373
381
|
return {};
|
|
374
382
|
}
|
|
@@ -442,7 +450,7 @@ export function loadConfig(manualConfig = {}, onLoad) {
|
|
|
442
450
|
dispatch(configLoading());
|
|
443
451
|
try {
|
|
444
452
|
const configUrl = getConfigUrl();
|
|
445
|
-
const hasManualConfig = !
|
|
453
|
+
const hasManualConfig = !isEmpty(manualConfig);
|
|
446
454
|
const configYaml = manualConfig.load_config_file === false ? {} : await getConfigYaml(configUrl, hasManualConfig);
|
|
447
455
|
|
|
448
456
|
// Merge manual config into the config.yml one
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import get from 'lodash/get';
|
|
2
2
|
import { Map, List } from 'immutable';
|
|
3
3
|
import { EDITORIAL_WORKFLOW_ERROR } from 'decap-cms-lib-util';
|
|
4
4
|
import { currentBackend, slugFromCustomPath } from '../backend';
|
|
@@ -206,7 +206,7 @@ export function loadUnpublishedEntry(collection, slug) {
|
|
|
206
206
|
return async (dispatch, getState) => {
|
|
207
207
|
const state = getState();
|
|
208
208
|
const backend = currentBackend(state.config);
|
|
209
|
-
const entriesLoaded =
|
|
209
|
+
const entriesLoaded = get(state.editorialWorkflow.toJS(), 'pages.ids', false);
|
|
210
210
|
//run possible unpublishedEntries migration
|
|
211
211
|
if (!entriesLoaded) {
|
|
212
212
|
try {
|
|
@@ -254,7 +254,7 @@ export function loadUnpublishedEntries(collections) {
|
|
|
254
254
|
return (dispatch, getState) => {
|
|
255
255
|
const state = getState();
|
|
256
256
|
const backend = currentBackend(state.config);
|
|
257
|
-
const entriesLoaded =
|
|
257
|
+
const entriesLoaded = get(state.editorialWorkflow.toJS(), 'pages.ids', false);
|
|
258
258
|
if (state.config.publish_mode !== EDITORIAL_WORKFLOW || entriesLoaded) {
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
@@ -281,7 +281,7 @@ export function persistUnpublishedEntry(collection, existingUnpublishedEntry) {
|
|
|
281
281
|
const unpublishedSlugs = selectUnpublishedSlugs(state, collection.get('name'));
|
|
282
282
|
const publishedSlugs = selectPublishedSlugs(state, collection.get('name'));
|
|
283
283
|
const usedSlugs = publishedSlugs.concat(unpublishedSlugs);
|
|
284
|
-
const entriesLoaded =
|
|
284
|
+
const entriesLoaded = get(state.editorialWorkflow.toJS(), 'pages.ids', false);
|
|
285
285
|
|
|
286
286
|
//load unpublishedEntries
|
|
287
287
|
!entriesLoaded && dispatch(loadUnpublishedEntries(state.collections));
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import _isEqual from "lodash/isEqual";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
6
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
1
|
import { fromJS, List, Map } from 'immutable';
|
|
2
|
+
import isEqual from 'lodash/isEqual';
|
|
8
3
|
import { Cursor } from 'decap-cms-lib-util';
|
|
9
4
|
import { selectCollectionEntriesCursor } from '../reducers/cursors';
|
|
10
5
|
import { selectFields, updateFieldByKey } from '../reducers/collections';
|
|
@@ -530,7 +525,8 @@ export function loadEntries(collection, page = 0) {
|
|
|
530
525
|
provider.listAllEntries(collection).then(entries => ({
|
|
531
526
|
entries
|
|
532
527
|
})) : provider.listEntries(collection, page));
|
|
533
|
-
response =
|
|
528
|
+
response = {
|
|
529
|
+
...response,
|
|
534
530
|
// The only existing backend using the pagination system is the
|
|
535
531
|
// Algolia integration, which is also the only integration used
|
|
536
532
|
// to list entries. Thus, this checking for an integration can
|
|
@@ -546,7 +542,7 @@ export function loadEntries(collection, page = 0) {
|
|
|
546
542
|
nextPage: page + 1
|
|
547
543
|
}
|
|
548
544
|
}) : Cursor.create(response.cursor)
|
|
549
|
-
}
|
|
545
|
+
};
|
|
550
546
|
dispatch(entriesLoaded(collection, response.cursor.meta.get('usingOldPaginationAPI') ? response.entries.reverse() : response.entries, response.pagination, addAppendActionsToCursor(response.cursor), append));
|
|
551
547
|
} catch (err) {
|
|
552
548
|
dispatch(addNotification({
|
|
@@ -590,13 +586,12 @@ export function traverseCollectionCursor(collection, action) {
|
|
|
590
586
|
return dispatch(loadEntries(collection, cursor.data.get('nextPage')));
|
|
591
587
|
}
|
|
592
588
|
try {
|
|
593
|
-
var _newCursor$meta;
|
|
594
589
|
dispatch(entriesLoading(collection));
|
|
595
590
|
const {
|
|
596
591
|
entries,
|
|
597
592
|
cursor: newCursor
|
|
598
593
|
} = await traverseCursor(backend, cursor, realAction);
|
|
599
|
-
const pagination =
|
|
594
|
+
const pagination = newCursor.meta?.get('page');
|
|
600
595
|
return dispatch(entriesLoaded(collection, entries, pagination, addAppendActionsToCursor(newCursor), append));
|
|
601
596
|
} catch (err) {
|
|
602
597
|
console.error(err);
|
|
@@ -670,7 +665,7 @@ export function createEmptyDraftData(fields, skipField = () => false) {
|
|
|
670
665
|
const name = item.get('name');
|
|
671
666
|
const defaultValue = item.get('default', null);
|
|
672
667
|
function isEmptyDefaultValue(val) {
|
|
673
|
-
return [[{}], {}].some(e =>
|
|
668
|
+
return [[{}], {}].some(e => isEqual(val, e));
|
|
674
669
|
}
|
|
675
670
|
const hasSubfields = List.isList(subfields) || Map.isMap(subfields);
|
|
676
671
|
if (hasSubfields) {
|
|
@@ -834,7 +829,6 @@ function getPathError(path, key, t) {
|
|
|
834
829
|
}
|
|
835
830
|
export function validateMetaField(state, collection, field, value, t) {
|
|
836
831
|
if (field.get('meta') && field.get('name') === 'path') {
|
|
837
|
-
var _state$entryDraft;
|
|
838
832
|
if (!value) {
|
|
839
833
|
return getPathError(value, 'invalidPath', t);
|
|
840
834
|
}
|
|
@@ -850,8 +844,8 @@ export function validateMetaField(state, collection, field, value, t) {
|
|
|
850
844
|
}
|
|
851
845
|
}));
|
|
852
846
|
const existingEntry = customPath ? selectEntryByPath(state.entries, collection.get('name'), customPath) : undefined;
|
|
853
|
-
const existingEntryPath = existingEntry
|
|
854
|
-
const draftPath =
|
|
847
|
+
const existingEntryPath = existingEntry?.get('path');
|
|
848
|
+
const draftPath = state.entryDraft?.getIn(['entry', 'path']);
|
|
855
849
|
if (existingEntryPath && existingEntryPath !== draftPath) {
|
|
856
850
|
return getPathError(value, 'pathExists', t);
|
|
857
851
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
5
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
1
|
import { Map } from 'immutable';
|
|
7
2
|
import { basename, getBlobSHA } from 'decap-cms-lib-util';
|
|
8
3
|
import { currentBackend } from '../backend';
|
|
@@ -246,7 +241,7 @@ export function persistMedia(file, opts = {}) {
|
|
|
246
241
|
throw new Error('The Private Upload option is only available for Asset Store Integration');
|
|
247
242
|
} else {
|
|
248
243
|
const entry = state.entryDraft.get('entry');
|
|
249
|
-
const collection = state.collections.get(entry
|
|
244
|
+
const collection = state.collections.get(entry?.get('collection'));
|
|
250
245
|
const path = selectMediaFilePath(state.config, collection, entry, fileName, field);
|
|
251
246
|
assetProxy = createAssetProxy({
|
|
252
247
|
file,
|
|
@@ -420,9 +415,10 @@ export function mediaLoading(page) {
|
|
|
420
415
|
export function mediaLoaded(files, opts = {}) {
|
|
421
416
|
return {
|
|
422
417
|
type: MEDIA_LOAD_SUCCESS,
|
|
423
|
-
payload:
|
|
424
|
-
files
|
|
425
|
-
|
|
418
|
+
payload: {
|
|
419
|
+
files,
|
|
420
|
+
...opts
|
|
421
|
+
}
|
|
426
422
|
};
|
|
427
423
|
}
|
|
428
424
|
export function mediaLoadFailed(opts = {}) {
|
|
@@ -538,7 +534,6 @@ export async function getMediaDisplayURL(dispatch, state, file) {
|
|
|
538
534
|
// url loading had an error
|
|
539
535
|
url = null;
|
|
540
536
|
} else {
|
|
541
|
-
var _await$promise;
|
|
542
537
|
const key = file.id;
|
|
543
538
|
const promise = waitUntilWithTimeout(dispatch, resolve => ({
|
|
544
539
|
predicate: ({
|
|
@@ -551,7 +546,7 @@ export async function getMediaDisplayURL(dispatch, state, file) {
|
|
|
551
546
|
// load display url
|
|
552
547
|
dispatch(loadMediaDisplayURL(file));
|
|
553
548
|
}
|
|
554
|
-
url = (
|
|
549
|
+
url = (await promise) ?? null;
|
|
555
550
|
}
|
|
556
551
|
return url;
|
|
557
552
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import isEqual from 'lodash/isEqual';
|
|
2
2
|
import { currentBackend } from '../backend';
|
|
3
3
|
import { getIntegrationProvider } from '../integrations';
|
|
4
4
|
import { selectIntegration } from '../reducers';
|
|
@@ -104,7 +104,7 @@ export function searchEntries(searchTerm, searchCollections, page = 0) {
|
|
|
104
104
|
const integration = selectIntegration(state, collections[0], 'search');
|
|
105
105
|
|
|
106
106
|
// avoid duplicate searches
|
|
107
|
-
if (search.isFetching && search.term === searchTerm &&
|
|
107
|
+
if (search.isFetching && search.term === searchTerm && isEqual(allCollections, search.collections) && (
|
|
108
108
|
// if an integration doesn't exist, 'page' is not used
|
|
109
109
|
search.page === page || !integration)) {
|
|
110
110
|
return;
|
|
@@ -35,10 +35,7 @@ export function checkBackendStatus() {
|
|
|
35
35
|
const backend = currentBackend(state.config);
|
|
36
36
|
const status = await backend.status();
|
|
37
37
|
const backendDownKey = 'ui.toast.onBackendDown';
|
|
38
|
-
const previousBackendDownNotifications = state.notifications.notifications.filter(n =>
|
|
39
|
-
var _n$message;
|
|
40
|
-
return typeof n.message != 'string' && ((_n$message = n.message) === null || _n$message === void 0 ? void 0 : _n$message.key) === backendDownKey;
|
|
41
|
-
});
|
|
38
|
+
const previousBackendDownNotifications = state.notifications.notifications.filter(n => typeof n.message != 'string' && n.message?.key === backendDownKey);
|
|
42
39
|
if (status.api.status === false) {
|
|
43
40
|
if (previousBackendDownNotifications.length === 0) {
|
|
44
41
|
dispatch(addNotification({
|
|
@@ -59,10 +56,7 @@ export function checkBackendStatus() {
|
|
|
59
56
|
const authError = status.auth.status === false;
|
|
60
57
|
if (authError) {
|
|
61
58
|
const key = 'ui.toast.onLoggedOut';
|
|
62
|
-
const existingNotification = state.notifications.notifications.find(n =>
|
|
63
|
-
var _n$message2;
|
|
64
|
-
return typeof n.message != 'string' && ((_n$message2 = n.message) === null || _n$message2 === void 0 ? void 0 : _n$message2.key) === key;
|
|
65
|
-
});
|
|
59
|
+
const existingNotification = state.notifications.notifications.find(n => typeof n.message != 'string' && n.message?.key === key);
|
|
66
60
|
if (!existingNotification) {
|
|
67
61
|
dispatch(addNotification({
|
|
68
62
|
message: {
|