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
|
@@ -2,7 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
4
4
|
import { connect } from 'react-redux';
|
|
5
|
-
import
|
|
5
|
+
import orderBy from 'lodash/orderBy';
|
|
6
|
+
import map from 'lodash/map';
|
|
6
7
|
import { translate } from 'react-polyglot';
|
|
7
8
|
import fuzzy from 'fuzzy';
|
|
8
9
|
import { fileExtension } from 'decap-cms-lib-util';
|
|
@@ -77,6 +78,9 @@ class MediaLibrary extends React.Component {
|
|
|
77
78
|
};
|
|
78
79
|
|
|
79
80
|
componentDidMount() {
|
|
81
|
+
// Manually validate PropTypes - React 19 breaking change
|
|
82
|
+
PropTypes.checkPropTypes(MediaLibrary.propTypes, this.props, 'prop', 'MediaLibrary');
|
|
83
|
+
|
|
80
84
|
this.props.loadMedia();
|
|
81
85
|
}
|
|
82
86
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import { Map } from 'immutable';
|
|
5
|
-
import
|
|
5
|
+
import isEmpty from 'lodash/isEmpty';
|
|
6
6
|
import { translate } from 'react-polyglot';
|
|
7
7
|
import { colors } from 'decap-cms-ui-default';
|
|
8
8
|
|
|
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { translate } from 'react-polyglot';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
5
|
import yaml from 'yaml';
|
|
6
|
-
import
|
|
6
|
+
import truncate from 'lodash/truncate';
|
|
7
7
|
import copyToClipboard from 'copy-text-to-clipboard';
|
|
8
8
|
import { localForage } from 'decap-cms-lib-util';
|
|
9
9
|
import { buttons, colors } from 'decap-cms-ui-default';
|
|
@@ -150,6 +150,11 @@ export class ErrorBoundary extends React.Component {
|
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
componentDidMount() {
|
|
154
|
+
// Manually validate PropTypes - React 19 breaking change
|
|
155
|
+
PropTypes.checkPropTypes(ErrorBoundary.propTypes, this.props, 'prop', 'ErrorBoundary');
|
|
156
|
+
}
|
|
157
|
+
|
|
153
158
|
shouldComponentUpdate(nextProps, nextState) {
|
|
154
159
|
if (this.props.showBackup) {
|
|
155
160
|
return (
|
|
@@ -63,6 +63,9 @@ export class Modal extends React.Component {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
componentDidMount() {
|
|
66
|
+
// Manually validate PropTypes - React 19 breaking change
|
|
67
|
+
PropTypes.checkPropTypes(Modal.propTypes, this.props, 'prop', 'Modal');
|
|
68
|
+
|
|
66
69
|
ReactModal.setAppElement('#nc-root');
|
|
67
70
|
}
|
|
68
71
|
|
|
@@ -67,6 +67,9 @@ class Workflow extends Component {
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
componentDidMount() {
|
|
70
|
+
// Manually validate PropTypes - React 19 breaking change
|
|
71
|
+
PropTypes.checkPropTypes(Workflow.propTypes, this.props, 'prop', 'Workflow');
|
|
72
|
+
|
|
70
73
|
const { loadUnpublishedEntries, isEditorialWorkflow, collections } = this.props;
|
|
71
74
|
if (isEditorialWorkflow) {
|
|
72
75
|
loadUnpublishedEntries(collections);
|
|
@@ -139,6 +139,11 @@ class WorkflowList extends React.Component {
|
|
|
139
139
|
collections: ImmutablePropTypes.map.isRequired,
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
+
componentDidMount() {
|
|
143
|
+
// Manually validate PropTypes - React 19 breaking change
|
|
144
|
+
PropTypes.checkPropTypes(WorkflowList.propTypes, this.props, 'prop', 'WorkflowList');
|
|
145
|
+
}
|
|
146
|
+
|
|
142
147
|
handleChangeStatus = (newStatus, dragProps) => {
|
|
143
148
|
const slug = dragProps.slug;
|
|
144
149
|
const collection = dragProps.collection;
|
package/src/formats/formats.ts
CHANGED
package/src/formats/toml.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import parseToml from '@iarna/toml/parse-string';
|
|
2
2
|
import tomlify from 'tomlify-j0.4';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
|
|
@@ -24,7 +24,7 @@ function outputReplacer(_key: string, value: unknown) {
|
|
|
24
24
|
|
|
25
25
|
export default {
|
|
26
26
|
fromFile(content: string) {
|
|
27
|
-
return
|
|
27
|
+
return parseToml(content);
|
|
28
28
|
},
|
|
29
29
|
|
|
30
30
|
toFile(data: object, sortedKeys: string[] = []) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import flatten from 'lodash/flatten';
|
|
2
2
|
import { unsentRequest } from 'decap-cms-lib-util';
|
|
3
3
|
|
|
4
4
|
import { createEntry } from '../../../valueObjects/Entry';
|
|
@@ -97,7 +97,7 @@ export default class Algolia {
|
|
|
97
97
|
}),
|
|
98
98
|
);
|
|
99
99
|
|
|
100
|
-
return { entries:
|
|
100
|
+
return { entries: flatten(entries), pagination: page };
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
|
package/src/lib/formatters.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import flow from 'lodash/flow';
|
|
2
|
+
import partialRight from 'lodash/partialRight';
|
|
3
|
+
import trimEnd from 'lodash/trimEnd';
|
|
4
|
+
import trimStart from 'lodash/trimStart';
|
|
2
5
|
import { stringTemplate } from 'decap-cms-lib-widgets';
|
|
3
6
|
import { stripIndent } from 'common-tags';
|
|
4
7
|
|
package/src/lib/i18n.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Map, List } from 'immutable';
|
|
2
|
-
import
|
|
2
|
+
import set from 'lodash/set';
|
|
3
|
+
import groupBy from 'lodash/groupBy';
|
|
4
|
+
import escapeRegExp from 'lodash/escapeRegExp';
|
|
3
5
|
|
|
4
6
|
import { selectEntrySlug } from '../reducers/collections';
|
|
5
7
|
|
package/src/lib/phrases.js
CHANGED
package/src/lib/stega.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { vercelStegaEncode } from '@vercel/stega';
|
|
2
|
+
|
|
3
|
+
import { isImmutableMap, isImmutableList } from '../types/immutable';
|
|
4
|
+
|
|
5
|
+
import type { Map as ImmutableMap, List } from 'immutable';
|
|
6
|
+
import type { CmsField } from 'decap-cms-core';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Context passed to encode functions, containing the current state of the encoding process
|
|
10
|
+
*/
|
|
11
|
+
interface EncodeContext {
|
|
12
|
+
fields: CmsField[]; // Available CMS fields at current level
|
|
13
|
+
path: string; // Path to current value in object tree
|
|
14
|
+
visit: (value: unknown, fields: CmsField[], path: string) => unknown; // Visitor for recursive traversal
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get the fields that should be used for encoding nested values
|
|
19
|
+
*/
|
|
20
|
+
function getNestedFields(f?: CmsField): CmsField[] {
|
|
21
|
+
if (f) {
|
|
22
|
+
if ('types' in f) {
|
|
23
|
+
return f.types ?? [];
|
|
24
|
+
}
|
|
25
|
+
if ('fields' in f) {
|
|
26
|
+
return f.fields ?? [];
|
|
27
|
+
}
|
|
28
|
+
if ('field' in f) {
|
|
29
|
+
return f.field ? [f.field] : [];
|
|
30
|
+
}
|
|
31
|
+
return [f];
|
|
32
|
+
}
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Encode a string value by appending steganographic data
|
|
38
|
+
* For markdown fields, encode each paragraph separately
|
|
39
|
+
*/
|
|
40
|
+
function encodeString(value: string, { fields, path }: EncodeContext): string {
|
|
41
|
+
const [field] = fields;
|
|
42
|
+
if (!field) return value;
|
|
43
|
+
const { widget } = field;
|
|
44
|
+
if (widget === 'string' || widget === 'text') {
|
|
45
|
+
if ('visualEditing' in field && field.visualEditing === false) return value;
|
|
46
|
+
const stega = vercelStegaEncode({ decap: path });
|
|
47
|
+
return value + stega;
|
|
48
|
+
}
|
|
49
|
+
if (widget === 'markdown') {
|
|
50
|
+
const stega = vercelStegaEncode({ decap: path });
|
|
51
|
+
const blocks = value.split(/(\n\n+)/);
|
|
52
|
+
return blocks.map(block => (block.trim() ? block + stega : block)).join('');
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Encode a list of values, handling both simple values and nested objects/lists
|
|
59
|
+
* For typed lists, use the type field to determine which fields to use
|
|
60
|
+
*/
|
|
61
|
+
function encodeList(list: List<unknown>, ctx: EncodeContext): List<unknown> {
|
|
62
|
+
let newList = list;
|
|
63
|
+
for (let i = 0; i < newList.size; i++) {
|
|
64
|
+
const item = newList.get(i);
|
|
65
|
+
if (isImmutableMap(item)) {
|
|
66
|
+
const itemType = item.get('type');
|
|
67
|
+
if (typeof itemType === 'string') {
|
|
68
|
+
// For typed items, look up fields based on type
|
|
69
|
+
const field = ctx.fields.find(f => f.name === itemType);
|
|
70
|
+
const newItem = ctx.visit(item, getNestedFields(field), `${ctx.path}.${i}`);
|
|
71
|
+
newList = newList.set(i, newItem);
|
|
72
|
+
} else {
|
|
73
|
+
// For untyped items, use current fields
|
|
74
|
+
const newItem = ctx.visit(item, ctx.fields, `${ctx.path}.${i}`);
|
|
75
|
+
newList = newList.set(i, newItem);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
// For simple values, use first field if available
|
|
79
|
+
const field = ctx.fields[0];
|
|
80
|
+
const newItem = ctx.visit(item, field ? [field] : [], `${ctx.path}.${i}`);
|
|
81
|
+
if (newItem !== item) {
|
|
82
|
+
newList = newList.set(i, newItem);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return newList;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Encode a map of values, looking up the appropriate field for each key
|
|
91
|
+
* and recursively encoding nested values
|
|
92
|
+
*/
|
|
93
|
+
function encodeMap(
|
|
94
|
+
map: ImmutableMap<string, unknown>,
|
|
95
|
+
ctx: EncodeContext,
|
|
96
|
+
): ImmutableMap<string, unknown> {
|
|
97
|
+
let newMap = map;
|
|
98
|
+
for (const [key, val] of newMap.entrySeq().toArray()) {
|
|
99
|
+
const field = ctx.fields.find(f => f.name === key);
|
|
100
|
+
if (field) {
|
|
101
|
+
const fields = getNestedFields(field);
|
|
102
|
+
const newVal = ctx.visit(val, fields, ctx.path ? `${ctx.path}.${key}` : key);
|
|
103
|
+
if (newVal !== val) {
|
|
104
|
+
newMap = newMap.set(key, newVal);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return newMap;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Cache for encoded values to prevent re-encoding unchanged values
|
|
113
|
+
* across keystrokes. The cache is keyed by path.
|
|
114
|
+
*/
|
|
115
|
+
const encodingCache = new Map();
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Main entry point for encoding steganographic data into entry values
|
|
119
|
+
* Uses a visitor pattern with caching to handle recursive structures
|
|
120
|
+
*/
|
|
121
|
+
export function encodeEntry(value: unknown, fields: List<ImmutableMap<string, unknown>>) {
|
|
122
|
+
const plainFields = fields.toJS() as CmsField[];
|
|
123
|
+
|
|
124
|
+
function visit(value: unknown, fields: CmsField[], path = '') {
|
|
125
|
+
const cached = encodingCache.get(path);
|
|
126
|
+
if (cached === value) return value;
|
|
127
|
+
|
|
128
|
+
const ctx: EncodeContext = { fields, path, visit };
|
|
129
|
+
let result;
|
|
130
|
+
if (isImmutableList(value)) {
|
|
131
|
+
result = encodeList(value, ctx);
|
|
132
|
+
} else if (isImmutableMap(value)) {
|
|
133
|
+
result = encodeMap(value, ctx);
|
|
134
|
+
} else if (typeof value === 'string') {
|
|
135
|
+
result = encodeString(value, ctx);
|
|
136
|
+
} else {
|
|
137
|
+
result = value;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
encodingCache.set(path, result);
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return visit(value, plainFields);
|
|
145
|
+
}
|
package/src/lib/urlHelper.ts
CHANGED
|
@@ -2,7 +2,10 @@ import url from 'url';
|
|
|
2
2
|
import urlJoin from 'url-join';
|
|
3
3
|
import diacritics from 'diacritics';
|
|
4
4
|
import sanitizeFilename from 'sanitize-filename';
|
|
5
|
-
import
|
|
5
|
+
import isString from 'lodash/isString';
|
|
6
|
+
import escapeRegExp from 'lodash/escapeRegExp';
|
|
7
|
+
import flow from 'lodash/flow';
|
|
8
|
+
import partialRight from 'lodash/partialRight';
|
|
6
9
|
|
|
7
10
|
import type { CmsSlug } from '../types/redux';
|
|
8
11
|
|
package/src/mediaLibrary.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This module is currently concerned only with external media libraries
|
|
3
3
|
* registered via `registerMediaLibrary`.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import once from 'lodash/once';
|
|
6
6
|
|
|
7
7
|
import { getMediaLibrary } from './lib/registry';
|
|
8
8
|
import { store } from './redux';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { List, Set, fromJS, OrderedMap } from 'immutable';
|
|
2
|
-
import
|
|
2
|
+
import get from 'lodash/get';
|
|
3
|
+
import escapeRegExp from 'lodash/escapeRegExp';
|
|
3
4
|
import { stringTemplate } from 'decap-cms-lib-widgets';
|
|
4
5
|
|
|
5
6
|
import consoleError from '../lib/consoleError';
|
package/src/reducers/entries.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { Map, List, fromJS, OrderedMap, Set } from 'immutable';
|
|
2
2
|
import { dirname, join } from 'path';
|
|
3
3
|
import { isAbsolutePath, basename } from 'decap-cms-lib-util';
|
|
4
|
-
import
|
|
4
|
+
import trim from 'lodash/trim';
|
|
5
|
+
import once from 'lodash/once';
|
|
6
|
+
import sortBy from 'lodash/sortBy';
|
|
7
|
+
import set from 'lodash/set';
|
|
8
|
+
import orderBy from 'lodash/orderBy';
|
|
9
|
+
import groupBy from 'lodash/groupBy';
|
|
5
10
|
import { stringTemplate } from 'decap-cms-lib-widgets';
|
|
6
11
|
|
|
7
12
|
import { SortDirection } from '../types/redux';
|
package/src/types/immutable.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import { Map as ImmutableMap, List } from 'immutable';
|
|
2
|
+
|
|
3
|
+
export function isImmutableMap(value: unknown): value is ImmutableMap<string, unknown> {
|
|
4
|
+
return ImmutableMap.isMap(value);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function isImmutableList(value: unknown): value is List<unknown> {
|
|
8
|
+
return List.isList(value);
|
|
9
|
+
}
|
|
10
|
+
|
|
1
11
|
export interface StaticallyTypedRecord<T> {
|
|
2
12
|
get<K extends keyof T>(key: K, defaultValue?: T[K]): T[K];
|
|
3
13
|
set<K extends keyof T, V extends T[K]>(key: K, value: V): StaticallyTypedRecord<T> & T;
|
package/src/types/redux.ts
CHANGED
|
@@ -248,6 +248,7 @@ export interface CmsFieldStringOrText {
|
|
|
248
248
|
// This is the default widget, so declaring its type is optional.
|
|
249
249
|
widget?: 'string' | 'text';
|
|
250
250
|
default?: string;
|
|
251
|
+
visualEditing?: boolean;
|
|
251
252
|
}
|
|
252
253
|
|
|
253
254
|
export interface CmsFieldMeta {
|
|
@@ -322,6 +323,7 @@ export interface CmsCollection {
|
|
|
322
323
|
delete?: boolean;
|
|
323
324
|
editor?: {
|
|
324
325
|
preview?: boolean;
|
|
326
|
+
visualEditing?: boolean;
|
|
325
327
|
};
|
|
326
328
|
publish?: boolean;
|
|
327
329
|
nested?: {
|