@evfrenkel/decap-cms-core 3.13.0-image-conversions.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/README.md +9 -0
- package/dist/20.decap-cms-core.js +2 -0
- package/dist/20.decap-cms-core.js.map +1 -0
- package/dist/3802306e7b58a11862fb.wasm +0 -0
- package/dist/@evfrenkel/20.decap-cms-core.js +2 -0
- package/dist/@evfrenkel/20.decap-cms-core.js.map +1 -0
- package/dist/@evfrenkel/decap-cms-core.js +44 -0
- package/dist/@evfrenkel/decap-cms-core.js.LICENSE.txt +126 -0
- package/dist/@evfrenkel/decap-cms-core.js.map +1 -0
- package/dist/decap-cms-core.js +47 -0
- package/dist/decap-cms-core.js.LICENSE.txt +126 -0
- package/dist/decap-cms-core.js.map +1 -0
- package/dist/esm/actions/auth.js +97 -0
- package/dist/esm/actions/collections.js +15 -0
- package/dist/esm/actions/config.js +503 -0
- package/dist/esm/actions/deploys.js +80 -0
- package/dist/esm/actions/editorialWorkflow.js +480 -0
- package/dist/esm/actions/entries.js +876 -0
- package/dist/esm/actions/media.js +147 -0
- package/dist/esm/actions/mediaLibrary.js +599 -0
- package/dist/esm/actions/notifications.js +21 -0
- package/dist/esm/actions/search.js +149 -0
- package/dist/esm/actions/status.js +74 -0
- package/dist/esm/actions/waitUntil.js +32 -0
- package/dist/esm/backend.js +1090 -0
- package/dist/esm/bootstrap.js +101 -0
- package/dist/esm/components/App/App.js +296 -0
- package/dist/esm/components/App/Header.js +172 -0
- package/dist/esm/components/App/NotFoundPage.js +19 -0
- package/dist/esm/components/Collection/Collection.js +198 -0
- package/dist/esm/components/Collection/CollectionControls.js +47 -0
- package/dist/esm/components/Collection/CollectionSearch.js +222 -0
- package/dist/esm/components/Collection/CollectionTop.js +68 -0
- package/dist/esm/components/Collection/ControlButton.js +17 -0
- package/dist/esm/components/Collection/Entries/Entries.js +73 -0
- package/dist/esm/components/Collection/Entries/EntriesCollection.js +241 -0
- package/dist/esm/components/Collection/Entries/EntriesSearch.js +113 -0
- package/dist/esm/components/Collection/Entries/EntryCard.js +192 -0
- package/dist/esm/components/Collection/Entries/EntryListing.js +143 -0
- package/dist/esm/components/Collection/FilterControl.js +33 -0
- package/dist/esm/components/Collection/GroupControl.js +33 -0
- package/dist/esm/components/Collection/NestedCollection.js +308 -0
- package/dist/esm/components/Collection/Sidebar.js +91 -0
- package/dist/esm/components/Collection/SortControl.js +59 -0
- package/dist/esm/components/Collection/ViewStyleControl.js +41 -0
- package/dist/esm/components/Editor/Editor.js +466 -0
- package/dist/esm/components/Editor/EditorControlPane/EditorControl.js +398 -0
- package/dist/esm/components/Editor/EditorControlPane/EditorControlPane.js +254 -0
- package/dist/esm/components/Editor/EditorControlPane/Widget.js +374 -0
- package/dist/esm/components/Editor/EditorInterface.js +386 -0
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreview.js +47 -0
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreviewContent.js +67 -0
- package/dist/esm/components/Editor/EditorPreviewPane/EditorPreviewPane.js +306 -0
- package/dist/esm/components/Editor/EditorPreviewPane/PreviewHOC.js +27 -0
- package/dist/esm/components/Editor/EditorToolbar.js +554 -0
- package/dist/esm/components/Editor/withWorkflow.js +56 -0
- package/dist/esm/components/EditorWidgets/Unknown/UnknownControl.js +18 -0
- package/dist/esm/components/EditorWidgets/Unknown/UnknownPreview.js +20 -0
- package/dist/esm/components/EditorWidgets/index.js +4 -0
- package/dist/esm/components/MediaLibrary/EmptyMessage.js +22 -0
- package/dist/esm/components/MediaLibrary/MediaLibrary.js +446 -0
- package/dist/esm/components/MediaLibrary/MediaLibraryButtons.js +92 -0
- package/dist/esm/components/MediaLibrary/MediaLibraryCard.js +99 -0
- package/dist/esm/components/MediaLibrary/MediaLibraryCardGrid.js +198 -0
- package/dist/esm/components/MediaLibrary/MediaLibraryHeader.js +34 -0
- package/dist/esm/components/MediaLibrary/MediaLibraryModal.js +156 -0
- package/dist/esm/components/MediaLibrary/MediaLibrarySearch.js +51 -0
- package/dist/esm/components/MediaLibrary/MediaLibraryTop.js +124 -0
- package/dist/esm/components/UI/DragDrop.js +67 -0
- package/dist/esm/components/UI/ErrorBoundary.js +170 -0
- package/dist/esm/components/UI/FileUploadButton.js +27 -0
- package/dist/esm/components/UI/Modal.js +104 -0
- package/dist/esm/components/UI/Notifications.js +62 -0
- package/dist/esm/components/UI/SettingsDropdown.js +107 -0
- package/dist/esm/components/UI/index.js +6 -0
- package/dist/esm/components/Workflow/Workflow.js +133 -0
- package/dist/esm/components/Workflow/WorkflowCard.js +128 -0
- package/dist/esm/components/Workflow/WorkflowList.js +204 -0
- package/dist/esm/constants/collectionTypes.js +2 -0
- package/dist/esm/constants/collectionViews.js +2 -0
- package/dist/esm/constants/commitProps.js +2 -0
- package/dist/esm/constants/configSchema.js +695 -0
- package/dist/esm/constants/fieldInference.js +57 -0
- package/dist/esm/constants/publishModes.js +18 -0
- package/dist/esm/constants/validationErrorTypes.js +6 -0
- package/dist/esm/formats/formats.js +83 -0
- package/dist/esm/formats/frontmatter.js +146 -0
- package/dist/esm/formats/helpers.js +12 -0
- package/dist/esm/formats/json.js +8 -0
- package/dist/esm/formats/toml.js +32 -0
- package/dist/esm/formats/yaml.js +60 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/integrations/index.js +28 -0
- package/dist/esm/integrations/providers/algolia/implementation.js +174 -0
- package/dist/esm/integrations/providers/assetStore/implementation.js +165 -0
- package/dist/esm/lib/consoleError.js +3 -0
- package/dist/esm/lib/formatters.js +201 -0
- package/dist/esm/lib/i18n.js +372 -0
- package/dist/esm/lib/imageTransformations.js +143 -0
- package/dist/esm/lib/phrases.js +6 -0
- package/dist/esm/lib/polyfill.js +8 -0
- package/dist/esm/lib/registry.js +332 -0
- package/dist/esm/lib/serializeEntryValues.js +67 -0
- package/dist/esm/lib/stega.js +142 -0
- package/dist/esm/lib/textHelper.js +9 -0
- package/dist/esm/lib/urlHelper.js +129 -0
- package/dist/esm/mediaLibrary.js +37 -0
- package/dist/esm/reducers/auth.js +27 -0
- package/dist/esm/reducers/collections.js +428 -0
- package/dist/esm/reducers/combinedReducer.js +8 -0
- package/dist/esm/reducers/config.js +29 -0
- package/dist/esm/reducers/cursors.js +31 -0
- package/dist/esm/reducers/deploys.js +50 -0
- package/dist/esm/reducers/editorialWorkflow.js +83 -0
- package/dist/esm/reducers/entries.js +568 -0
- package/dist/esm/reducers/entryDraft.js +211 -0
- package/dist/esm/reducers/globalUI.js +25 -0
- package/dist/esm/reducers/index.js +66 -0
- package/dist/esm/reducers/integrations.js +53 -0
- package/dist/esm/reducers/mediaLibrary.js +252 -0
- package/dist/esm/reducers/medias.js +68 -0
- package/dist/esm/reducers/notifications.js +23 -0
- package/dist/esm/reducers/search.js +92 -0
- package/dist/esm/reducers/status.js +30 -0
- package/dist/esm/redux/index.js +7 -0
- package/dist/esm/redux/middleware/waitUntilAction.js +48 -0
- package/dist/esm/routing/history.js +12 -0
- package/dist/esm/types/diacritics.d.js +0 -0
- package/dist/esm/types/global.d.js +1 -0
- package/dist/esm/types/immutable.js +7 -0
- package/dist/esm/types/redux.js +14 -0
- package/dist/esm/types/tomlify-j0.4.d.js +0 -0
- package/dist/esm/valueObjects/AssetProxy.js +44 -0
- package/dist/esm/valueObjects/EditorComponent.js +34 -0
- package/dist/esm/valueObjects/Entry.js +20 -0
- package/index.d.ts +662 -0
- package/package.json +100 -0
- package/src/__tests__/backend.spec.js +1223 -0
- package/src/actions/__tests__/config.spec.js +1023 -0
- package/src/actions/__tests__/editorialWorkflow.spec.js +216 -0
- package/src/actions/__tests__/entries.spec.js +610 -0
- package/src/actions/__tests__/media.spec.ts +171 -0
- package/src/actions/__tests__/mediaLibrary.spec.js +462 -0
- package/src/actions/__tests__/search.spec.js +209 -0
- package/src/actions/auth.ts +127 -0
- package/src/actions/collections.ts +18 -0
- package/src/actions/config.ts +574 -0
- package/src/actions/deploys.ts +105 -0
- package/src/actions/editorialWorkflow.ts +567 -0
- package/src/actions/entries.ts +1070 -0
- package/src/actions/media.ts +139 -0
- package/src/actions/mediaLibrary.ts +639 -0
- package/src/actions/notifications.ts +36 -0
- package/src/actions/search.ts +221 -0
- package/src/actions/status.ts +99 -0
- package/src/actions/waitUntil.ts +49 -0
- package/src/backend.ts +1411 -0
- package/src/bootstrap.js +104 -0
- package/src/components/App/App.js +295 -0
- package/src/components/App/Header.js +291 -0
- package/src/components/App/NotFoundPage.js +23 -0
- package/src/components/Collection/Collection.js +210 -0
- package/src/components/Collection/CollectionControls.js +58 -0
- package/src/components/Collection/CollectionSearch.js +243 -0
- package/src/components/Collection/CollectionTop.js +81 -0
- package/src/components/Collection/ControlButton.js +27 -0
- package/src/components/Collection/Entries/Entries.js +82 -0
- package/src/components/Collection/Entries/EntriesCollection.js +277 -0
- package/src/components/Collection/Entries/EntriesSearch.js +102 -0
- package/src/components/Collection/Entries/EntryCard.js +256 -0
- package/src/components/Collection/Entries/EntryListing.js +151 -0
- package/src/components/Collection/Entries/__tests__/EntriesCollection.spec.js +163 -0
- package/src/components/Collection/Entries/__tests__/__snapshots__/EntriesCollection.spec.js.snap +46 -0
- package/src/components/Collection/FilterControl.js +39 -0
- package/src/components/Collection/GroupControl.js +39 -0
- package/src/components/Collection/NestedCollection.js +330 -0
- package/src/components/Collection/Sidebar.js +136 -0
- package/src/components/Collection/SortControl.js +68 -0
- package/src/components/Collection/ViewStyleControl.js +52 -0
- package/src/components/Collection/__tests__/Collection.spec.js +75 -0
- package/src/components/Collection/__tests__/NestedCollection.spec.js +445 -0
- package/src/components/Collection/__tests__/Sidebar.spec.js +87 -0
- package/src/components/Collection/__tests__/__snapshots__/Collection.spec.js.snap +144 -0
- package/src/components/Collection/__tests__/__snapshots__/NestedCollection.spec.js.snap +550 -0
- package/src/components/Collection/__tests__/__snapshots__/Sidebar.spec.js.snap +312 -0
- package/src/components/Editor/Editor.js +497 -0
- package/src/components/Editor/EditorControlPane/EditorControl.js +453 -0
- package/src/components/Editor/EditorControlPane/EditorControlPane.js +269 -0
- package/src/components/Editor/EditorControlPane/Widget.js +384 -0
- package/src/components/Editor/EditorInterface.js +444 -0
- package/src/components/Editor/EditorPreviewPane/EditorPreview.js +40 -0
- package/src/components/Editor/EditorPreviewPane/EditorPreviewContent.js +75 -0
- package/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js +337 -0
- package/src/components/Editor/EditorPreviewPane/PreviewHOC.js +33 -0
- package/src/components/Editor/EditorToolbar.js +728 -0
- package/src/components/Editor/__tests__/Editor.spec.js +221 -0
- package/src/components/Editor/__tests__/EditorToolbar.spec.js +166 -0
- package/src/components/Editor/__tests__/__snapshots__/Editor.spec.js.snap +45 -0
- package/src/components/Editor/__tests__/__snapshots__/EditorToolbar.spec.js.snap +4265 -0
- package/src/components/Editor/withWorkflow.js +61 -0
- package/src/components/EditorWidgets/Unknown/UnknownControl.js +17 -0
- package/src/components/EditorWidgets/Unknown/UnknownPreview.js +19 -0
- package/src/components/EditorWidgets/index.js +5 -0
- package/src/components/MediaLibrary/EmptyMessage.js +28 -0
- package/src/components/MediaLibrary/MediaLibrary.js +411 -0
- package/src/components/MediaLibrary/MediaLibraryButtons.js +135 -0
- package/src/components/MediaLibrary/MediaLibraryCard.js +128 -0
- package/src/components/MediaLibrary/MediaLibraryCardGrid.js +199 -0
- package/src/components/MediaLibrary/MediaLibraryHeader.js +48 -0
- package/src/components/MediaLibrary/MediaLibraryModal.js +200 -0
- package/src/components/MediaLibrary/MediaLibrarySearch.js +61 -0
- package/src/components/MediaLibrary/MediaLibraryTop.js +144 -0
- package/src/components/MediaLibrary/__tests__/MediaLibraryButtons.spec.js +45 -0
- package/src/components/MediaLibrary/__tests__/MediaLibraryCard.spec.js +49 -0
- package/src/components/MediaLibrary/__tests__/__snapshots__/MediaLibraryCard.spec.js.snap +264 -0
- package/src/components/UI/DragDrop.js +66 -0
- package/src/components/UI/ErrorBoundary.js +213 -0
- package/src/components/UI/FileUploadButton.js +24 -0
- package/src/components/UI/Modal.js +112 -0
- package/src/components/UI/Notifications.tsx +83 -0
- package/src/components/UI/SettingsDropdown.js +130 -0
- package/src/components/UI/__tests__/ErrorBoundary.spec.js +57 -0
- package/src/components/UI/index.js +6 -0
- package/src/components/Workflow/Workflow.js +169 -0
- package/src/components/Workflow/WorkflowCard.js +177 -0
- package/src/components/Workflow/WorkflowList.js +272 -0
- package/src/constants/__tests__/configSchema.spec.js +644 -0
- package/src/constants/collectionTypes.ts +2 -0
- package/src/constants/collectionViews.js +2 -0
- package/src/constants/commitProps.ts +2 -0
- package/src/constants/configSchema.js +489 -0
- package/src/constants/fieldInference.tsx +78 -0
- package/src/constants/publishModes.ts +22 -0
- package/src/constants/validationErrorTypes.js +6 -0
- package/src/formats/__tests__/formats.spec.js +87 -0
- package/src/formats/__tests__/frontmatter.spec.js +450 -0
- package/src/formats/__tests__/toml.spec.js +9 -0
- package/src/formats/__tests__/yaml.spec.js +189 -0
- package/src/formats/formats.ts +97 -0
- package/src/formats/frontmatter.ts +150 -0
- package/src/formats/helpers.ts +14 -0
- package/src/formats/json.ts +9 -0
- package/src/formats/toml.ts +33 -0
- package/src/formats/yaml.ts +73 -0
- package/src/index.js +8 -0
- package/src/integrations/index.js +35 -0
- package/src/integrations/providers/algolia/implementation.js +176 -0
- package/src/integrations/providers/assetStore/implementation.js +148 -0
- package/src/lib/__tests__/formatters.spec.js +844 -0
- package/src/lib/__tests__/i18n.spec.js +792 -0
- package/src/lib/__tests__/imageTransformations.spec.ts +97 -0
- package/src/lib/__tests__/phrases.spec.js +119 -0
- package/src/lib/__tests__/registry.spec.js +261 -0
- package/src/lib/__tests__/serializeEntryValues.spec.js +22 -0
- package/src/lib/__tests__/urlHelper.spec.js +145 -0
- package/src/lib/consoleError.js +7 -0
- package/src/lib/formatters.ts +297 -0
- package/src/lib/i18n.ts +462 -0
- package/src/lib/imageTransformations.ts +212 -0
- package/src/lib/phrases.js +8 -0
- package/src/lib/polyfill.js +9 -0
- package/src/lib/registry.js +315 -0
- package/src/lib/serializeEntryValues.js +75 -0
- package/src/lib/stega.ts +145 -0
- package/src/lib/textHelper.js +11 -0
- package/src/lib/urlHelper.ts +152 -0
- package/src/mediaLibrary.ts +51 -0
- package/src/reducers/__tests__/auth.spec.ts +38 -0
- package/src/reducers/__tests__/collections.spec.js +610 -0
- package/src/reducers/__tests__/config.spec.js +38 -0
- package/src/reducers/__tests__/deploys.spec.ts +111 -0
- package/src/reducers/__tests__/entries.spec.js +694 -0
- package/src/reducers/__tests__/entryDraft.spec.js +315 -0
- package/src/reducers/__tests__/globalUI.js +43 -0
- package/src/reducers/__tests__/integrations.spec.ts +76 -0
- package/src/reducers/__tests__/mediaLibrary.spec.js +154 -0
- package/src/reducers/__tests__/medias.spec.ts +49 -0
- package/src/reducers/auth.ts +46 -0
- package/src/reducers/collections.ts +535 -0
- package/src/reducers/combinedReducer.ts +11 -0
- package/src/reducers/config.ts +38 -0
- package/src/reducers/cursors.js +36 -0
- package/src/reducers/deploys.ts +54 -0
- package/src/reducers/editorialWorkflow.ts +163 -0
- package/src/reducers/entries.ts +819 -0
- package/src/reducers/entryDraft.js +259 -0
- package/src/reducers/globalUI.ts +45 -0
- package/src/reducers/index.ts +82 -0
- package/src/reducers/integrations.ts +59 -0
- package/src/reducers/mediaLibrary.ts +296 -0
- package/src/reducers/medias.ts +66 -0
- package/src/reducers/notifications.ts +52 -0
- package/src/reducers/search.ts +111 -0
- package/src/reducers/status.ts +40 -0
- package/src/redux/index.ts +18 -0
- package/src/redux/middleware/waitUntilAction.ts +64 -0
- package/src/routing/__tests__/history.spec.ts +49 -0
- package/src/routing/history.ts +17 -0
- package/src/types/diacritics.d.ts +1 -0
- package/src/types/global.d.ts +8 -0
- package/src/types/immutable.ts +49 -0
- package/src/types/redux.ts +875 -0
- package/src/types/tomlify-j0.4.d.ts +13 -0
- package/src/valueObjects/AssetProxy.ts +48 -0
- package/src/valueObjects/EditorComponent.js +38 -0
- package/src/valueObjects/Entry.ts +63 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { connect } from 'react-redux';
|
|
3
|
+
import { EDITORIAL_WORKFLOW } from '../../constants/publishModes';
|
|
4
|
+
import { selectUnpublishedEntry } from '../../reducers';
|
|
5
|
+
import { selectAllowDeletion } from '../../reducers/collections';
|
|
6
|
+
import { loadUnpublishedEntry, persistUnpublishedEntry } from '../../actions/editorialWorkflow';
|
|
7
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
8
|
+
function mapStateToProps(state, ownProps) {
|
|
9
|
+
const {
|
|
10
|
+
collections
|
|
11
|
+
} = state;
|
|
12
|
+
const isEditorialWorkflow = state.config.publish_mode === EDITORIAL_WORKFLOW;
|
|
13
|
+
const collection = collections.get(ownProps.match.params.name);
|
|
14
|
+
const returnObj = {
|
|
15
|
+
isEditorialWorkflow,
|
|
16
|
+
showDelete: !ownProps.newEntry && selectAllowDeletion(collection)
|
|
17
|
+
};
|
|
18
|
+
if (isEditorialWorkflow) {
|
|
19
|
+
const slug = ownProps.match.params[0];
|
|
20
|
+
const unpublishedEntry = selectUnpublishedEntry(state, collection.get('name'), slug);
|
|
21
|
+
if (unpublishedEntry) {
|
|
22
|
+
returnObj.unpublishedEntry = true;
|
|
23
|
+
returnObj.entry = unpublishedEntry;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return returnObj;
|
|
27
|
+
}
|
|
28
|
+
function mergeProps(stateProps, dispatchProps, ownProps) {
|
|
29
|
+
const {
|
|
30
|
+
isEditorialWorkflow,
|
|
31
|
+
unpublishedEntry
|
|
32
|
+
} = stateProps;
|
|
33
|
+
const {
|
|
34
|
+
dispatch
|
|
35
|
+
} = dispatchProps;
|
|
36
|
+
const returnObj = {};
|
|
37
|
+
if (isEditorialWorkflow) {
|
|
38
|
+
// Overwrite loadEntry to loadUnpublishedEntry
|
|
39
|
+
returnObj.loadEntry = (collection, slug) => dispatch(loadUnpublishedEntry(collection, slug));
|
|
40
|
+
|
|
41
|
+
// Overwrite persistEntry to persistUnpublishedEntry
|
|
42
|
+
returnObj.persistEntry = collection => dispatch(persistUnpublishedEntry(collection, unpublishedEntry));
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
...ownProps,
|
|
46
|
+
...stateProps,
|
|
47
|
+
...returnObj
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export default function withWorkflow(Editor) {
|
|
51
|
+
return connect(mapStateToProps, null, mergeProps)(class WorkflowEditor extends React.Component {
|
|
52
|
+
render() {
|
|
53
|
+
return ___EmotionJSX(Editor, this.props);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { translate } from 'react-polyglot';
|
|
3
|
+
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
6
|
+
function UnknownControl({
|
|
7
|
+
field,
|
|
8
|
+
t
|
|
9
|
+
}) {
|
|
10
|
+
return ___EmotionJSX("div", null, t('editor.editorWidgets.unknownControl.noControl', {
|
|
11
|
+
widget: field.get('widget')
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
UnknownControl.propTypes = {
|
|
15
|
+
field: ImmutablePropTypes.map,
|
|
16
|
+
t: PropTypes.func.isRequired
|
|
17
|
+
};
|
|
18
|
+
export default translate()(UnknownControl);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { translate } from 'react-polyglot';
|
|
3
|
+
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
6
|
+
function UnknownPreview({
|
|
7
|
+
field,
|
|
8
|
+
t
|
|
9
|
+
}) {
|
|
10
|
+
return ___EmotionJSX("div", {
|
|
11
|
+
className: "nc-widgetPreview"
|
|
12
|
+
}, t('editor.editorWidgets.unknownPreview.noPreview', {
|
|
13
|
+
widget: field.get('widget')
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
UnknownPreview.propTypes = {
|
|
17
|
+
field: ImmutablePropTypes.map,
|
|
18
|
+
t: PropTypes.func.isRequired
|
|
19
|
+
};
|
|
20
|
+
export default translate()(UnknownPreview);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import _styled from "@emotion/styled/base";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { colors } from 'decap-cms-ui-default';
|
|
5
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
6
|
+
const EmptyMessageContainer = /*#__PURE__*/_styled("div", {
|
|
7
|
+
target: "egnwlms0",
|
|
8
|
+
label: "EmptyMessageContainer"
|
|
9
|
+
})("height:100%;width:100%;display:flex;justify-content:center;align-items:center;color:", props => props.isPrivate && colors.textFieldBorder, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL01lZGlhTGlicmFyeS9FbXB0eU1lc3NhZ2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS3dDIiwiZmlsZSI6Ii4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL01lZGlhTGlicmFyeS9FbXB0eU1lc3NhZ2UuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IFByb3BUeXBlcyBmcm9tICdwcm9wLXR5cGVzJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IGNvbG9ycyB9IGZyb20gJ2RlY2FwLWNtcy11aS1kZWZhdWx0JztcblxuY29uc3QgRW1wdHlNZXNzYWdlQ29udGFpbmVyID0gc3R5bGVkLmRpdmBcbiAgaGVpZ2h0OiAxMDAlO1xuICB3aWR0aDogMTAwJTtcbiAgZGlzcGxheTogZmxleDtcbiAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGNvbG9yOiAke3Byb3BzID0+IHByb3BzLmlzUHJpdmF0ZSAmJiBjb2xvcnMudGV4dEZpZWxkQm9yZGVyfTtcbmA7XG5cbmZ1bmN0aW9uIEVtcHR5TWVzc2FnZSh7IGNvbnRlbnQsIGlzUHJpdmF0ZSB9KSB7XG4gIHJldHVybiAoXG4gICAgPEVtcHR5TWVzc2FnZUNvbnRhaW5lciBpc1ByaXZhdGU9e2lzUHJpdmF0ZX0+XG4gICAgICA8aDE+e2NvbnRlbnR9PC9oMT5cbiAgICA8L0VtcHR5TWVzc2FnZUNvbnRhaW5lcj5cbiAgKTtcbn1cblxuRW1wdHlNZXNzYWdlLnByb3BUeXBlcyA9IHtcbiAgY29udGVudDogUHJvcFR5cGVzLnN0cmluZy5pc1JlcXVpcmVkLFxuICBpc1ByaXZhdGU6IFByb3BUeXBlcy5ib29sLFxufTtcblxuZXhwb3J0IGRlZmF1bHQgRW1wdHlNZXNzYWdlO1xuIl19 */"));
|
|
10
|
+
function EmptyMessage({
|
|
11
|
+
content,
|
|
12
|
+
isPrivate
|
|
13
|
+
}) {
|
|
14
|
+
return ___EmotionJSX(EmptyMessageContainer, {
|
|
15
|
+
isPrivate: isPrivate
|
|
16
|
+
}, ___EmotionJSX("h1", null, content));
|
|
17
|
+
}
|
|
18
|
+
EmptyMessage.propTypes = {
|
|
19
|
+
content: PropTypes.string.isRequired,
|
|
20
|
+
isPrivate: PropTypes.bool
|
|
21
|
+
};
|
|
22
|
+
export default EmptyMessage;
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
4
|
+
import { connect } from 'react-redux';
|
|
5
|
+
import orderBy from 'lodash/orderBy';
|
|
6
|
+
import map from 'lodash/map';
|
|
7
|
+
import { translate } from 'react-polyglot';
|
|
8
|
+
import fuzzy from 'fuzzy';
|
|
9
|
+
import { fileExtension } from 'decap-cms-lib-util';
|
|
10
|
+
import { loadMedia as loadMediaAction, persistMedia as persistMediaAction, deleteMedia as deleteMediaAction, insertMedia as insertMediaAction, loadMediaDisplayURL as loadMediaDisplayURLAction, closeMediaLibrary as closeMediaLibraryAction } from '../../actions/mediaLibrary';
|
|
11
|
+
import { selectMediaFiles } from '../../reducers/mediaLibrary';
|
|
12
|
+
import MediaLibraryModal, { fileShape } from './MediaLibraryModal';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Extensions used to determine which files to show when the media library is
|
|
16
|
+
* accessed from an image insertion field.
|
|
17
|
+
*/
|
|
18
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
19
|
+
const IMAGE_EXTENSIONS_VIEWABLE = ['jpg', 'jpeg', 'webp', 'gif', 'png', 'bmp', 'tiff', 'svg', 'avif'];
|
|
20
|
+
const IMAGE_EXTENSIONS = [...IMAGE_EXTENSIONS_VIEWABLE];
|
|
21
|
+
class MediaLibrary extends React.Component {
|
|
22
|
+
static propTypes = {
|
|
23
|
+
isVisible: PropTypes.bool,
|
|
24
|
+
loadMediaDisplayURL: PropTypes.func,
|
|
25
|
+
displayURLs: ImmutablePropTypes.map,
|
|
26
|
+
canInsert: PropTypes.bool,
|
|
27
|
+
files: PropTypes.arrayOf(PropTypes.shape(fileShape)).isRequired,
|
|
28
|
+
dynamicSearch: PropTypes.bool,
|
|
29
|
+
dynamicSearchActive: PropTypes.bool,
|
|
30
|
+
forImage: PropTypes.bool,
|
|
31
|
+
isLoading: PropTypes.bool,
|
|
32
|
+
isPersisting: PropTypes.bool,
|
|
33
|
+
isDeleting: PropTypes.bool,
|
|
34
|
+
hasNextPage: PropTypes.bool,
|
|
35
|
+
isPaginating: PropTypes.bool,
|
|
36
|
+
privateUpload: PropTypes.bool,
|
|
37
|
+
config: ImmutablePropTypes.map,
|
|
38
|
+
loadMedia: PropTypes.func.isRequired,
|
|
39
|
+
dynamicSearchQuery: PropTypes.string,
|
|
40
|
+
page: PropTypes.number,
|
|
41
|
+
persistMedia: PropTypes.func.isRequired,
|
|
42
|
+
deleteMedia: PropTypes.func.isRequired,
|
|
43
|
+
insertMedia: PropTypes.func.isRequired,
|
|
44
|
+
closeMediaLibrary: PropTypes.func.isRequired,
|
|
45
|
+
t: PropTypes.func.isRequired
|
|
46
|
+
};
|
|
47
|
+
static defaultProps = {
|
|
48
|
+
files: []
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The currently selected file and query are tracked in component state as
|
|
53
|
+
* they do not impact the rest of the application.
|
|
54
|
+
*/
|
|
55
|
+
state = {
|
|
56
|
+
selectedFile: {},
|
|
57
|
+
query: '',
|
|
58
|
+
isPersisted: false
|
|
59
|
+
};
|
|
60
|
+
componentDidMount() {
|
|
61
|
+
// Manually validate PropTypes - React 19 breaking change
|
|
62
|
+
PropTypes.checkPropTypes(MediaLibrary.propTypes, this.props, 'prop', 'MediaLibrary');
|
|
63
|
+
this.props.loadMedia();
|
|
64
|
+
}
|
|
65
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
66
|
+
/**
|
|
67
|
+
* We clear old state from the media library when it's being re-opened
|
|
68
|
+
* because, when doing so on close, the state is cleared while the media
|
|
69
|
+
* library is still fading away.
|
|
70
|
+
*/
|
|
71
|
+
const isOpening = !this.props.isVisible && nextProps.isVisible;
|
|
72
|
+
if (isOpening) {
|
|
73
|
+
this.setState({
|
|
74
|
+
selectedFile: {},
|
|
75
|
+
query: ''
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (this.state.isPersisted) {
|
|
79
|
+
this.setState({
|
|
80
|
+
selectedFile: nextProps.files[0],
|
|
81
|
+
isPersisted: false
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
componentDidUpdate(prevProps) {
|
|
86
|
+
const isOpening = !prevProps.isVisible && this.props.isVisible;
|
|
87
|
+
if (isOpening && prevProps.privateUpload !== this.props.privateUpload) {
|
|
88
|
+
this.props.loadMedia({
|
|
89
|
+
privateUpload: this.props.privateUpload
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (this.state.isPersisted) {
|
|
93
|
+
this.setState({
|
|
94
|
+
selectedFile: this.props.files[0],
|
|
95
|
+
isPersisted: false
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
loadDisplayURL = file => {
|
|
100
|
+
const {
|
|
101
|
+
loadMediaDisplayURL
|
|
102
|
+
} = this.props;
|
|
103
|
+
loadMediaDisplayURL(file);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Filter an array of file data to include only images.
|
|
108
|
+
*/
|
|
109
|
+
filterImages = files => {
|
|
110
|
+
return files.filter(file => {
|
|
111
|
+
const ext = fileExtension(file.name).toLowerCase();
|
|
112
|
+
return IMAGE_EXTENSIONS.includes(ext);
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Transform file data for table display.
|
|
118
|
+
*/
|
|
119
|
+
toTableData = files => {
|
|
120
|
+
const tableData = files && files.map(({
|
|
121
|
+
key,
|
|
122
|
+
name,
|
|
123
|
+
id,
|
|
124
|
+
size,
|
|
125
|
+
path,
|
|
126
|
+
queryOrder,
|
|
127
|
+
displayURL,
|
|
128
|
+
draft
|
|
129
|
+
}) => {
|
|
130
|
+
const ext = fileExtension(name).toLowerCase();
|
|
131
|
+
return {
|
|
132
|
+
key,
|
|
133
|
+
id,
|
|
134
|
+
name,
|
|
135
|
+
path,
|
|
136
|
+
type: ext.toUpperCase(),
|
|
137
|
+
size,
|
|
138
|
+
queryOrder,
|
|
139
|
+
displayURL,
|
|
140
|
+
draft,
|
|
141
|
+
isImage: IMAGE_EXTENSIONS.includes(ext),
|
|
142
|
+
isViewableImage: IMAGE_EXTENSIONS_VIEWABLE.includes(ext)
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Get the sort order for use with `lodash.orderBy`, and always add the
|
|
148
|
+
* `queryOrder` sort as the lowest priority sort order.
|
|
149
|
+
*/
|
|
150
|
+
const {
|
|
151
|
+
sortFields
|
|
152
|
+
} = this.state;
|
|
153
|
+
const fieldNames = map(sortFields, 'fieldName').concat('queryOrder');
|
|
154
|
+
const directions = map(sortFields, 'direction').concat('asc');
|
|
155
|
+
return orderBy(tableData, fieldNames, directions);
|
|
156
|
+
};
|
|
157
|
+
handleClose = () => {
|
|
158
|
+
this.props.closeMediaLibrary();
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Toggle asset selection on click.
|
|
163
|
+
*/
|
|
164
|
+
handleAssetClick = asset => {
|
|
165
|
+
const selectedFile = this.state.selectedFile.key === asset.key ? {} : asset;
|
|
166
|
+
this.setState({
|
|
167
|
+
selectedFile
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Upload a file.
|
|
173
|
+
*/
|
|
174
|
+
handlePersist = async event => {
|
|
175
|
+
/**
|
|
176
|
+
* Stop the browser from automatically handling the file input click, and
|
|
177
|
+
* get the file for upload, and retain the synthetic event for access after
|
|
178
|
+
* the asynchronous persist operation.
|
|
179
|
+
*/
|
|
180
|
+
event.persist();
|
|
181
|
+
event.stopPropagation();
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
const {
|
|
184
|
+
persistMedia,
|
|
185
|
+
privateUpload,
|
|
186
|
+
config,
|
|
187
|
+
t,
|
|
188
|
+
field
|
|
189
|
+
} = this.props;
|
|
190
|
+
const {
|
|
191
|
+
files: fileList
|
|
192
|
+
} = event.dataTransfer || event.target;
|
|
193
|
+
const files = [...fileList];
|
|
194
|
+
const file = files[0];
|
|
195
|
+
const maxFileSize = config.get('max_file_size');
|
|
196
|
+
if (maxFileSize && file.size > maxFileSize) {
|
|
197
|
+
window.alert(t('mediaLibrary.mediaLibrary.fileTooLarge', {
|
|
198
|
+
size: Math.floor(maxFileSize / 1000)
|
|
199
|
+
}));
|
|
200
|
+
} else {
|
|
201
|
+
await persistMedia(file, {
|
|
202
|
+
privateUpload,
|
|
203
|
+
field
|
|
204
|
+
});
|
|
205
|
+
this.setState({
|
|
206
|
+
isPersisted: true
|
|
207
|
+
});
|
|
208
|
+
this.scrollToTop();
|
|
209
|
+
}
|
|
210
|
+
event.target.value = null;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Stores the public path of the file in the application store, where the
|
|
215
|
+
* editor field that launched the media library can retrieve it.
|
|
216
|
+
*/
|
|
217
|
+
handleInsert = () => {
|
|
218
|
+
const {
|
|
219
|
+
selectedFile
|
|
220
|
+
} = this.state;
|
|
221
|
+
const {
|
|
222
|
+
path
|
|
223
|
+
} = selectedFile;
|
|
224
|
+
const {
|
|
225
|
+
insertMedia,
|
|
226
|
+
field
|
|
227
|
+
} = this.props;
|
|
228
|
+
insertMedia(path, field);
|
|
229
|
+
this.handleClose();
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Removes the selected file from the backend.
|
|
234
|
+
*/
|
|
235
|
+
handleDelete = () => {
|
|
236
|
+
const {
|
|
237
|
+
selectedFile
|
|
238
|
+
} = this.state;
|
|
239
|
+
const {
|
|
240
|
+
files,
|
|
241
|
+
deleteMedia,
|
|
242
|
+
privateUpload,
|
|
243
|
+
t
|
|
244
|
+
} = this.props;
|
|
245
|
+
if (!window.confirm(t('mediaLibrary.mediaLibrary.onDelete'))) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const file = files.find(file => selectedFile.key === file.key);
|
|
249
|
+
deleteMedia(file, {
|
|
250
|
+
privateUpload
|
|
251
|
+
}).then(() => {
|
|
252
|
+
this.setState({
|
|
253
|
+
selectedFile: {}
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Downloads the selected file.
|
|
260
|
+
*/
|
|
261
|
+
handleDownload = () => {
|
|
262
|
+
const {
|
|
263
|
+
selectedFile
|
|
264
|
+
} = this.state;
|
|
265
|
+
const {
|
|
266
|
+
displayURLs
|
|
267
|
+
} = this.props;
|
|
268
|
+
const url = displayURLs.getIn([selectedFile.id, 'url']) || selectedFile.url;
|
|
269
|
+
if (!url) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const filename = selectedFile.name;
|
|
273
|
+
const element = document.createElement('a');
|
|
274
|
+
element.setAttribute('href', url);
|
|
275
|
+
element.setAttribute('download', filename);
|
|
276
|
+
element.style.display = 'none';
|
|
277
|
+
document.body.appendChild(element);
|
|
278
|
+
element.click();
|
|
279
|
+
document.body.removeChild(element);
|
|
280
|
+
this.setState({
|
|
281
|
+
selectedFile: {}
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
*
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
handleLoadMore = () => {
|
|
290
|
+
const {
|
|
291
|
+
loadMedia,
|
|
292
|
+
dynamicSearchQuery,
|
|
293
|
+
page,
|
|
294
|
+
privateUpload
|
|
295
|
+
} = this.props;
|
|
296
|
+
loadMedia({
|
|
297
|
+
query: dynamicSearchQuery,
|
|
298
|
+
page: page + 1,
|
|
299
|
+
privateUpload
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Executes media library search for implementations that support dynamic
|
|
305
|
+
* search via request. For these implementations, the Enter key must be
|
|
306
|
+
* pressed to execute search. If assets are being stored directly through
|
|
307
|
+
* the GitHub backend, search is in-memory and occurs as the query is typed,
|
|
308
|
+
* so this handler has no impact.
|
|
309
|
+
*/
|
|
310
|
+
handleSearchKeyDown = async event => {
|
|
311
|
+
const {
|
|
312
|
+
dynamicSearch,
|
|
313
|
+
loadMedia,
|
|
314
|
+
privateUpload
|
|
315
|
+
} = this.props;
|
|
316
|
+
if (event.key === 'Enter' && dynamicSearch) {
|
|
317
|
+
await loadMedia({
|
|
318
|
+
query: this.state.query,
|
|
319
|
+
privateUpload
|
|
320
|
+
});
|
|
321
|
+
this.scrollToTop();
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
scrollToTop = () => {
|
|
325
|
+
this.scrollContainerRef.scrollTop = 0;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Updates query state as the user types in the search field.
|
|
330
|
+
*/
|
|
331
|
+
handleSearchChange = event => {
|
|
332
|
+
this.setState({
|
|
333
|
+
query: event.target.value
|
|
334
|
+
});
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Filters files that do not match the query. Not used for dynamic search.
|
|
339
|
+
*/
|
|
340
|
+
queryFilter = (query, files) => {
|
|
341
|
+
/**
|
|
342
|
+
* Because file names don't have spaces, typing a space eliminates all
|
|
343
|
+
* potential matches, so we strip them all out internally before running the
|
|
344
|
+
* query.
|
|
345
|
+
*/
|
|
346
|
+
const strippedQuery = query.replace(/ /g, '');
|
|
347
|
+
const matches = fuzzy.filter(strippedQuery, files, {
|
|
348
|
+
extract: file => file.name
|
|
349
|
+
});
|
|
350
|
+
const matchFiles = matches.map((match, queryIndex) => {
|
|
351
|
+
const file = files[match.index];
|
|
352
|
+
return {
|
|
353
|
+
...file,
|
|
354
|
+
queryIndex
|
|
355
|
+
};
|
|
356
|
+
});
|
|
357
|
+
return matchFiles;
|
|
358
|
+
};
|
|
359
|
+
render() {
|
|
360
|
+
const {
|
|
361
|
+
isVisible,
|
|
362
|
+
canInsert,
|
|
363
|
+
files,
|
|
364
|
+
dynamicSearch,
|
|
365
|
+
dynamicSearchActive,
|
|
366
|
+
forImage,
|
|
367
|
+
isLoading,
|
|
368
|
+
isPersisting,
|
|
369
|
+
isDeleting,
|
|
370
|
+
hasNextPage,
|
|
371
|
+
isPaginating,
|
|
372
|
+
privateUpload,
|
|
373
|
+
displayURLs,
|
|
374
|
+
t
|
|
375
|
+
} = this.props;
|
|
376
|
+
return ___EmotionJSX(MediaLibraryModal, {
|
|
377
|
+
isVisible: isVisible,
|
|
378
|
+
canInsert: canInsert,
|
|
379
|
+
files: files,
|
|
380
|
+
dynamicSearch: dynamicSearch,
|
|
381
|
+
dynamicSearchActive: dynamicSearchActive,
|
|
382
|
+
forImage: forImage,
|
|
383
|
+
isLoading: isLoading,
|
|
384
|
+
isPersisting: isPersisting,
|
|
385
|
+
isDeleting: isDeleting,
|
|
386
|
+
hasNextPage: hasNextPage,
|
|
387
|
+
isPaginating: isPaginating,
|
|
388
|
+
privateUpload: privateUpload,
|
|
389
|
+
query: this.state.query,
|
|
390
|
+
selectedFile: this.state.selectedFile,
|
|
391
|
+
handleFilter: this.filterImages,
|
|
392
|
+
handleQuery: this.queryFilter,
|
|
393
|
+
toTableData: this.toTableData,
|
|
394
|
+
handleClose: this.handleClose,
|
|
395
|
+
handleSearchChange: this.handleSearchChange,
|
|
396
|
+
handleSearchKeyDown: this.handleSearchKeyDown,
|
|
397
|
+
handlePersist: this.handlePersist,
|
|
398
|
+
handleDelete: this.handleDelete,
|
|
399
|
+
handleInsert: this.handleInsert,
|
|
400
|
+
handleDownload: this.handleDownload,
|
|
401
|
+
setScrollContainerRef: ref => this.scrollContainerRef = ref,
|
|
402
|
+
handleAssetClick: this.handleAssetClick,
|
|
403
|
+
handleLoadMore: this.handleLoadMore,
|
|
404
|
+
displayURLs: displayURLs,
|
|
405
|
+
loadDisplayURL: this.loadDisplayURL,
|
|
406
|
+
t: t
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function mapStateToProps(state) {
|
|
411
|
+
const {
|
|
412
|
+
mediaLibrary
|
|
413
|
+
} = state;
|
|
414
|
+
const field = mediaLibrary.get('field');
|
|
415
|
+
const mediaLibraryProps = {
|
|
416
|
+
isVisible: mediaLibrary.get('isVisible'),
|
|
417
|
+
canInsert: mediaLibrary.get('canInsert'),
|
|
418
|
+
files: selectMediaFiles(state, field),
|
|
419
|
+
displayURLs: mediaLibrary.get('displayURLs'),
|
|
420
|
+
dynamicSearch: mediaLibrary.get('dynamicSearch'),
|
|
421
|
+
dynamicSearchActive: mediaLibrary.get('dynamicSearchActive'),
|
|
422
|
+
dynamicSearchQuery: mediaLibrary.get('dynamicSearchQuery'),
|
|
423
|
+
forImage: mediaLibrary.get('forImage'),
|
|
424
|
+
isLoading: mediaLibrary.get('isLoading'),
|
|
425
|
+
isPersisting: mediaLibrary.get('isPersisting'),
|
|
426
|
+
isDeleting: mediaLibrary.get('isDeleting'),
|
|
427
|
+
privateUpload: mediaLibrary.get('privateUpload'),
|
|
428
|
+
config: mediaLibrary.get('config'),
|
|
429
|
+
page: mediaLibrary.get('page'),
|
|
430
|
+
hasNextPage: mediaLibrary.get('hasNextPage'),
|
|
431
|
+
isPaginating: mediaLibrary.get('isPaginating'),
|
|
432
|
+
field
|
|
433
|
+
};
|
|
434
|
+
return {
|
|
435
|
+
...mediaLibraryProps
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
const mapDispatchToProps = {
|
|
439
|
+
loadMedia: loadMediaAction,
|
|
440
|
+
persistMedia: persistMediaAction,
|
|
441
|
+
deleteMedia: deleteMediaAction,
|
|
442
|
+
insertMedia: insertMediaAction,
|
|
443
|
+
loadMediaDisplayURL: loadMediaDisplayURLAction,
|
|
444
|
+
closeMediaLibrary: closeMediaLibraryAction
|
|
445
|
+
};
|
|
446
|
+
export default connect(mapStateToProps, mapDispatchToProps)(translate()(MediaLibrary));
|